Files
growstuff/app/views/seeds/_hero.html.haml
T

47 lines
2.1 KiB
Plaintext

-# The hero for one packet of seed: the grower's face, what the packet is, the
-# badges that matter when swapping, where it came from, and the actions menu.
-# See DESIGN.md.
-#
-# A photo of the seeds if there is one, otherwise of the crop they came from.
-# Never the placeholder: that says nothing worth 260px.
- hero_photo = seed.default_photo || seed.crop.default_photo
- if hero_photo
= link_to seed_path(seed), class: 'record-hero-photo' do
= image_tag(hero_photo.source == 'flickr' ? hero_photo.fullsize_url : hero_photo.thumbnail_url,
alt: "#{seed.crop.name} seeds saved by #{seed.owner}")
.jumbotron
.d-flex.justify-content-between.align-items-start
.record-identity
= render 'shared/record_owner', owner: seed.owner
.record-identity-text
.record-title
%h1.display-3
= crop_icon(seed.crop)
%strong= t('seeds.show.heading', crop: seed.crop.name.titleize)
%p.lead.mb-0
saved by
%strong.record-grower-name= link_to seed.owner, seed.owner
%span.text-muted
·
= I18n.l seed.created_at.to_date
%p.seed-badges.mb-0
- if seed.organic != 'unknown'
%span.badge.text-bg-success.seedtitle--organic= seed.organic
- if seed.gmo != 'unknown'
%span.badge.text-bg-success.seedtitle--gmo= seed.gmo
- if seed.heirloom != 'unknown'
%span.badge.text-bg-success.seedtitle--heirloom= seed.heirloom
- if seed.parent_planting
= render 'shared/record_parent', planting: seed.parent_planting, verb: 'saved from'
= render 'seeds/actions', seed: seed
-# Asking for a swap is what a visitor comes to this page to do, so it sits
-# in the hero rather than loose between the sections below.
.seed-request
- if current_member
- if seed.tradable && current_member != seed.owner
- ask = { recipient_id: seed.owner.id, subject: "Interested in your #{seed.crop} seeds" }
= link_to "Request seeds", new_message_path(ask), class: 'btn btn-primary'
- else
= render 'shared/signin_signup', to: 'request seeds'