mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-03-27 19:23:59 -04:00
Made the form prettier using Bootstrap's horizontal form css
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
= form_for @planting do |f|
|
||||
= form_for(@planting, :html => {:class => "form-horizontal"}) do |f|
|
||||
- if @planting.errors.any?
|
||||
#error_explanation
|
||||
%h2= "#{pluralize(@planting.errors.count, "error")} prohibited this planting from being saved:"
|
||||
@@ -6,20 +6,24 @@
|
||||
- @planting.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
|
||||
.field
|
||||
= f.label :garden_id
|
||||
= collection_select(:planting, :garden_id, Garden.where(:user_id => current_user), :id, :name)
|
||||
.field
|
||||
= f.label :crop_id
|
||||
= collection_select(:planting, :crop_id, Crop.all(:order => :system_name), :id, :system_name)
|
||||
.field
|
||||
= f.label :planted_at
|
||||
= f.datetime_select :planted_at
|
||||
.field
|
||||
= f.label :quantity
|
||||
= f.number_field :quantity
|
||||
.field
|
||||
= f.label :description
|
||||
= f.text_area :description
|
||||
.actions
|
||||
= f.submit 'Save'
|
||||
.control-group
|
||||
= f.label :garden_id, :class => 'control-label'
|
||||
.controls= collection_select(:planting, :garden_id, Garden.where(:user_id => current_user), :id, :name)
|
||||
.control-group
|
||||
= f.label :crop_id, :class => 'control-label'
|
||||
.controls= collection_select(:planting, :crop_id, Crop.all(:order => :system_name), :id, :system_name)
|
||||
.control-group
|
||||
= f.label :planted_at, :class => 'control-label'
|
||||
.controls= f.datetime_select :planted_at, options = { :include_blank => true }, html_options = { :class => "span1" }
|
||||
.control-group
|
||||
= f.label :quantity, :class => 'control-label'
|
||||
.controls
|
||||
= f.number_field :quantity, :class => 'input-small'
|
||||
%span.help-block
|
||||
The number of plants.
|
||||
.control-group
|
||||
= f.label :description, :class => 'control-label'
|
||||
.controls= f.text_area :description, :rows => 6
|
||||
|
||||
.form-actions
|
||||
= f.submit 'Save'
|
||||
|
||||
@@ -15,8 +15,8 @@ describe "plantings/edit" do
|
||||
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
assert_select "form", :action => plantings_path(@planting), :method => "post" do
|
||||
assert_select "input#planting_garden_id", :name => "planting[garden_id]"
|
||||
assert_select "input#planting_crop_id", :name => "planting[crop_id]"
|
||||
assert_select "select#planting_garden_id", :name => "planting[garden_id]"
|
||||
assert_select "select#planting_crop_id", :name => "planting[crop_id]"
|
||||
assert_select "input#planting_quantity", :name => "planting[quantity]"
|
||||
assert_select "textarea#planting_description", :name => "planting[description]"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user