Growstuff/growstuff

View on GitHub
app/views/scientific_names/index.html.haml

Summary

Maintainability
Test Coverage
- content_for :title, "Listing scientific names"

- if can? :create, ScientificName
  %p= link_to 'New Scientific name', new_scientific_name_path, class: 'btn btn-primary'

%table
  %tr
    %th Scientific name
    %th Crop
    %th
    %th

  - @scientific_names.each do |scientific_name|
    %tr
      %td= link_to scientific_name.name, scientific_name
      %td= scientific_name.crop_id
      %td= link_to 'Show', scientific_name
      %td
        - if can? :edit, scientific_name
          = link_to t('buttons.edit'), edit_scientific_name_path(scientific_name), class: 'btn btn-default btn-xs'
      %td
        - if can? :destroy, scientific_name
          = link_to t('buttons.delete'), scientific_name, method: :delete, data: { confirm: t(:are_you_sure?) },
            class: 'btn btn-default btn-xs'

= will_paginate @scientific_names