Growstuff/growstuff

View on GitHub
app/views/crops/_form.html.haml

Summary

Maintainability
Test Coverage
View template is too long [117/100]
= bootstrap_form_for(@crop) do |f|
View template is too long [117/100]
- if @crop.errors.any?
View template is too long [117/100]
#error_explanation.alert.alert-warning{role: "alert"}
View template is too long [117/100]
%h3
View template is too long [117/100]
= pluralize(@crop.errors.size, "error")
View template is too long [117/100]
prohibited this crop from being saved:
View template is too long [117/100]
%ul
View template is too long [117/100]
- @crop.errors.full_messages.each do |msg|
View template is too long [117/100]
%li= msg
View template is too long [117/100]
 
View template is too long [117/100]
.card.col-12.col-md-8.mx-auto.float-none.white
View template is too long [117/100]
.card-header
View template is too long [117/100]
- if content_for? :title
View template is too long [117/100]
%h1.h2-responsive.text-center
View template is too long [117/100]
%strong=yield :title
View template is too long [117/100]
.card-body
View template is too long [117/100]
-# Handy link to crop wrangling policy/style guide, shown to wranglers only
View template is too long [117/100]
- if can? :wrangle, @crop
View template is too long [117/100]
%p
View template is too long [117/100]
%span.help-block
View template is too long [117/100]
For detailed crop wrangling guidelines, please consult the
View template is too long [117/100]
= link_to "crop wrangling guide", "https://github.com/Growstuff/growstuff/wiki/Crop-Wrangling"
View template is too long [117/100]
on the Growstuff wiki.
View template is too long [117/100]
 
View template is too long [117/100]
-# Everyone (wranglers and requesters) sees the basic info section
View template is too long [117/100]
%h2 Basic information
View template is too long [117/100]
 
View template is too long [117/100]
.form-group#new_crop
View template is too long [117/100]
= f.text_field :name, required: true
View template is too long [117/100]
%span.help-block
View template is too long [117/100]
The common name for the crop, in English (required).
View template is too long [117/100]
- if can? :wrangle, @crop
View template is too long [117/100]
Wranglers: please ensure this is singular, and capitalize
View template is too long [117/100]
proper nouns only.
View template is too long [117/100]
 
View template is too long [117/100]
%h2 Lifespan
View template is too long [117/100]
%p
View template is too long [117/100]
= f.radio_button(:perennial, false, label: 'Annual')
View template is too long [117/100]
%span.help-block Living and reproducing in a single year or less
View template is too long [117/100]
%p
View template is too long [117/100]
= f.radio_button(:perennial, true, label: "Perennial")
View template is too long [117/100]
%span.help-block Living more than two years
View template is too long [117/100]
 
View template is too long [117/100]
- unless @crop.approved?
View template is too long [117/100]
= link_to 'Search wikipedia', "https://en.wikipedia.org/w/index.php?search=#{@crop.name}", target: '_blank'
View template is too long [117/100]
= f.url_field :en_wikipedia_url, id: "en_wikipedia_url", label: 'Wikipedia URL'
View template is too long [117/100]
%span.help-block
View template is too long [117/100]
Link to the crop's page on the English language Wikipedia (required).
View template is too long [117/100]
 
View template is too long [117/100]
-# Only crop wranglers see the crop hierarchy (for now)
View template is too long [117/100]
- if can? :wrangle, @crop
View template is too long [117/100]
= f.collection_select(:parent_id, Crop.all.order(:name), :id, :name,
View template is too long [117/100]
{ include_blank: true, label: 'Parent crop'})
View template is too long [117/100]
%span.help-block Optional. For setting up crop hierarchies for varieties etc.
View template is too long [117/100]
 
View template is too long [117/100]
 
View template is too long [117/100]
-# Everyone (wranglers and requesters) gets to add scientific names
View template is too long [117/100]
%h2 Scientific names
View template is too long [117/100]
= button_tag "+", class: "add-sciname-row", type: "button"
View template is too long [117/100]
= button_tag "-", class: "remove-sciname-row", type: "button"
View template is too long [117/100]
 
View template is too long [117/100]
.form-group#scientific_names
View template is too long [117/100]
- @crop.scientific_names.each.with_index do |sci, index|
View template is too long [117/100]
.template.col-12{ id: "sci_template[#{index + 1}]" }
View template is too long [117/100]
.col-2
View template is too long [117/100]
= label_tag :scientific_names, "Scientific name #{index + 1}:", class: 'control-label'
View template is too long [117/100]
.col-8
View template is too long [117/100]
= text_field_tag "sci_name[#{index + 1}]", sci.name, id: "sci_name[#{index + 1}]",
View template is too long [117/100]
class: 'scientific-name-auto-suggest form-control',
View template is too long [117/100]
data: { source_url: gbif_suggest_scientific_names_path }
View template is too long [117/100]
%span.help-block Searches GBIF to determine scientific name of crop.
View template is too long [117/100]
= hidden_field_tag "sci_gbif_key[#{index + 1}]", sci.gbif_key, id: "sci_gbif_key[#{index + 1}]",
View template is too long [117/100]
class: 'scientific-name-auto-suggest-id'
View template is too long [117/100]
%h2 Alternate names
View template is too long [117/100]
= button_tag "+", class: "add-altname-row", type: "button"
View template is too long [117/100]
= button_tag "-", class: "remove-altname-row", type: "button"
View template is too long [117/100]
 
View template is too long [117/100]
.form-group#alternate_names
View template is too long [117/100]
- @crop.alternate_names.each.with_index do |alt, index|
View template is too long [117/100]
.template.col-12{ id: "alt_template[#{index + 1}]" }
View template is too long [117/100]
.col-2
View template is too long [117/100]
= label_tag :alternate_names, "Alternate name #{index + 1}:", class: 'control-label'
View template is too long [117/100]
.col-8
View template is too long [117/100]
= text_field_tag "alt_name[#{index + 1}]", alt.name, id: "alt_name[#{index + 1}]", class: 'form-control'
View template is too long [117/100]
%span.help-block Alternate name of crop.
View template is too long [117/100]
.col-2
View template is too long [117/100]
 
View template is too long [117/100]
-# This is used for comments from crop requesters. We need to show it
View template is too long [117/100]
-# to everyone, but we don't include it on new crops from wranglers.
View template is too long [117/100]
 
View template is too long [117/100]
- if (can?(:wrangle, @crop) && @crop.requester) || (cannot?(:wrangle, @crop) && @crop.new_record?)
View template is too long [117/100]
%h2 Crop request notes
View template is too long [117/100]
= f.text_area :request_notes, rows: 3, id: 'request_notes', label: 'Comments'
View template is too long [117/100]
 
View template is too long [117/100]
-# A final explanation of what's going to happen next, for crop requesters
View template is too long [117/100]
- unless can? :wrangle, @crop
View template is too long [117/100]
%p
View template is too long [117/100]
When you submit this form, your suggestion will be sent to our team of
View template is too long [117/100]
volunteer crop wranglers for review. We'll let you know the outcome as soon as we can.
View template is too long [117/100]
 
View template is too long [117/100]
-# Now, for crop wranglers, let's have approval/rejection at the bottom of the page
View template is too long [117/100]
- if can?(:wrangle, @crop) && @crop.requester
View template is too long [117/100]
-# %h2 Approve or reject pending crops
View template is too long [117/100]
-# = f.select(:approval_status, @crop.approval_statuses, {})
View template is too long [117/100]
= f.select(:reason_for_rejection, @crop.reasons_for_rejection, include_blank: true)
View template is too long [117/100]
 
View template is too long [117/100]
= f.text_area :rejection_notes, rows: 3
View template is too long [117/100]
%span.help-block
View template is too long [117/100]
Please provide additional notes why this crop request was rejected if the above reasons do not apply.
View template is too long [117/100]
 
View template is too long [117/100]
.card-footer
View template is too long [117/100]
.text-right
View template is too long [117/100]
- if @crop.approved?
View template is too long [117/100]
= f.submit 'Save'
View template is too long [117/100]
- else
View template is too long [117/100]
= f.submit 'Reject', class: 'btn btn-danger', name: 'reject'
View template is too long [117/100]
= f.submit 'Approve and save', class: 'btn btn-success', name: 'approve'