app/views/harvests/show.html.haml
= content_for :title, "#{@harvest.crop} harvested by #{@harvest.owner}"
- content_for :opengraph do
= tag("meta", property: "og:image", content: harvest_image_path(@harvest))
= tag("meta", property: "og:image:user_generated", content: "true")
= tag("meta", property: "og:title", content: "#{@harvest.crop} harvested by #{@harvest.owner}")
= tag("meta", property: "og:type", content: "website")
= tag("meta", property: "og:url", content: request.original_url)
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
- content_for :breadcrumbs do
%li.breadcrumb-item= link_to 'Harvests', harvests_path
%li.breadcrumb-item= link_to @harvest.owner, member_harvests_path(@harvest.owner)
%li.breadcrumb-item.active= link_to @harvest, @harvest
.harvest
.row
.col-md-8.col-xs-12
.jumbotron
.d-flex.justify-content-between
%h1.display-3
= harvest_icon
%strong= @harvest.crop
%small.text-muted
harvested by
= @harvest.owner
- if @harvest.description.present?
:markdown
#{strip_tags markdownify(@harvest.description)}
= render partial: 'planting'
= render 'likes/likes', object: @harvest
= render 'harvests/actions', harvest: @harvest
.col-md-4.col-xs-12
= render 'harvests/owner', harvest: @harvest
.col-md-8.col-xs-12
.index-cards.facts
- if @harvest.plant_part
.card
%h3
Plant part
= editable :select, @harvest, :plant_part_id, collection: PlantPart.all.pluck(:name, :id), display_field: '.harvest-plantpart'
%strong.harvest-plantpart= @harvest.plant_part
.card
%h3
Harvested
= editable :date, @harvest, :harvested_at, display_field: '.harvested_at'
%strong.harvested_at #{distance_of_time_in_words @harvest.harvested_at, Time.zone.now.to_date} ago
%span.harvested_at= I18n.l @harvest.harvested_at
.card{class: @harvest.quantity.present? ? '' : 'text-muted'}
%h3
Quantity
= editable :text_field, @harvest, :quantity, display_field: '.quantity'
%strong.quantity
= display_quantity(@harvest)
%section
%h2 Photos
= render 'photos/gallery', photos: @harvest.photos.order(date_taken: :desc)
= add_photo_button(@harvest)
%section.harvest-detail
%h2 Detail
- if @harvest.planting.present?
Havested from
= link_to @harvest.planting, @harvest.planting
.col-md-4.col-xs-12
= render @harvest.crop