Skip to content

Commit

Permalink
deselect all
Browse files Browse the repository at this point in the history
  • Loading branch information
matchu committed Sep 27, 2015
1 parent e6a2b97 commit e4757b0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/assets/javascripts/closet_hangers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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("");
},
Expand Down Expand Up @@ -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();

Expand Down
2 changes: 2 additions & 0 deletions app/views/closet_hangers/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down

0 comments on commit e4757b0

Please sign in to comment.