app/views/plant_parts/index.html.haml
- content_for :title, "Plant parts"
%h1 Plant Parts
- if can? :create, PlantPart
= link_to 'New plant part', new_plant_part_path, class: 'btn btn-info'
.index-cards
- @plant_parts.each do |plant_part|
.card.plant-part
.card-header
%h2= link_to plant_part, plant_part
.card-body
%p
- if plant_part.crops.empty?
No crops are harvested for this plant part (yet).
- else
- plant_part.crops.limit(20).each do |crop|
= render 'crops/tiny', crop: crop
.card-footer
%p
- if can? :edit, plant_part
= link_to t('buttons.edit'), edit_plant_part_path(plant_part), class: 'btn btn-default btn-xs'
- if can? :destroy, plant_part
= link_to t('buttons.delete'), plant_part, method: :delete, data: { confirm: t(:are_you_sure?) }, class: 'btn btn-default btn-xs'
= will_paginate(@plant_parts)