Files
growstuff/app/views/crops/_wrangle.html.haml
T
Brenda Wallace 6332f26c58 Merge pull request #4994 from Growstuff/crop-job-templates-admin
Admin for crop job templates, a tidier crop wrangling page, and crop and template seeds
2026-10-23 13:26:33 +10:30

32 lines
1.6 KiB
Plaintext

-# The crop's actions menu: the same three-dot kebab as every other record
-# page, in the top right of the hero. No "you are a crop wrangler" banner —
-# seeing the menu at all already tells you that.
- if can?(:edit, crop) || can?(:destroy, crop)
= actions_menu('crop') do
- if crop.approved?
= menu_modal_link :edit, t('.edit'), '#crop-edit-modal'
- else
-# A pending crop is approved or rejected on the form page.
= menu_link_to :edit, t('.edit'), edit_crop_path(crop)
= menu_modal_link :add, 'Add scientific name', '#scientific-name-new'
= menu_modal_link :add, 'Add another name', '#alternate-name-new'
= menu_link_to :download, 'Fetch data from GBIF', crop_gbif_path(crop), method: :post
= menu_link_to :people, 'Manage companions', admin_crop_crop_companions_path(crop)
= menu_link_to :finish, 'Job templates', admin_crop_crop_job_templates_path(crop)
- if can? :destroy, crop
.dropdown-divider
= menu_delete_button(crop)
- if crop.approved?
= render 'crops/edit_modal', crop: crop
-# The dialogs the menu and the names open. Outside the dropdown, so they are
-# not torn down with it when it closes.
= render 'crops/scientific_name_modal', crop: crop, scientific_name: ScientificName.new(crop: crop)
- crop.scientific_names.each do |sn|
- if can? :edit, sn
= render 'crops/scientific_name_modal', crop: crop, scientific_name: sn
= render 'crops/alternate_name_modal', crop: crop, alternate_name: AlternateName.new(crop: crop)
- crop.alternate_names.each do |an|
- if can? :edit, an
= render 'crops/alternate_name_modal', crop: crop, alternate_name: an