aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2021-04-14 20:26:34 +0000
committerzsloan2021-04-14 20:26:34 +0000
commit939a27cb0ede3102ce929e445690e1ba86d5870a (patch)
tree4dbbed80bc219a18b1b67f23e42043fc39eb5d62 /wqflask
parentaf652da915ae263eac56c3b7ea255be31a7fccaa (diff)
downloadgenenetwork2-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.html20
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>