Use button helper for crop wrangling

This commit is contained in:
Brenda Wallace
2019-01-23 15:06:56 +13:00
parent c9be8be9e5
commit ca75b1c852
2 changed files with 6 additions and 9 deletions

View File

@@ -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

View File

@@ -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