Growstuff/growstuff

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

Summary

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

- if can? :create, AlternateName
  %p= link_to 'New alternate name', new_alternate_name_path, class: 'btn btn-primary'

%table
  %tr
    %th Alternate name
    %th Crop
    %th
    %th

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