From 315d7f13b254aa62e277805d7d9816b0c7042479 Mon Sep 17 00:00:00 2001 From: zsloan Date: Thu, 22 Apr 2021 18:23:50 +0000 Subject: Added JS that sets the 'add to collection' dropdown to default to the collection the use set as their default collection --- wqflask/wqflask/static/new/javascript/search_results.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/wqflask/wqflask/static/new/javascript/search_results.js b/wqflask/wqflask/static/new/javascript/search_results.js index ecb1220d..48b9b7be 100644 --- a/wqflask/wqflask/static/new/javascript/search_results.js +++ b/wqflask/wqflask/static/new/javascript/search_results.js @@ -326,4 +326,15 @@ $(function() { } ); } + 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).text().split(":")[0] == default_collection_id); + }) + the_option.prop('selected', true); + } + } + apply_default(); + }); \ No newline at end of file -- cgit v1.2.3