Files
growstuff/app/views/scientific_names/_form.html.haml
google-labs-jules[bot] b5aaf2a124 feat: Add pattern attribute to wikidata input
Adds a pattern attribute to the wikidata input on scientific names to enforce the 'Q' followed by numbers format.
2025-12-01 13:30:24 +00:00

34 lines
1.2 KiB
Plaintext

= form_for @scientific_name, html: { class: 'form-horizontal' } do |f|
- if @scientific_name.errors.any?
#error_explanation
%h2
= pluralize(@scientific_name.errors.size, "error")
prohibited this scientific_name from being saved:
%ul
- @scientific_name.errors.full_messages.each do |msg|
%li= msg
%p
%span.help-block
For detailed crop wrangling guidelines, please consult the
= link_to "crop wrangling guide", "http://wiki.growstuff.org/index.php/Crop_wrangling"
on the Growstuff wiki.
.form-group
= f.label :crop_id, class: 'control-label col-md-2'
.col-md-8
= collection_select(:scientific_name, :crop_id, Crop.all.order(:name), :id,
:name, { selected: @scientific_name.crop_id || @crop.id },
class: 'form-control')
.form-group
= f.label :name, class: 'control-label col-md-2'
.col-md-8
= f.text_field :name, class: 'form-control'
.form-group
= f.label :wikidata_id, "Wikidata ID", class: 'control-label col-md-2'
.col-md-8
= f.text_field :wikidata_id, class: 'form-control', pattern: 'Q[1-9][0-9]*'
.form-group
.form-actions.col-md-offset-2.col-md-8
= f.submit 'Save', class: 'btn btn-primary'