From 6bba2ae2886c30ee788b71360902f75815d1d5cc Mon Sep 17 00:00:00 2001 From: Matchu Date: Sat, 26 Sep 2015 15:31:55 -0700 Subject: [PATCH] bulk action bar renders, but does nothing --- .../stylesheets/closet_hangers/_index.sass | 19 +++++++++++++++++-- app/helpers/closet_hangers_helper.rb | 11 +++++++++++ app/views/closet_hangers/index.html.haml | 13 ++++++++++--- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/app/assets/stylesheets/closet_hangers/_index.sass b/app/assets/stylesheets/closet_hangers/_index.sass index 89de7340..7c0b88fd 100644 --- a/app/assets/stylesheets/closet_hangers/_index.sass +++ b/app/assets/stylesheets/closet_hangers/_index.sass @@ -379,17 +379,32 @@ body.closet_hangers-index .bulk-actions-intro, .bulk-actions-target-desc-singular 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"] .bulk-actions-intro display: block - text-align: center .bulk-actions-form display: none &[data-target-count="1"] .bulk-actions-target-desc-singular - display: block + display: inline .bulk-actions-target-desc-plural display: none diff --git a/app/helpers/closet_hangers_helper.rb b/app/helpers/closet_hangers_helper.rb index 41d97e8c..263bd44b 100644 --- a/app/helpers/closet_hangers_helper.rb +++ b/app/helpers/closet_hangers_helper.rb @@ -153,5 +153,16 @@ module ClosetHangersHelper def closet_hangers_subject(user) public_perspective? ? user.name : :you 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| ["—#{h list.name}".html_safe, list.id] } + end + options + end end diff --git a/app/views/closet_hangers/index.html.haml b/app/views/closet_hangers/index.html.haml index 4ec175dd..0571ddf9 100644 --- a/app/views/closet_hangers/index.html.haml +++ b/app/views/closet_hangers/index.html.haml @@ -62,14 +62,21 @@ .bulk-actions{'data-target-count' => 0} .bulk-actions-intro Manage items in bulk! Select an item by clicking its thumbnail. - %form.bulk-actions-form + .bulk-actions-form .bulk-actions-target-desc %span.bulk-actions-target-desc-singular - With the 1 selected item + With the 1 selected item: %span.bulk-actions-target-desc-plural With the %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| .closet-hangers-group{'data-owned' => owned.to_s, :id => "closet-hangers-group-#{owned}"} %header