mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-31 03:09:06 -04:00
Admin for crop job templates, a tidier crop wrangling page, and crop and template seeds
32 lines
1.6 KiB
Plaintext
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
|