From 15f5df7fe795a32e2d61dd11f825e53b1a1175ec Mon Sep 17 00:00:00 2001 From: zsloan Date: Wed, 17 Jun 2020 15:21:41 -0500 Subject: Fixed issue where removing traits from collection didn't work; previous fix wasn't working for some reason --- wqflask/wqflask/collect.py | 2 +- .../static/new/javascript/search_results.js | 34 ---------------------- wqflask/wqflask/templates/collections/view.html | 5 ++++ 3 files changed, 6 insertions(+), 35 deletions(-) diff --git a/wqflask/wqflask/collect.py b/wqflask/wqflask/collect.py index e8459821..42a09fed 100644 --- a/wqflask/wqflask/collect.py +++ b/wqflask/wqflask/collect.py @@ -157,7 +157,7 @@ def remove_traits(): params = request.form uc_id = params['uc_id'] - traits_to_remove = params.getlist('traits[]') + traits_to_remove = params['trait_list'] traits_to_remove = process_traits(traits_to_remove) members_now = g.user_session.remove_traits_from_collection(uc_id, traits_to_remove) diff --git a/wqflask/wqflask/static/new/javascript/search_results.js b/wqflask/wqflask/static/new/javascript/search_results.js index 115dac13..39aae113 100644 --- a/wqflask/wqflask/static/new/javascript/search_results.js +++ b/wqflask/wqflask/static/new/javascript/search_results.js @@ -137,40 +137,6 @@ $(function() { } }; - remove = function() { - var traits, uc_id; - checked_traits = $("#trait_table input:checked"); - traits = checked_traits.map(function() { - return $(this).val(); - }).get(); - console.log("checked length is:", traits.length); - console.log("checked is:", traits); - if ( $("#uc_id").length ) { - uc_id = $("#uc_id").val(); - return $.ajax({ - type: "POST", - url: "/collections/remove", - data: { - uc_id: uc_id, - traits: traits - }, - success: removed_traits - }); - } - else { - collection_name = $("#collection_name").val(); - return $.ajax({ - type: "POST", - url: "/collections/remove", - data: { - collection_name: collection_name, - traits: traits - }, - success: removed_traits - }); - } - }; - submit_bnw = function() { trait_data = get_traits_from_table("trait_table", "submit_bnw") } diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html index ec0e0220..b56a89da 100644 --- a/wqflask/wqflask/templates/collections/view.html +++ b/wqflask/wqflask/templates/collections/view.html @@ -232,6 +232,11 @@ $("#remove").on("click", function() { url = $(this).data("url") + traits = $("#trait_table input:checked").map(function() { + return $(this).val(); + }).get(); + $("#trait_list").val(traits) + return submit_special(url) }); -- cgit v1.2.3