mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-31 03:09:06 -04:00
* Replace bootstrap datepicker with native HTML5 date inputs Convert planting and seed date text fields to native HTML5 date fields (`f.date_field`), matching existing date inputs across the app. Remove bootstrap-datepicker JS/CSS imports, legacy site wrapper scripts, package dependency, and update test specs. Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com> * Fix spec * Fix spec * Fix spec * Drop expectations about removed control * Fix specs --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
87 lines
3.7 KiB
Plaintext
87 lines
3.7 KiB
Plaintext
.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
|
|
|
|
#planting-alternate-name.mb-3{ class: ('d-none' unless @planting.crop&.alternate_names&.any?),
|
|
data: { source_url: alternate_names_path(format: :json) } }
|
|
= f.label :alternate_name_id, 'What do you call it?'
|
|
= f.select :alternate_name_id,
|
|
options_from_collection_for_select(@planting.crop&.alternate_names&.order(:name) || [], :id, :name, @planting.alternate_name_id),
|
|
{ include_blank: @planting.crop&.name || '' }, class: 'form-select'
|
|
%span.form-text Optional. Your plantings will show this name instead of the crop's main name.
|
|
|
|
.row
|
|
.col-md-8
|
|
- if @garden_locked
|
|
= f.hidden_field :garden_id
|
|
%p
|
|
Planting in
|
|
%strong= @planting.garden.name
|
|
= link_to 'Choose a different garden', new_planting_path
|
|
- else
|
|
= f.collection_radio_buttons(:garden_id, @planting.owner.gardens.active.order_by_name,
|
|
:id, :name, required: true,
|
|
label: 'Where did you plant it?')
|
|
= link_to "Add a garden.", new_garden_path
|
|
.col-md-4
|
|
= f.date_field :planted_at,
|
|
value: @planting.planted_at ? @planting.planted_at.to_fs(:ymd) : '',
|
|
label: 'When?', title: "Plan out 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
|
|
.col-md-12
|
|
= f.range_field :overall_rating, min: 1, max: 5, include_blank: 'Leave blank', label: 'Overall Rating', list: "rating-list", title: "How well is the planting going?"
|
|
%datalist{"id": "rating-list"}
|
|
%option{"value": "1"} Poor
|
|
%option{"value": "2"}
|
|
%option{"value": "3"}
|
|
%option{"value": "4"}
|
|
%option{"value": "5"} Great
|
|
|
|
= f.text_area :description, rows: 6, label: 'Tell us more about it'
|
|
|
|
.row
|
|
.col-md-6
|
|
= f.check_box :finished, label: t('buttons.mark_as_finished'), title: t('.finish_helper')
|
|
|
|
.col-md-6
|
|
= f.date_field :finished_at,
|
|
value: @planting.finished_at ? @planting.finished_at.to_fs(:ymd) : '',
|
|
label: 'Finished date',
|
|
placeholder: 'optional'
|
|
.row
|
|
.col-md-6
|
|
= f.check_box :failed, label: t('buttons.mark_as_failed'), title: t('.failed_helper')
|
|
|
|
.card-footer
|
|
.text-end= f.submit 'Save'
|