Files
growstuff/app/views/plantings/_card.html.haml
T

26 lines
1.3 KiB
Plaintext

-# The quick actions below are the owner's own, so the fragment has to vary by
-# whether the viewer is that owner. Keyed on the planting alone, the first
-# person to render a card decides what everyone after them sees: a visitor
-# priming it hides the owner's own controls, and the owner priming it shows
-# them to strangers.
- owner_viewing = member_signed_in? && current_member.id == planting.owner_id
- cache [planting, owner_viewing] do
.card.planting{class: planting.active ? '' : 'card-finished'}
= link_to planting_path(slug: planting.slug) do
= image_tag planting.thumbnail_url ? planting.thumbnail_url : placeholder_image, class: 'img-card', alt: planting.display_name
- if owner_viewing
.planting-quick-actions= render 'plantings/menu', planting:
= link_to planting_path(slug: planting.slug) do
.card-body.text-center
%h4= planting.display_name
.text-center= render 'plantings/badges', planting: planting
= render 'plantings/progress', planting: planting
.card-footer
%small
Planted by
= link_to member_path(slug: planting.owner_slug), class: "owner-link" do
= planting.owner_login_name
in
= link_to garden_path(slug: planting.garden_slug), class: "garden-link" do
= planting.garden_name