From 4d372ab8f8588eface93c5b79a481896f4d552fc Mon Sep 17 00:00:00 2001 From: Lilly Date: Thu, 2 May 2013 12:13:28 +1000 Subject: [PATCH] Added crop wrangling hints to crops form. --- app/views/crops/_form.html.haml | 28 +++++++++++++++++--------- spec/views/crops/new.html.haml_spec.rb | 5 ++++- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/app/views/crops/_form.html.haml b/app/views/crops/_form.html.haml index 12c917702..a225c1a92 100644 --- a/app/views/crops/_form.html.haml +++ b/app/views/crops/_form.html.haml @@ -1,4 +1,4 @@ -= form_for @crop do |f| += form_for @crop, :html => {:class => 'form-horizontal'} do |f| - if @crop.errors.any? #error_explanation %h3= "#{pluralize(@crop.errors.count, "error")} prohibited this crop from being saved:" @@ -6,11 +6,21 @@ - @crop.errors.full_messages.each do |msg| %li= msg - .field - = f.label :system_name - = f.text_field :system_name - .field - = f.label :en_wikipedia_url - = f.text_field :en_wikipedia_url - .actions - = f.submit 'Save' + %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. + + .control-group + = f.label :system_name, :class => 'control-label' + .controls + = f.text_field :system_name + %span.help-inline Name in US English; singular; capitalize proper nouns only. + .control-group + = f.label :en_wikipedia_url, 'Wikipedia URL', :class => 'control-label' + .controls + = f.text_field :en_wikipedia_url + %span.help-inline Link to this crop's page on the English language Wikipedia. + .form-actions + = f.submit 'Save', :class => 'btn btn-primary' diff --git a/spec/views/crops/new.html.haml_spec.rb b/spec/views/crops/new.html.haml_spec.rb index 548e0acd3..4016a27a3 100644 --- a/spec/views/crops/new.html.haml_spec.rb +++ b/spec/views/crops/new.html.haml_spec.rb @@ -10,7 +10,6 @@ describe "crops/new" do end it "renders new crop form" do - render # Run the generator again with the --webrat flag if you want to use webrat matchers assert_select "form", :action => crops_path, :method => "post" do assert_select "input#crop_system_name", :name => "crop[system_name]" @@ -18,4 +17,8 @@ describe "crops/new" do end end + it "shows a link to crop wrangling guidelines" do + assert_select "a[href^=http://wiki.growstuff.org]", "crop wrangling guide" + end + end