Files
growstuff/app/views/seeds/show.html.haml
T
Brenda Wallace 062bf738b3 Hide the packet text for now, and fix the packet_text migration
The text read from a packet is kept in seeds.packet_text but is not on any form
or page yet: the OCR script will fill it in a follow-up. The column's migration
comment had an apostrophe that broke its string, so it did not run.
2026-10-28 20:35:09 +13:00

89 lines
3.6 KiB
Plaintext

- seed_title = "#{@seed.owner}'s #{@seed.crop} seeds"
- seed_blurb = "Seeds for #{@seed.crop.name}, shared by #{@seed.owner}."
= render 'shared/record_meta',
title: seed_title,
description: @seed.description.presence || seed_blurb,
image: seed_image_path(@seed)
-# The edit and add-photo dialogs; the latter is a React island.
- content_for :scripts do
= javascript_include_tag 'react_islands', defer: true
%script{ type: "application/ld+json" }
= crop_jsonld_data(@seed.crop, full_attributes: false).to_json.html_safe
-# A packet of seed is usually saved off a planting, so the trail descends
-# through plantings whenever we know which one. Without a parent there is no
-# such trail, so it falls back to the owner's seeds.
- content_for :breadcrumbs do
- if @seed.parent_planting.present?
%li.breadcrumb-item= link_to 'Plantings', plantings_path
%li.breadcrumb-item= link_to @seed.parent_planting.display_name, @seed.parent_planting
- else
%li.breadcrumb-item= link_to 'Seeds', seeds_path
%li.breadcrumb-item= link_to @seed.owner, member_seeds_path(@seed.owner)
%li.breadcrumb-item.active Seeds
.seed-show.record-page
.row
.col-md-8.col-12
-# Everything that is this packet of seeds, inside one border. See DESIGN.md.
.record-panel.seed-detail
= render 'seeds/hero', seed: @seed
%section.seed-facts= render 'facts', seed: @seed
= cute_icon
%section.seed--description
.section-header
%h2 Notes
-# "edit", not "+ add": there is one note, not a list to add to.
- if can?(:edit, @seed)
- notes_edit = { href: '#', "data-display" => '.seed-notes-body',
"data-form" => "##{editable_form_id(@seed, :description)}" }
%a.btn.btn-sm.section-add.editable{ notes_edit }
= menu_icon(:edit)
edit
-# The trigger lives in the heading bar above, so the partial renders
-# the form alone.
= render 'shared/editable/form',
field_type: :text_area, model: @seed, field: :description,
display_field: '.seed-notes-body', values: nil, trigger: :none
.seed-notes-body
- if @seed.description.present?
:markdown
#{strip_tags markdownify(@seed.description)}
- else
%p.text-muted.mb-0 No notes yet.
%section.seed-descendants
.section-header
%h2 Plants grown from these seeds
- if can?(:create, Planting) && can?(:update, @seed) && @seed.active
= link_to new_planting_path(seed_id: @seed), class: 'btn btn-sm section-add' do
= icon 'fas', 'plus'
add
= render 'seeds/descendants', seed: @seed
%section#photos
.section-header
%h2 Photos
- if can?(:edit, @seed) && can?(:create, Photo)
- add_photo = new_photo_path(id: @seed.id, type: 'seed')
= link_to add_photo, class: 'btn btn-sm section-add', data: photo_dialog_data(@seed) do
= icon 'fas', 'plus'
add
- if @photos.any?
= render 'photos/gallery', photos: @photos, item: @seed
= will_paginate @photos
- else
-# One line. The "+ add" on the heading bar is the invitation.
%p.text-muted.mb-0 No photos yet.
.col-md-4.col-12
%section.seed-crop
.section-header
%h2 Crop
= render 'plantings/crop', crop: @seed.crop
= render 'crops/nutritional_data', crop: @seed.crop