From 1c0e350af2a30f4627ad879545c9c6fc6554d92a Mon Sep 17 00:00:00 2001 From: radhika Date: Wed, 5 Nov 2014 23:33:21 -0500 Subject: [PATCH] 3177: restrict only one file selection in collection chooser; remove clippy; clear selections on load. --- .../app/assets/javascripts/select_modal.js | 6 ++++++ .../app/assets/javascripts/selection.js.erb | 3 ++- apps/workbench/app/views/layouts/body.html.erb | 13 ------------- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/apps/workbench/app/assets/javascripts/select_modal.js b/apps/workbench/app/assets/javascripts/select_modal.js index 36c145fc02..d84037763c 100644 --- a/apps/workbench/app/assets/javascripts/select_modal.js +++ b/apps/workbench/app/assets/javascripts/select_modal.js @@ -35,8 +35,14 @@ $(document).on('click', '.selectable', function() { }); } }).on('click', '.persistent-selection', function() { + var checked_status = this.checked; var $modal = $(this).closest('.modal'); $checked_selections = $modal.find('.persistent-selection:checked'); + + if (checked_status && ($checked_selections.length > 1)) { + $(this).prop('checked', false); + } + any = ($checked_selections.length > 0); $(this). closest('.modal'). diff --git a/apps/workbench/app/assets/javascripts/selection.js.erb b/apps/workbench/app/assets/javascripts/selection.js.erb index 59e6425698..38f3f4a83f 100644 --- a/apps/workbench/app/assets/javascripts/selection.js.erb +++ b/apps/workbench/app/assets/javascripts/selection.js.erb @@ -108,7 +108,8 @@ jQuery(function($){ } }); - $(window).on('load storage', update_count); + $(window).on('load', clear_selections); + $(window).on('storage', update_count); $('#selection-form-content').on("click", function(e) { e.stopPropagation(); diff --git a/apps/workbench/app/views/layouts/body.html.erb b/apps/workbench/app/views/layouts/body.html.erb index 3fc0c92fcd..9e966e148a 100644 --- a/apps/workbench/app/views/layouts/body.html.erb +++ b/apps/workbench/app/views/layouts/body.html.erb @@ -67,19 +67,6 @@ - - <% if current_user.is_admin %>