Select All + visual feedback
This commit is contained in:
parent
0aca529e27
commit
621c768921
5 changed files with 50 additions and 5 deletions
|
@ -94,13 +94,21 @@
|
||||||
|
|
||||||
// Ooh, this part is weird. We only want the name to be linked, so
|
// Ooh, this part is weird. We only want the name to be linked, so
|
||||||
// lift everything else out.
|
// lift everything else out.
|
||||||
var label = $('<label />');
|
var checkboxId = 'hanger-selected-' + hangerId;
|
||||||
var checkbox = $('<input type="checkbox" />').appendTo(label);
|
var label = $('<label />', {'for': checkboxId});
|
||||||
var link = hangerEl.children('a');
|
var link = hangerEl.children('a');
|
||||||
link.children(':not(.name)').detach().appendTo(label);
|
link.children(':not(.name)').detach().appendTo(label);
|
||||||
link.detach().appendTo(label);
|
link.detach().appendTo(label);
|
||||||
|
var checkbox = $('<input />', {
|
||||||
|
type: 'checkbox',
|
||||||
|
id: checkboxId
|
||||||
|
}).appendTo(hangerEl);
|
||||||
label.appendTo(hangerEl);
|
label.appendTo(hangerEl);
|
||||||
|
|
||||||
|
// I don't usually like to _blank things, but it's too easy to click
|
||||||
|
// the text when you didn't mean to and lose your selection work.
|
||||||
|
link.attr('target', '_blank');
|
||||||
|
|
||||||
$.tmpl("updateFormTmpl", {
|
$.tmpl("updateFormTmpl", {
|
||||||
user_id: currentUserId,
|
user_id: currentUserId,
|
||||||
closet_hanger_id: hangerId,
|
closet_hanger_id: hangerId,
|
||||||
|
@ -331,6 +339,20 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(hangersElQuery + " .select-all").live("click", function(e) {
|
||||||
|
var checkboxes = $(this).closest(".closet-list").find(".object input[type=checkbox]");
|
||||||
|
|
||||||
|
var allChecked = true;
|
||||||
|
checkboxes.each(function() {
|
||||||
|
if (!this.checked) {
|
||||||
|
allChecked = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
checkboxes.attr('checked', !allChecked);
|
||||||
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Search, autocomplete
|
Search, autocomplete
|
||||||
|
|
|
@ -119,6 +119,12 @@ body.closet_hangers-index
|
||||||
&:hover
|
&:hover
|
||||||
text-decoration: underline
|
text-decoration: underline
|
||||||
|
|
||||||
|
.object
|
||||||
|
margin: 0
|
||||||
|
|
||||||
|
label
|
||||||
|
display: block
|
||||||
|
|
||||||
input[type=checkbox]
|
input[type=checkbox]
|
||||||
display: none
|
display: none
|
||||||
position: absolute
|
position: absolute
|
||||||
|
@ -127,6 +133,13 @@ body.closet_hangers-index
|
||||||
height: 16px
|
height: 16px
|
||||||
width: 16px
|
width: 16px
|
||||||
|
|
||||||
|
&:checked
|
||||||
|
display: block
|
||||||
|
|
||||||
|
& + label
|
||||||
|
background: $module-bg-color
|
||||||
|
outline: 1px solid $module-border-color
|
||||||
|
|
||||||
.closet-hangers-group
|
.closet-hangers-group
|
||||||
border-top: 1px solid $module-border-color
|
border-top: 1px solid $module-border-color
|
||||||
margin-bottom: 2em
|
margin-bottom: 2em
|
||||||
|
@ -231,7 +244,7 @@ body.closet_hangers-index
|
||||||
right: 1em
|
right: 1em
|
||||||
top: 0
|
top: 0
|
||||||
|
|
||||||
a, input[type=submit]
|
a, input[type=submit], button
|
||||||
+context-button
|
+context-button
|
||||||
|
|
||||||
form
|
form
|
||||||
|
@ -376,6 +389,12 @@ body.closet_hangers-index
|
||||||
#toggle-help
|
#toggle-help
|
||||||
display: inline-block
|
display: inline-block
|
||||||
|
|
||||||
|
.remove-all
|
||||||
|
display: none
|
||||||
|
|
||||||
|
.select-all
|
||||||
|
display: inline-block
|
||||||
|
|
||||||
&.js
|
&.js
|
||||||
#toggle-compare
|
#toggle-compare
|
||||||
display: inline-block
|
display: inline-block
|
||||||
|
|
|
@ -77,9 +77,10 @@
|
||||||
= f.submit t('.unlisted.submit')
|
= f.submit t('.unlisted.submit')
|
||||||
= closet_visibility_descriptions
|
= closet_visibility_descriptions
|
||||||
.closet-list-controls
|
.closet-list-controls
|
||||||
= form_tag user_closet_hangers_path(@user), method: :delete do
|
= form_tag user_closet_hangers_path(@user), method: :delete, class: 'remove-all' do
|
||||||
= hidden_field_tag :list_id, owned
|
= hidden_field_tag :list_id, owned
|
||||||
= submit_tag t('.remove_all.submit'), confirm: t('.remove_all.confirm')
|
= submit_tag t('.remove_all.submit'), confirm: t('.remove_all.confirm')
|
||||||
|
%button.select-all= t('.select_all')
|
||||||
- if has_lists?(owned)
|
- if has_lists?(owned)
|
||||||
%h4= t '.unlisted.header'
|
%h4= t '.unlisted.header'
|
||||||
- if !@public_perspective
|
- if !@public_perspective
|
||||||
|
|
|
@ -9,9 +9,10 @@
|
||||||
= link_to t('.edit'), edit_user_closet_list_path(closet_list.user_id, closet_list)
|
= link_to t('.edit'), edit_user_closet_list_path(closet_list.user_id, closet_list)
|
||||||
= form_tag user_closet_list_path(closet_list.user_id, closet_list), :method => 'delete' do
|
= form_tag user_closet_list_path(closet_list.user_id, closet_list), :method => 'delete' do
|
||||||
= submit_tag t('.delete'), :confirm => closet_list_delete_confirmation(closet_list)
|
= submit_tag t('.delete'), :confirm => closet_list_delete_confirmation(closet_list)
|
||||||
= form_tag user_closet_hangers_path(@user), method: :delete do
|
= form_tag user_closet_hangers_path(@user), method: :delete, class: 'remove-all' do
|
||||||
= hidden_field_tag :list_id, closet_list.id
|
= hidden_field_tag :list_id, closet_list.id
|
||||||
= submit_tag t('.remove_all.submit'), confirm: t('.remove_all.confirm')
|
= submit_tag t('.remove_all.submit'), confirm: t('.remove_all.confirm')
|
||||||
|
%button.select-all= t('.select_all')
|
||||||
%h4= closet_list.name
|
%h4= closet_list.name
|
||||||
|
|
||||||
- if show_controls
|
- if show_controls
|
||||||
|
|
|
@ -131,6 +131,7 @@ en:
|
||||||
remove_all:
|
remove_all:
|
||||||
confirm: 'Remove all items from this list?'
|
confirm: 'Remove all items from this list?'
|
||||||
submit: Remove all
|
submit: Remove all
|
||||||
|
select_all: Select all
|
||||||
autocomplete:
|
autocomplete:
|
||||||
add_item_html: Add <strong>%{item_name}</strong>
|
add_item_html: Add <strong>%{item_name}</strong>
|
||||||
add_to_list_html: Add to <strong>%{list_name}</strong>
|
add_to_list_html: Add to <strong>%{list_name}</strong>
|
||||||
|
@ -194,6 +195,7 @@ en:
|
||||||
remove_all:
|
remove_all:
|
||||||
confirm: 'Remove all items from this list?'
|
confirm: 'Remove all items from this list?'
|
||||||
submit: Remove all
|
submit: Remove all
|
||||||
|
select_all: Select all
|
||||||
empty: This list is empty.
|
empty: This list is empty.
|
||||||
trading_neomail_warning_html:
|
trading_neomail_warning_html:
|
||||||
You've marked this list as Trading, so folks will discover it via Dress
|
You've marked this list as Trading, so folks will discover it via Dress
|
||||||
|
|
Loading…
Reference in a new issue