mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-03-26 02:33:03 -04:00
* Update gardens to have a non 0 area * Spec no longer possible through frontend * Fix spec * Swap harvest to html5 date field * Fix spec
58 lines
2.4 KiB
Plaintext
58 lines
2.4 KiB
Plaintext
.card.col-md-8.col-lg-7.mx-auto.float-none.white.z-depth-1.py-2.px-2
|
|
|
|
= bootstrap_form_for(@harvest) do |f|
|
|
.card-header
|
|
- if content_for? :title
|
|
%h1.h2-responsive.text-center
|
|
= harvest_icon
|
|
%strong=yield :title
|
|
.card-body
|
|
- if @harvest.errors.any?
|
|
#error_explanation
|
|
%h2 #{pluralize(@harvest.errors.size, "error")} prohibited this harvest from being saved:"
|
|
%ul
|
|
- @harvest.errors.full_messages.each do |msg|
|
|
%li= msg
|
|
|
|
.row
|
|
.col-12
|
|
= f.label :crop, 'What did you harvest?', class: 'required'
|
|
- if @planting
|
|
= link_to @planting.crop.name, planting_path(@planting)
|
|
from
|
|
= link_to @planting.garden.name, garden_path(@planting.garden)
|
|
= f.hidden_field :planting_id, value: @planting.id
|
|
- else
|
|
= auto_suggest @harvest, :crop, class: 'form-control', default: @crop
|
|
- unless @planting
|
|
%span.help-block.col-md-8
|
|
Can't find what you're looking for?
|
|
= link_to "Request new crops.", new_crop_path
|
|
|
|
.col-md-4
|
|
= f.date_field :harvested_at, value: @harvest.harvested_at ? @harvest.harvested_at.to_fs(:ymd) : '', label: 'When?'
|
|
.col-12
|
|
= f.form_group :plant_part_id, label: { text: "Harvested Plant Part" } do
|
|
.row
|
|
- PlantPart.all.order(:name).pluck(:id, :name).each do |id, name|
|
|
.col-4.col-md-3= f.radio_button :plant_part_id, id, label: name, checked: (id == @harvest.plant_part_id)
|
|
|
|
-# Some browsers (eg Firefox for Android) assume "number" means
|
|
-# "integer" unless you specify step="any":
|
|
-# http://blog.isotoma.com/2012/03/html5-input-typenumber-and-decimalsfloats-in-chrome/
|
|
.row
|
|
.col-md-4
|
|
= f.number_field :quantity, class: 'input-small form-control', step: 'any', label: 'How many?', min: 1
|
|
.col-md-8
|
|
= f.select(:unit, Harvest::UNITS_VALUES, { include_blank: false }, class: 'input-medium form-control')
|
|
.row
|
|
.col-md-4
|
|
= f.number_field :weight_quantity, class: 'input-small form-control', step: 'any', label: 'Weighing (in total)'
|
|
.col-md-8
|
|
= f.select(:weight_unit, Harvest::WEIGHT_UNITS_VALUES, { include_blank: false }, class: 'form-control')
|
|
= f.text_area :description, rows: 6, label: 'Notes'
|
|
|
|
.card-footer
|
|
.text-right= f.submit 'Save'
|
|
|