Growstuff/growstuff

View on GitHub
app/views/gardens/_actions.html.haml

Summary

Maintainability
Test Coverage
- if can?(:edit, garden)
  .dropdown.garden-actions
    %a#garden-actions-button.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button", href: '#'} Actions
    .dropdown-menu.dropdown-menu-xs{"aria-labelledby" => "garden-actions-button"}
      - if can?(:edit, garden)
        - if garden.active
          = garden_plant_something_button(garden, classes: 'dropdown-item')
          = garden_plan_something_button(garden, classes: 'dropdown-item')
          = garden_mark_inactive_button(garden, classes: 'dropdown-item')
        - else
          = garden_mark_active_button(garden, classes: 'dropdown-item')

        = garden_edit_button(garden, classes: 'dropdown-item')
        = add_photo_button(garden, classes: 'dropdown-item')

      - if can?(:destroy, garden)
        .dropdown-divider
        = delete_button(garden, classes: 'dropdown-item text-danger',
          message: 'All plantings associated with this garden will also be deleted. Are you sure?')