deselect all

This commit is contained in:
Matchu 2015-09-26 19:58:31 -07:00
parent e6a2b978f1
commit e4757b0ee4
2 changed files with 10 additions and 4 deletions

View file

@ -398,10 +398,9 @@
data: data, data: data,
success: function (html) { success: function (html) {
var doc = $(html); var doc = $(html);
maintainCheckboxes(function() { hangersEl.html( doc.find('#closet-hangers').html() );
hangersEl.html( doc.find('#closet-hangers').html() ); hangersInit();
hangersInit(); updateBulkActions(); // don't want to maintain checked; deselect em all
});
doc.find('.flash').hide().insertBefore(hangersEl).show(500).delay(5000).hide(250); doc.find('.flash').hide().insertBefore(hangersEl).show(500).delay(5000).hide(250);
itemsSearchField.val(""); itemsSearchField.val("");
}, },
@ -436,6 +435,11 @@
}); });
}); });
$(".bulk-actions-deselect-all").bind("click", function(e) {
getCheckboxes().filter(':checked').attr('checked', false);
updateBulkActions();
});
function maintainCheckboxes(fn) { function maintainCheckboxes(fn) {
var checkedIds = getCheckedIds(); var checkedIds = getCheckedIds();

View file

@ -77,6 +77,8 @@
%li %li
= form_tag user_closet_hangers_path(@user), method: :delete, class: 'bulk-actions-remove-all' do = form_tag user_closet_hangers_path(@user), method: :delete, class: 'bulk-actions-remove-all' do
%button Remove all %button Remove all
%li
%button.bulk-actions-deselect-all Deselect all
#closet-hangers{:class => public_perspective? ? nil : 'current-user'} #closet-hangers{:class => public_perspective? ? nil : 'current-user'}
- [true, false].each do |owned| - [true, false].each do |owned|