diff --git a/app/helpers/buttons_helper.rb b/app/helpers/buttons_helper.rb index 8697ffd4c..32df4d932 100644 --- a/app/helpers/buttons_helper.rb +++ b/app/helpers/buttons_helper.rb @@ -16,6 +16,10 @@ module ButtonsHelper data: { confirm: 'All plantings associated with this garden will be marked as finished. Are you sure?' } end + def crop_edit_button(crop) + edit_button(edit_crop_path(seed)) + end + def seed_edit_button(seed) edit_button(edit_seed_path(seed)) end diff --git a/app/views/crops/_wrangle.html.haml b/app/views/crops/_wrangle.html.haml index fafafd490..4260bbfe2 100644 --- a/app/views/crops/_wrangle.html.haml +++ b/app/views/crops/_wrangle.html.haml @@ -5,12 +5,5 @@ = succeed "." do %strong CROP WRANGLER - - if can? :edit, crop - %p - = link_to t(:edit_crop), edit_crop_path(crop), class: 'btn btn-default' - - if can? :destroy, crop - %p - = link_to 'Delete crop', crop, - method: :delete, - data: { confirm: t('are_you_sure') }, - class: 'btn btn-default' + %p= crop_edit_button(crop) if can? :edit, crop + %p= delete_button(crop) if can? :destroy, crop