b3ified some of the forms

This commit is contained in:
Skud
2014-08-11 13:02:08 +10:00
parent bb0f88bc0b
commit a684efcf2a
6 changed files with 77 additions and 66 deletions

View File

@@ -1,4 +1,4 @@
= form_for @comment do |f|
= form_for(@comment, :html => {:class => "form-horizontal", :role => "form"}) do |f|
- if @comment.errors.any?
#error_explanation
%h2= "#{pluralize(@comment.errors.count, "error")} prohibited this comment from being saved:"
@@ -6,7 +6,8 @@
- @comment.errors.full_messages.each do |msg|
%li= msg
.field
.form-group
= f.label :body, "Your comment:"
= f.text_area :body, :rows => 6, :class => 'form-control'
%span.help-block
= render :partial => "shared/markdown_help"

View File

@@ -4,6 +4,4 @@
= render :partial => "posts/comments", :locals => {:post => @post || @comment.post}
%p Your comment:
= render 'form'

View File

@@ -1,4 +1,4 @@
= form_for(@harvest, :html => {:class => "form-horizontal"}) do |f|
= form_for(@harvest, :html => {:class => "form-horizontal", :role => :form}) do |f|
- if @harvest.errors.any?
#error_explanation
%h2= "#{pluralize(@harvest.errors.count, "error")} prohibited this harvest from being saved:"
@@ -7,37 +7,42 @@
%li= msg
.form-group
= f.label 'What did you harvest?', :class => 'control-label'
.controls
= collection_select(:harvest, :crop_id, Crop.all, :id, :name, :selected => @harvest.crop_id || @crop.id)
= collection_select(:harvest, :plant_part_id, PlantPart.all, :id, :name, :selected => @harvest.plant_part_id)
%span.help-block
Can't find what you're looking for?
= link_to "Request new crops.", Growstuff::Application.config.new_crops_request_link
= f.label 'What did you harvest?', :class => 'control-label col-md-2'
.col-md-4
= collection_select(:harvest, :crop_id, Crop.all, :id, :name, { :selected => @harvest.crop_id || @crop.id }, { :class => 'form-control' })
.col-md-4
= collection_select(:harvest, :plant_part_id, PlantPart.all, :id, :name, { :selected => @harvest.plant_part_id }, { :class => 'form-control' })
%span.help-block.col-md-8
Can't find what you're looking for?
= link_to "Request new crops.", Growstuff::Application.config.new_crops_request_link
.form-group
= f.label 'When?', :class => 'control-label'
.controls= f.text_field :harvested_at, :value => @harvest.harvested_at ? @harvest.harvested_at.to_s(:ymd) : '', :class => 'add-datepicker'
= f.label 'When?', :class => 'control-label col-md-2'
.col-md-2
= f.text_field :harvested_at, :value => @harvest.harvested_at ? @harvest.harvested_at.to_s(:ymd) : '', :class => 'add-datepicker form-control'
.form-group
= f.label 'How many?', :class => 'control-label'
.controls
= f.label 'How many?', :class => 'control-label col-md-2'
.col-md-2
-# Some browsers (eg Firefox for Android) assume "number" means
-# "integer" unless you specify step="any":
-# http://blog.isotoma.com/2012/03/html5-input-typenumber-and-decimalsfloats-in-chrome/
= f.number_field :quantity, :class => 'input-small', :step => 'any'
= f.select(:unit, Harvest::UNITS_VALUES, {:include_blank => false}, :class => 'input-medium')
= f.number_field :quantity, :class => 'input-small', :step => 'any', :class => 'form-control'
.col-md-2
= f.select(:unit, Harvest::UNITS_VALUES, {:include_blank => false}, :class => 'input-medium form-control')
.form-group
= f.label 'Weighing:', :class => 'control-label'
.controls
= f.number_field :weight_quantity, :class => 'input-small', :step => 'any'
= f.select(:weight_unit, Harvest::WEIGHT_UNITS_VALUES, {:include_blank => false}, :class => 'input-medium')
in total
= f.label 'Weighing (in total):', :class => 'control-label col-md-2'
.col-md-2
= f.number_field :weight_quantity, :class => 'input-small', :step => 'any', :class => 'form-control'
.col-md-2
= f.select(:weight_unit, Harvest::WEIGHT_UNITS_VALUES, {:include_blank => false}, :class => 'form-control')
.form-group
= f.label 'Notes', :class => 'control-label'
.controls= f.text_area :description, :rows => 6
= f.label 'Notes', :class => 'control-label col-md-2'
.col-md-8
= f.text_area :description, :rows => 6, :class => 'form-control'
.form-actions
.form-group
.form-actions.col-md-offset-2.col-md-8
= f.submit 'Save', :class => 'btn btn-primary'

View File

@@ -8,35 +8,35 @@
.form-group
= f.label 'What did you plant?', :class => 'control-label col-md-2'
.col-md-4
.col-md-8
= 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 col-md-2'
.col-md-4
.col-md-8
= 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 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'
.col-md-2= 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 col-md-2'
.col-md-2
= f.number_field :quantity, :class => 'form-control'
.form-group
= f.label 'Planted from:', :class => 'control-label col-md-2'
.col-md-4
.col-md-8
= f.select(:planted_from, Planting::PLANTED_FROM_VALUES, {:include_blank => true}, :class => 'form-control')
.form-group
= f.label 'Sun or shade?', :class => 'control-label col-md-2'
.col-md-4
.col-md-8
= 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'
.col-md-8= f.text_area :description, :rows => 6, :class => 'form-control'
.form-group
.form-actions
= f.submit 'Save', :class => 'btn btn-primary col-md-offset-2'
.form-actions.col-md-offset-2.col-md-8
= f.submit 'Save', :class => 'btn btn-primary'

View File

@@ -1,4 +1,4 @@
= form_for @post do |f|
= form_for(@post, :html => {:role => "form"}) do |f|
- if @post.errors.any?
#error_explanation
%h2= "#{pluralize(@post.errors.count, "error")} prohibited this post from being saved:"
@@ -6,16 +6,18 @@
- @post.errors.full_messages.each do |msg|
%li= msg
.form-group
= label_tag :post, "Subject", :class => 'control-label'
= f.text_field :subject, :class => 'form-control'
= label_tag :post, "Subject"
= f.text_field :subject, :class => 'form-control'
- if @post.forum || @forum
= label_tag :body, "What's up?"
- else
= label_tag :body, "What's going on in your food garden?"
= f.text_area :body, :rows => 12, :class => 'form-control'
%span.help-block
= render :partial => "shared/markdown_help"
.form-group
- if @post.forum || @forum
= label_tag :body, "What's up?", :class => 'control-label'
- else
= label_tag :body, "What's going on in your food garden?"
= f.text_area :body, :rows => 12, :class => 'form-control'
%span.help-block
= render :partial => "shared/markdown_help"
- if @post.forum || @forum
- forum = @post.forum || @forum

View File

@@ -1,4 +1,4 @@
= form_for(@seed, :html => {:class => "form-horizontal"}) do |f|
= form_for(@seed, :html => {:class => "form-horizontal", :role => "form"}) do |f|
- if @seed.errors.any?
#error_explanation
%h2= "#{pluralize(@seed.errors.count, "error")} prohibited this seed from being saved:"
@@ -7,23 +7,33 @@
%li= msg
.form-group
= f.label 'Crop:', :class => 'control-label'
.controls= collection_select(:seed, :crop_id, Crop.all, :id, :name, :selected => @seed.crop_id || @crop.id)
= f.label 'Crop:', :class => 'control-label col-md-2'
.col-md-8
= collection_select(:seed, :crop_id, Crop.all, :id, :name, { :selected => @seed.crop_id || @crop.id }, { :class => 'form-control' })
.form-group
= f.label 'Quantity:', :class => 'control-label'
.controls
= f.number_field :quantity, :class => 'input-small'
= f.label 'Quantity:', :class => 'control-label col-md-2'
.col-md-2
= f.number_field :quantity, :class => 'form-control'
.form-group
= f.label 'Plant before:', :class => 'control-label'
.controls= f.text_field :plant_before, :value => @seed.plant_before ? @seed.plant_before.to_s(:ymd) : '', :class => 'add-datepicker'
= f.label 'Plant before:', :class => 'control-label col-md-2'
.col-md-2
= f.text_field :plant_before, :class => 'add-datepicker form-control', :value => @seed.plant_before ? @seed.plant_before.to_s(:ymd) : ''
.form-group
= f.label 'Description:', :class => 'control-label'
.controls= f.text_area :description, :rows => 6
= f.label 'Description:', :class => 'control-label col-md-2'
.col-md-8
= f.text_area :description, :rows => 6, :class => 'form-control'
.form-group
= f.label 'Will trade:', :class => 'control-label'
.controls
= f.select(:tradable_to,
options_for_select(Seed::TRADABLE_TO_VALUES, :selected => @seed.tradable_to || 'nowhere'))
.col-md-offset-2.col-md-8
%span.help-block
Are you interested in trading or swapping seeds with other
#{ENV['GROWSTUFF_SITE_NAME']} members? If you
list your seeds as available for trade, other members can
contact you to request seeds. You can list any conditions or
other information in the description, above.
.form-group
= f.label 'Will trade:', :class => 'control-label col-md-2'
.col-md-8
= f.select(:tradable_to, Seed::TRADABLE_TO_VALUES, {}, :class => 'form-control')
%span.help_inline
- if current_member.location.blank?
Don't forget to
@@ -34,11 +44,6 @@
=succeed "." do
= link_to current_member.location, place_path(current_member.location)
=link_to "Change your location.", edit_member_registration_path
%span.help-block
Are you interested in trading or swapping seeds with other
#{ENV['GROWSTUFF_SITE_NAME']} members? If you
list your seeds as available for trade, other members can
contact you to request seeds. You can list any conditions or
other information in the description, above.
.form-actions
= f.submit 'Save', :class => 'btn btn-primary'
.form-group
.form-actions.col-md-offset-2.col-md-8
= f.submit 'Save', :class => 'btn btn-primary'