mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-03-26 10:45:04 -04:00
Starting to tidy the crops form
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
.card.col-md-8.col-lg-7.mx-auto.float-none.white.z-depth-1.py-2.px-2
|
||||
.card-body
|
||||
- if content_for? :title
|
||||
%h1.h2-responsive.text-center
|
||||
%strong=yield :title
|
||||
= form_for @crop, html: { class: 'form-horizontal', role: "form" } do |f|
|
||||
= bootstrap_form_for(@crop) do |f|
|
||||
.card-header
|
||||
- if content_for? :title
|
||||
%h1.h2-responsive.text-center
|
||||
%strong=yield :title
|
||||
.card-body
|
||||
- if @crop.errors.any?
|
||||
#error_explanation
|
||||
%h3
|
||||
@@ -25,40 +26,31 @@
|
||||
%h2 Basic information
|
||||
|
||||
.form-group#new_crop
|
||||
= f.label :name, class: 'control-label col-md-2'
|
||||
.col-md-8
|
||||
= f.text_field :name, class: 'form-control'
|
||||
%span.help-block
|
||||
The common name for the crop, in English (required).
|
||||
- if can? :wrangle, @crop
|
||||
Wranglers: please ensure this is singular, and capitalize
|
||||
proper nouns only.
|
||||
= f.text_field :name
|
||||
%span.help-block
|
||||
The common name for the crop, in English (required).
|
||||
- if can? :wrangle, @crop
|
||||
Wranglers: please ensure this is singular, and capitalize
|
||||
proper nouns only.
|
||||
|
||||
.form-group
|
||||
= f.label :perennial, 'Lifespan', class: 'control-label col-md-2'
|
||||
.col-md-8
|
||||
= f.radio_button(:perennial, false)
|
||||
= f.label(:perennial_false, "Annual")
|
||||
%span.help-block Living and reproducing in a single year or less
|
||||
= f.radio_button(:perennial, true)
|
||||
= f.label(:perennial_true, "Perennial")
|
||||
%span.help-block Living more than two years
|
||||
|
||||
.form-group
|
||||
= f.label :en_wikipedia_url, 'Wikipedia URL', class: 'control-label col-md-2'
|
||||
.col-md-8
|
||||
= f.text_field :en_wikipedia_url, class: 'form-control', id: "en_wikipedia_url"
|
||||
%span.help-block
|
||||
Link to the crop's page on the English language Wikipedia (required).
|
||||
%h2 Lifespan
|
||||
%p
|
||||
= f.radio_button(:perennial, false, label: 'Annual')
|
||||
%span.help-block Living and reproducing in a single year or less
|
||||
%p
|
||||
= f.radio_button(:perennial, true, label: "Perennial")
|
||||
%span.help-block Living more than two years
|
||||
|
||||
= f.text_field :en_wikipedia_url, id: "en_wikipedia_url", label: 'Wikipedia URL'
|
||||
%span.help-block
|
||||
Link to the crop's page on the English language Wikipedia (required).
|
||||
|
||||
-# Only crop wranglers see the crop hierarchy (for now)
|
||||
- if can? :wrangle, @crop
|
||||
.form-group
|
||||
= f.label :parent_id, 'Parent crop', class: 'control-label col-md-2'
|
||||
.col-md-8
|
||||
= collection_select(:crop, :parent_id, Crop.all.order(:name), :id, :name,
|
||||
{ include_blank: true }, class: 'form-control')
|
||||
%span.help-block Optional. For setting up crop hierarchies for varieties etc.
|
||||
= f.collection_select(:parent_id, Crop.all.order(:name), :id, :name,
|
||||
{ include_blank: true, label: 'Parent crop'})
|
||||
%span.help-block Optional. For setting up crop hierarchies for varieties etc.
|
||||
|
||||
|
||||
-# Everyone (wranglers and requesters) gets to add scientific names
|
||||
@@ -73,10 +65,8 @@
|
||||
.col-md-2
|
||||
= label_tag :scientific_names, "Scientific name #{index + 1}:", class: 'control-label'
|
||||
.col-md-8
|
||||
= text_field_tag "sci_name[#{index + 1}]", sci.name, id: "sci_name[#{index + 1}]", class: 'form-control'
|
||||
= text_field_tag "sci_name[#{index + 1}]", sci.name, id: "sci_name[#{index + 1}]"
|
||||
%span.help-block Scientific name of crop.
|
||||
.col-md-2
|
||||
|
||||
%h2
|
||||
Alternate names
|
||||
= button_tag "+", id: "add-alt_name-row", type: "button"
|
||||
@@ -88,7 +78,7 @@
|
||||
.col-md-2
|
||||
= label_tag :alternate_names, "Alternate name #{index + 1}:", class: 'control-label'
|
||||
.col-md-8
|
||||
= text_field_tag "alt_name[#{index + 1}]", alt.name, id: "alt_name[#{index + 1}]", class: 'form-control'
|
||||
= text_field_tag "alt_name[#{index + 1}]", alt.name, id: "alt_name[#{index + 1}]"
|
||||
%span.help-block Alternate name of crop.
|
||||
.col-md-2
|
||||
|
||||
@@ -100,7 +90,7 @@
|
||||
.form-group
|
||||
= f.label :request_notes, 'Comments', class: 'control-label col-md-2'
|
||||
.col-md-8
|
||||
= f.text_area :request_notes, rows: 3, class: 'form-control', id: 'request_notes'
|
||||
= f.text_area :request_notes, rows: 3, id: 'request_notes'
|
||||
|
||||
-# A final explanation of what's going to happen next, for crop requesters
|
||||
- unless can? :wrangle, @crop
|
||||
@@ -114,17 +104,17 @@
|
||||
.form-group
|
||||
= f.label :approval_status, 'Approval status', class: 'control-label col-md-2'
|
||||
.col-md-8
|
||||
= f.select(:approval_status, @crop.approval_statuses, {}, class: 'form-control')
|
||||
= f.select(:approval_status, @crop.approval_statuses, {})
|
||||
|
||||
.form-group
|
||||
= f.label :reason_for_rejection, 'Reason for rejection', class: 'control-label col-md-2'
|
||||
.col-md-8
|
||||
= f.select(:reason_for_rejection, @crop.reasons_for_rejection, include_blank: true, class: 'form-control')
|
||||
= f.select(:reason_for_rejection, @crop.reasons_for_rejection, include_blank: true)
|
||||
|
||||
.form-group
|
||||
= f.label :rejection_notes, 'Rejection notes', class: 'control-label col-md-2'
|
||||
.col-md-8
|
||||
= f.text_area :rejection_notes, rows: 3, class: 'form-control'
|
||||
= f.text_area :rejection_notes, rows: 3
|
||||
%span.help-block
|
||||
Please provide additional notes why this crop request was rejected if the above reasons do not apply.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user