diff options
author | zsloan | 2021-04-14 20:26:34 +0000 |
---|---|---|
committer | zsloan | 2021-04-14 20:26:34 +0000 |
commit | 939a27cb0ede3102ce929e445690e1ba86d5870a (patch) | |
tree | 4dbbed80bc219a18b1b67f23e42043fc39eb5d62 /wqflask | |
parent | af652da915ae263eac56c3b7ea255be31a7fccaa (diff) | |
download | genenetwork2-939a27cb0ede3102ce929e445690e1ba86d5870a.tar.gz |
Added JS that automatically selects the default collection if it's set
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/templates/collections/add.html | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/wqflask/wqflask/templates/collections/add.html b/wqflask/wqflask/templates/collections/add.html index b4e5385b..0398c6e4 100644 --- a/wqflask/wqflask/templates/collections/add.html +++ b/wqflask/wqflask/templates/collections/add.html @@ -49,8 +49,20 @@ </div> <script> - $('#add_form').parsley(); - $('#add_form').on('submit', function(){ - parent.jQuery.colorbox.close(); - }); + $('#add_form').parsley(); + $('#add_form').on('submit', function(){ + parent.jQuery.colorbox.close(); + }); + + apply_default = function() { + let default_collection_id = $.cookie('default_collection'); + if (default_collection_id) { + let the_option = $('[name=existing_collection] option').filter(function() { + return ($(this).val().split(":")[0] == default_collection_id); + }) + the_option.prop('selected', true); + } + } + + apply_default(); </script> |