Update planting form

This commit is contained in:
Amy Hendrix
2014-07-14 22:19:07 -04:00
parent 8da3430852
commit 863f1dfae7

View File

@@ -1,4 +1,4 @@
= form_for(@planting, :html => {:class => "form-horizontal"}) do |f|
= form_for(@planting, :html => {:class => "form-horizontal", :role => "form"}) do |f|
- if @planting.errors.any?
#error_explanation
%h2= "#{pluralize(@planting.errors.count, "error")} prohibited this planting from being saved:"
@@ -7,36 +7,36 @@
%li= msg
.form-group
= f.label 'What did you plant?', :class => 'control-label'
.controls
= collection_select(:planting, :crop_id, Crop.all, :id, :name, :selected => @planting.crop_id || @crop.id)
= f.label 'What did you plant?', :class => 'control-label col-md-2'
.col-md-4
= collection_select(:planting, :crop_id, Crop.all, :id, :name, {:selected => @planting.crop_id || @crop.id}, {:class => 'form-control'})
%span.help-inline
Can't find what you're looking for?
= link_to "Request new crops.", Growstuff::Application.config.new_crops_request_link
.form-group
= f.label 'Where did you plant it?', :class => 'control-label'
.controls
= collection_select(:planting, :garden_id, Garden.active.where(:owner_id => current_member), :id, :name, :selected => @planting.garden_id || @garden.id)
= f.label 'Where did you plant it?', :class => 'control-label col-md-2'
.col-md-4
= collection_select(:planting, :garden_id, Garden.active.where(:owner_id => current_member), :id, :name, {:selected => @planting.garden_id || @garden.id}, {:class => 'form-control'})
%span.help-inline
= link_to "Add a garden.", new_garden_path
.form-group
= f.label 'When?', :class => 'control-label'
.controls= f.text_field :planted_at, :value => @planting.planted_at ? @planting.planted_at.to_s(:ymd) : '', :class => 'add-datepicker'
= f.label 'When?', :class => 'control-label col-md-2'
.col-md-3= f.text_field :planted_at, :value => @planting.planted_at ? @planting.planted_at.to_s(:ymd) : '', :class => 'add-datepicker form-control'
.form-group
= f.label 'How many?', :class => 'control-label'
.controls
= f.number_field :quantity, :class => 'input-small'
= f.label 'How many?', :class => 'control-label col-md-2'
.col-md-2
= f.number_field :quantity, :class => 'form-control'
.form-group
= f.label 'Planted from:', :class => 'control-label'
.controls
= f.select(:planted_from, Planting::PLANTED_FROM_VALUES, {:include_blank => true})
= f.label 'Planted from:', :class => 'control-label col-md-2'
.col-md-4
= f.select(:planted_from, Planting::PLANTED_FROM_VALUES, {:include_blank => true}, :class => 'form-control')
.form-group
= f.label 'Sun or shade?', :class => 'control-label'
.controls
= f.select(:sunniness, Planting::SUNNINESS_VALUES, {:include_blank => true})
= f.label 'Sun or shade?', :class => 'control-label col-md-2'
.col-md-4
= f.select(:sunniness, Planting::SUNNINESS_VALUES, {:include_blank => true}, :class => 'form-control')
.form-group
= f.label 'Tell us more about it', :class => 'control-label col-md-2'
.col-md-4= f.text_area :description, :rows => 6, :class => 'form-control'
.form-group
= f.label 'Tell us more about it', :class => 'control-label'
.controls= f.text_area :description, :rows => 6
.form-actions
= f.submit 'Save', :class => 'btn btn-primary'
= f.submit 'Save', :class => 'btn btn-primary col-md-offset-2'