diff --git a/app/assets/javascripts/closet_hangers/index.js b/app/assets/javascripts/closet_hangers/index.js index d15eaee7..065288fe 100644 --- a/app/assets/javascripts/closet_hangers/index.js +++ b/app/assets/javascripts/closet_hangers/index.js @@ -398,10 +398,9 @@ data: data, success: function (html) { var doc = $(html); - maintainCheckboxes(function() { - hangersEl.html( doc.find('#closet-hangers').html() ); - hangersInit(); - }); + hangersEl.html( doc.find('#closet-hangers').html() ); + hangersInit(); + updateBulkActions(); // don't want to maintain checked; deselect em all doc.find('.flash').hide().insertBefore(hangersEl).show(500).delay(5000).hide(250); itemsSearchField.val(""); }, @@ -436,6 +435,11 @@ }); }); + $(".bulk-actions-deselect-all").bind("click", function(e) { + getCheckboxes().filter(':checked').attr('checked', false); + updateBulkActions(); + }); + function maintainCheckboxes(fn) { var checkedIds = getCheckedIds(); diff --git a/app/views/closet_hangers/index.html.haml b/app/views/closet_hangers/index.html.haml index d814d3aa..7cc614b4 100644 --- a/app/views/closet_hangers/index.html.haml +++ b/app/views/closet_hangers/index.html.haml @@ -77,6 +77,8 @@ %li = form_tag user_closet_hangers_path(@user), method: :delete, class: 'bulk-actions-remove-all' do %button Remove all + %li + %button.bulk-actions-deselect-all Deselect all #closet-hangers{:class => public_perspective? ? nil : 'current-user'} - [true, false].each do |owned|