From 8ae062fe9beec641b4133f4606a8753ab18cab2b Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 22 Jan 2019 17:11:30 +1300 Subject: [PATCH] Added missing harvest actions --- app/helpers/buttons_helper.rb | 8 ++++++++ app/views/harvests/_actions.html.haml | 10 ++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/helpers/buttons_helper.rb b/app/helpers/buttons_helper.rb index b3ed95a25..89b3c95e6 100644 --- a/app/helpers/buttons_helper.rb +++ b/app/helpers/buttons_helper.rb @@ -1,4 +1,12 @@ module ButtonsHelper + def harvest_add_photo_button(harvest) + button(new_photo_path(id: harvest.id, type: "harvest"), 'buttons.add_a_photo', 'camera') + end + + def harvest_edit_button(harvest) + button(edit_harvest_path(harvest), 'buttons.edit', 'pencil') + end + def garden_plant_something_button(garden) button(new_planting_path(garden_id: garden.id), 'buttons.plant_something_here', 'leaf') end diff --git a/app/views/harvests/_actions.html.haml b/app/views/harvests/_actions.html.haml index 2ebfbc8f9..a86cbdb18 100644 --- a/app/views/harvests/_actions.html.haml +++ b/app/views/harvests/_actions.html.haml @@ -1,7 +1,5 @@ .harvest-actions - - if can?(:edit, harvest) || can?(:destroy, harvest) - .btn-group - - if can? :edit, harvest - = render 'shared/buttons/edit', path: edit_harvest_path(harvest) - - if can? :destroy, harvest - .pull-right= render 'shared/buttons/delete', path: harvest_path(harvest) + .btn-group + = harvest_edit_button(harvest) if can? :edit, harvest + = harvest_add_photo_button(harvest) + = delete_button(harvest) if can? :destroy, harvest