Use button helper for crop wrangling

This commit is contained in:
Brenda Wallace committed 2019-01-24 12:17:40 +13:00
1 parent c9be8be9e5
commit ca75b1c852
2 files changed
+6 -9

No files matched your search

+4
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
+2 -9
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