app/views/plantings/show.html.haml
= content_for :title, "#{@planting.crop} in #{@planting.location}"
- content_for :opengraph do
= tag("meta", property: "og:image", content: planting_image_path(@planting))
= tag("meta", property: "og:title", content: "#{@planting.crop} in #{@planting.location}")
- if @planting.description
= tag("meta", property: "og:description", content: og_description(@planting.description))
= 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 'Plantings', plantings_path
%li.breadcrumb-item= link_to @planting.owner, member_plantings_path(@planting.owner)
%li.breadcrumb-item.active= link_to @planting.crop.name, @planting
- if @planting.parent_seed.nil? && @matching_seeds && @matching_seeds.any? && @planting.owner == current_member
.alert.alert-info{role: "alert"}
= bootstrap_form_for(@planting) do |f|
Is this from one of these plantings?
- @matching_seeds.each do |seed|
= f.radio_button :parent_seed_id, seed.id, label: seed
= f.submit "save", class: 'btn btn-sm'
.planting
.row
.col-md-8.col-xs-12
.jumbotron
.d-flex.justify-content-between
%h1.display-3
= crop_icon(@planting.crop)
%strong= @planting.crop.name.titleize
%small.text-muted= @planting.crop.default_scientific_name
%tt
- if @planting.finished?
Finished
- elsif @planting.percentage_grown.present?
#{@planting.percentage_grown.to_i}%
- if @planting.finish_is_predicatable?
- if @planting.age_in_days < 0
%strong Planned
- else
%strong #{@planting.age_in_days}/#{@planting.expected_lifespan} days
= render 'timeline', planting: @planting
= render 'likes/likes', object: @planting
= render 'plantings/actions', planting: @planting
.col-md-4.col-xs-12
= render 'plantings/owner', planting: @planting
.col-md-8.col-xs-12
%section= render 'facts', planting: @planting
- if @planting.description.present?
= cute_icon
.card
.card-header
%h2 Notes
.card-body
:markdown
#{strip_tags markdownify(@planting.description)}
%section= render 'plantings/photos', photos: @photos, planting: @planting
%section.harvests
%a{name: 'harvests'}
= render 'plantings/harvests', planting: @planting
%section.descendants
%a{name: 'seeds'}
= render 'plantings/descendants', planting: @planting
%section
%h2 Current activities for planting
.index-cards
- if @current_activities&.size&.positive?
- @current_activities.each do |activity|
= render "activities/card", activity: activity
- else
.col-md-12
%p Nothing is currently planned here.
.col-md-4.col-xs-12
= render @planting.crop
- if @planting.location
%section.neighbours
%h2 World Neighbours
- @neighbours.each do |planting|
= link_to planting, class: 'list-group-item list-group-item-action flex-column align-items-start' do
.d-flex.w-100.justify-content-between
%p.mb-2
= image_tag planting_image_path(planting), width: 75, class: 'rounded shadow', alt: "Image of #{planting.crop.name} by #{planting.owner}"
.text-right
%h5= planting.crop.name
- if planting.planted_from.present?
%span.badge.badge-success= planting.planted_from.pluralize
%small.text-muted
planted by #{planting.owner}
in #{planting.garden.location}
%p Other #{@planting.crop.name} plantings at the same latitude