app/views/plantings/_form.html.haml
.card.col-md-8.col-lg-7.mx-auto.float-none.white.z-depth-1.py-2.px-2
.card-header
- if content_for? :title
%h1.h2-responsive.text-center
= planting_icon
%strong=yield :title
= bootstrap_form_for(@planting) do |f|
.card-body
- if @planting.errors.any?
#error_explanation
%h2
= pluralize(@planting.errors.size, "error")
prohibited this planting from being saved:
%ul
- @planting.errors.full_messages.each do |msg|
%li= msg
= f.label :crop, 'What did you plant?', class: 'required'
- if @seed.present?
= link_to @seed, seed_path(@seed)
= f.hidden_field :parent_seed_id, value: @seed.id
- else
= auto_suggest @planting, :crop, class: 'form-control', default: @crop
%span.help-inline
Can't find what you're looking for?
= link_to "Request new crops.", new_crop_path
.row
.col-md-8
= f.collection_radio_buttons(:garden_id, @planting.owner.gardens.active,
:id, :name, required: true,
label: 'Where did you plant it?')
= link_to "Add a garden.", new_garden_path
.col-md-4
= f.text_field :planted_at,
value: @planting.planted_at ? @planting.planted_at.to_fs(:ymd) : '',
class: 'add-datepicker', label: 'When?'
%span.help-inline
Tip: Plan our your future plantings by forward dating, and subscribe to your iCalendar feed for reminders to plant
.row
.col-md-4
= f.select(:planted_from, Planting::PLANTED_FROM_VALUES, { include_blank: '', label: 'Planted from' } )
.col-md-4
= f.select(:sunniness, Planting::SUNNINESS_VALUES, { include_blank: '', label: 'Sun or shade?' } )
.col-md-4
= f.number_field :quantity, label: 'How many?', min: 1
= f.text_area :description, rows: 6, label: 'Tell us more about it'
.row
.col-md-6
= f.check_box :finished, label: 'Mark as finished'
%span.help-block= t('.finish_helper')
.col-md-6
= f.text_field :finished_at,
value: @planting.finished_at ? @planting.finished_at.to_fs(:ymd) : '',
class: 'add-datepicker',
label: 'Finished date',
placeholder: 'optional'
.card-footer
.text-right= f.submit 'Save'