Files
growstuff/app/views/jobs/_form.html.haml
T

59 lines
1.9 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(@job) do |f|
.card-body
- if @job.errors.any?
#error_explanation
%h2
= pluralize(@job.errors.size, "error")
prohibited this job from being saved:
%ul
- @job.errors.full_messages.each do |msg|
%li= msg
.row
.col-md-12
= f.text_field :name, required: true, label: 'What needs to be done?', autofocus: true
.row
.col-md-12
= f.text_area :description, rows: 6, label: 'Tell us more about it'
.row
.col-md-4
= f.collection_radio_buttons(:garden_id, @job.owner.gardens.active.order_by_name,
:id, :name,
label: 'Is this for a specific garden?')
= link_to "Add a garden.", new_garden_path
.col-md-4
= f.collection_radio_buttons(:planting_id, @job.owner.plantings.active.recent,
:id, :crop_name,
label: 'Is this for a specific planting?')
= link_to "Add a planting.", new_planting_path
.col-md-4
= f.date_field :due_date,
value: @job.due_date ? @job.due_date.to_fs(:ymd) : '',
label: 'When?'
%hr
.row
.col-md-6
= f.check_box :finished, label: t('buttons.mark_as_finished')
%span.form-text= t('jobs.form.finish_helper')
- if @job.new_record?
.row
.col-md-6
= label_tag :repeat_times, 'Repeat how many times?'
= number_field_tag :repeat_times, nil, class: 'form-control'
.col-md-6
= label_tag :repeat_weeks, 'Every how many weeks?'
= number_field_tag :repeat_weeks, nil, class: 'form-control'
.card-footer
.text-end= f.submit 'Save'