app/views/crops/_harvests.html.haml
.card
.card-body
%h3 #{crop.name.capitalize} harvests
- if crop.harvests.none?
%p Nobody has harvested this crop yet.
- unless crop.harvests.empty?
%ul.list-group.list-group-flush
- Harvest.where(crop: crop).includes(:owner).order(harvested_at: :desc).limit(3).each do |harvest|
%li.list-group-item
= link_to harvest_path(harvest), class: 'card-link' do
= harvest_icon
#{harvest.owner} harvested #{display_quantity(harvest)}.
.float-right= render 'members/location', member: harvest.owner
.harvest-timeago
%small #{distance_of_time_in_words(harvest.harvested_at, Time.zone.now)} ago.
%li.list-group-item= link_to "View all #{crop.name} harvests", crop_harvests_path(crop), class: 'card-link'
- if crop.approved?
- if current_member
%li.list-group-item= link_to "Harvest #{crop.name}", new_harvest_path(crop_id: crop.id), class: 'btn btn-block'
- else
%li.list-group-item.active
= icon 'fas', 'user'
= render partial: 'shared/signin_signup', locals: { to: "track your #{crop.name} harvests" }