app/views/crops/_scientific_names.html.haml
.scientific_names
%h4 Scientific names
- if crop.scientific_names.empty?
%p None known.
- else
- crop.scientific_names.each do |sn|
- if can? :edit, sn
.dropdown.planting-actions
%a#planting-actions-scinames.dropdown-toggle.card-link{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", :type => "button", :href => '#'}= sn.name
.dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "planting-actions-button"}
= link_to edit_scientific_name_path(sn), class: 'dropdown-item' do
= edit_icon
= t('.edit')
.dropdown-divider
= link_to sn, method: :delete, data: { confirm: 'Are you sure?' }, class: 'dropdown-item text-danger' do
= delete_icon
= t('.delete')
- else
- if sn.gbif_key
= link_to sn.name, "https://www.gbif.org/species/#{sn.gbif_key}",
class: 'card-link',
target: "_blank",
rel: "noopener noreferrer"
- else
.badge= sn.name
%p.text-right
- if can? :edit, crop
= link_to 'Add', new_scientific_name_path(crop_id: crop.id), class: 'btn btn-default btn-xs'