From 0d02f5758b8233a4b6ba3ecb2ba3babb75bb182a Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 9 Jun 2019 15:53:01 +1200 Subject: [PATCH] actions menu for harvests --- app/helpers/buttons_helper.rb | 4 ++-- app/views/harvests/_actions.html.haml | 13 ++++++++----- app/views/harvests/show.html.haml | 4 +--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/helpers/buttons_helper.rb b/app/helpers/buttons_helper.rb index bc6da29f9..685cb2438 100644 --- a/app/helpers/buttons_helper.rb +++ b/app/helpers/buttons_helper.rb @@ -53,8 +53,8 @@ module ButtonsHelper edit_button(edit_seed_path(seed), classes: classes) end - def harvest_edit_button(harvest) - edit_button(edit_harvest_path(harvest)) + def harvest_edit_button(harvest, classes: "btn btn-raised btn-info") + edit_button(edit_harvest_path(harvest), classes: classes) end def garden_edit_button(garden, classes: "btn btn-raised btn-info") diff --git a/app/views/harvests/_actions.html.haml b/app/views/harvests/_actions.html.haml index 28a9aee77..1b42b8524 100644 --- a/app/views/harvests/_actions.html.haml +++ b/app/views/harvests/_actions.html.haml @@ -1,5 +1,8 @@ -.harvest-actions - .btn-group - = harvest_edit_button(harvest) if can? :edit, harvest - = add_photo_button(harvest) - = delete_button(harvest) +- if can?(:edit, harvest) + .dropdown.float-right.harvest-actions + %a#harvest-actions-button.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", :type => "button"} Actions + .dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "harvest-actions-button"} + = harvest_edit_button(harvest, classes: 'dropdown-item') + = add_photo_button(harvest, classes: 'dropdown-item') + .dropdown-divider + = delete_button(harvest, classes: 'dropdown-item text-danger') diff --git a/app/views/harvests/show.html.haml b/app/views/harvests/show.html.haml index 82411246f..2e8ec3260 100644 --- a/app/views/harvests/show.html.haml +++ b/app/views/harvests/show.html.haml @@ -8,14 +8,12 @@ = tag("meta", property: "og:url", content: request.original_url) = tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME']) --content_for(:buttonbar) do - = render 'harvests/actions', harvest: @harvest - .row .col-md-8 %h1 = harvest_icon #{@harvest.crop} harvested by #{@harvest.owner} + = render 'harvests/actions', harvest: @harvest %p %b Owner: = link_to @harvest.owner, @harvest.owner