bulk action bar renders, but does nothing

This commit is contained in:
Matchu 2015-09-26 15:31:55 -07:00
parent 776b2e864a
commit 6bba2ae288
3 changed files with 38 additions and 5 deletions

View file

@ -379,17 +379,32 @@ body.closet_hangers-index
.bulk-actions-intro, .bulk-actions-target-desc-singular .bulk-actions-intro, .bulk-actions-target-desc-singular
display: none display: none
.bulk-actions-target-desc
display: inline-block
.bulk-actions-options
display: inline-block
list-style: none
> li
display: inline-block
margin-left: .75em
&:not(:first-child)::before
content: " or "
display: inline-block
margin-right: .75em
&[data-target-count="0"] &[data-target-count="0"]
.bulk-actions-intro .bulk-actions-intro
display: block display: block
text-align: center
.bulk-actions-form .bulk-actions-form
display: none display: none
&[data-target-count="1"] &[data-target-count="1"]
.bulk-actions-target-desc-singular .bulk-actions-target-desc-singular
display: block display: inline
.bulk-actions-target-desc-plural .bulk-actions-target-desc-plural
display: none display: none

View file

@ -153,5 +153,16 @@ module ClosetHangersHelper
def closet_hangers_subject(user) def closet_hangers_subject(user)
public_perspective? ? user.name : :you public_perspective? ? user.name : :you
end end
def destination_options
# eww, copy-pasted from neopets page import helpers
options = []
[true, false].each do |owned|
relevant_lists = @closet_lists_by_owned[owned] || []
options << [closet_lists_group_name(:you, owned), owned]
options += relevant_lists.map { |list| ["&mdash;#{h list.name}".html_safe, list.id] }
end
options
end
end end

View file

@ -62,14 +62,21 @@
.bulk-actions{'data-target-count' => 0} .bulk-actions{'data-target-count' => 0}
.bulk-actions-intro .bulk-actions-intro
Manage items in bulk! Select an item by clicking its thumbnail. Manage items in bulk! Select an item by clicking its thumbnail.
%form.bulk-actions-form .bulk-actions-form
.bulk-actions-target-desc .bulk-actions-target-desc
%span.bulk-actions-target-desc-singular %span.bulk-actions-target-desc-singular
With the 1 selected item With the 1 selected item:
%span.bulk-actions-target-desc-plural %span.bulk-actions-target-desc-plural
With the With the
%span.bulk-actions-target-count 0 %span.bulk-actions-target-count 0
selected items selected items:
%ul.bulk-actions-options
%li
%form
= select_tag 'destination', options_for_select(destination_options)
%button Move
%li
%button Remove all
- [true, false].each do |owned| - [true, false].each do |owned|
.closet-hangers-group{'data-owned' => owned.to_s, :id => "closet-hangers-group-#{owned}"} .closet-hangers-group{'data-owned' => owned.to_s, :id => "closet-hangers-group-#{owned}"}
%header %header