diff --git a/app/views/crops/_find_seeds.html.haml b/app/views/crops/_find_seeds.html.haml
index 66990ed69..0e31f6916 100644
--- a/app/views/crops/_find_seeds.html.haml
+++ b/app/views/crops/_find_seeds.html.haml
@@ -10,7 +10,8 @@
= render :partial => 'members/location', :locals => { :member => seed.owner }
%p
= link_to "View all #{crop.name} seeds", seeds_by_crop_path(crop)
-- if current_member
- = link_to "List achiote seeds to trade", new_seed_path(:crop_id => crop.id)
-- else
- = render :partial => 'shared/signin_signup', :locals => { :to => 'list your seeds to trade' }
+- if crop.approved?
+ - if current_member
+ %p= link_to "List #{crop.name} seeds to trade", new_seed_path(:crop_id => crop.id)
+ - else
+ = render :partial => 'shared/signin_signup', :locals => { :to => 'list your seeds to trade' }
diff --git a/app/views/crops/_form.html.haml b/app/views/crops/_form.html.haml
index e7be7cd62..cd42ca758 100644
--- a/app/views/crops/_form.html.haml
+++ b/app/views/crops/_form.html.haml
@@ -6,86 +6,92 @@
- @crop.errors.full_messages.each do |msg|
%li= msg
+ -# Handy link to crop wrangling policy/style guide, shown to wranglers only
- if can? :wrangle, @crop
%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.
+ -# Everyone (wranglers and requesters) sees the basic info section
+ %h2 Basic information
+
.form-group
= f.label :name, :class => 'control-label col-md-2'
.col-md-8
= f.text_field :name, :class => 'form-control'
- %span.help-block
- - if can? :wrangle, @crop
- Name in US English; singular; capitalize proper nouns only.
- - else
- Please provide the common name for the crop, in English, if you know it.
+ %span.help-block
+ The common name for the crop, in English (required).
+ - if can? :wrangle, @crop
+ Wranglers: please ensure this is singular, and capitalize
+ proper nouns only.
.form-group
= f.label :en_wikipedia_url, 'Wikipedia URL', :class => 'control-label col-md-2'
.col-md-8
= f.text_field :en_wikipedia_url, :class => 'form-control'
- %span.help-block
- - if can? :wrangle, @crop
- Link to this crop's page on the English language Wikipedia.
- - else
- Please provide a link to the crop's page on the English language Wikipedia. Crops without Wikipedia pages cannot be added to our database at this time.
-
- - if can? :wrangle, @crop
+ %span.help-block
+ Link to the crop's page on the English language Wikipedia (required).
+ -# Only crop wranglers see the crop hierarchy (for now)
+ - if can? :wrangle, @crop
.form-group
= f.label :parent_id, 'Parent crop', :class => 'control-label col-md-2'
.col-md-8
= collection_select(:crop, :parent_id, Crop.all, :id, :name, {:include_blank => true}, :class => 'form-control')
%span.help-block Optional. For setting up crop hierarchies for varieties etc.
- %p
- %span.help-block
- You may enter up to 3 scientific names for a crop. Most crops will have only one.
- = f.fields_for :scientific_names do |sn|
- .form-group
- = sn.label :scientific_name, "Scientific name", :class => 'control-label col-md-2'
- .col-md-8
- = sn.text_field :scientific_name, :class => 'form-control'
- .col-md-2
- - if sn.object && sn.object.persisted?
- %label.checkbox
- = sn.check_box :_destroy
- = sn.label :_destroy, "Delete"
- - unless @crop.new_record?
- .form-group
- = f.label :approval_status, 'Approval Status', :class=> 'control-label col-md-2'
- .col-md-8
- = f.select(:approval_status, @crop.approval_statuses, {}, {:class => 'form-control'})
+ -# Everyone (wranglers and requesters) gets to add scientific names
+ %h2 Scientific names
+ %p You may enter up to 3 scientific names for a crop. Most crops will have only one.
- .form-group
- = f.label :reason_for_rejection, 'Reason for rejection', :class => 'control-label col-md-2'
- .col-md-8
- = f.select(:reason_for_rejection, @crop.reasons_for_rejection, {:include_blank => true}, {:class => 'form-control'})
- %p
+ = f.fields_for :scientific_names do |sn|
+ .form-group
+ = sn.label :scientific_name, "Scientific name", :class => 'control-label col-md-2'
+ .col-md-8
+ = sn.text_field :scientific_name, :class => 'form-control'
+ .col-md-2
+ - if sn.object && sn.object.persisted?
+ %label.checkbox
+ = sn.check_box :_destroy
+ = sn.label :_destroy, "Delete"
+
+ -# This is used for comments from crop requesters. We need to show it
+ -# to everyone, but we don't include it on new crops from wranglers.
+
+ - if (can? :wrangle, @crop and @crop.requester) or (cannot? :wrangle, @crop and @crop.new_record?)
+ %h2 Crop request notes
+ .form-group
+ = f.label :request_notes, 'Comments', :class => 'control-label col-md-2'
+ .col-md-8
+ = f.text_area :request_notes, :rows => 3, :class => 'form-control'
+
+ -# A final explanation of what's going to happen next, for crop requesters
+ - unless can? :wrangle, @crop
+ %p When you submit this form, your suggestion will be sent to our team of #{link_to 'volunteer crop wranglers', 'http://talk.growstuff.org/c/crop-wrangling'} for review. We'll let you know the outcome as soon as we can.
+
+ -# Now, for crop wranglers, let's have approval/rejection at the bottom of the page
+ - if can? :wrangle, @crop and @crop.requester
+ %h2 Approve or reject pending crops
+ .form-group
+ = f.label :approval_status, 'Approval status', :class=> 'control-label col-md-2'
+ .col-md-8
+ = f.select(:approval_status, @crop.approval_statuses, {}, {:class => 'form-control'})
+
+ .form-group
+ = f.label :reason_for_rejection, 'Reason for rejection', :class => 'control-label col-md-2'
+ .col-md-8
+ = f.select(:reason_for_rejection, @crop.reasons_for_rejection, {:include_blank => true}, {:class => 'form-control'})
+
+ .form-group
+ = f.label :rejection_notes, 'Rejection notes', :class => 'control-label col-md-2'
+ .col-md-8
+ = f.text_area :rejection_notes, :rows => 3, :class => 'form-control'
%span.help-block
Please provide additional notes why this crop request was rejected if the above reasons do not apply.
- .form-group
- = f.label :rejection_notes, 'Rejection Notes', :class => 'control-label col-md-2'
- .col-md-8= f.text_area :rejection_notes, :rows => 6, :class => 'form-control'
-
- - else
- %p
- %span.help-block
- Provide any additional information that might help us assess your request.
-
- .form-group
- = f.label :request_notes, 'Comments', :class => 'control-label col-md-2'
- .col-md-8= f.text_area :request_notes, :rows => 6, :class => 'form-control'
-
- %p
- %span.help-block
- When you submit this form, your suggestion will be sent to our team of #{link_to 'volunteer crop wranglers', 'http://talk.growstuff.org/c/crop-wrangling'} for review. We'll let you know the outcome as soon as we can.
.form-group
.form-actions.col-md-offset-2.col-md-8
diff --git a/app/views/crops/_harvests.html.haml b/app/views/crops/_harvests.html.haml
index 003e72bfa..8962a6d81 100644
--- a/app/views/crops/_harvests.html.haml
+++ b/app/views/crops/_harvests.html.haml
@@ -13,9 +13,9 @@
ago.
%p
= link_to "View all #{crop.name} harvests", harvests_by_crop_path(crop)
-- if current_member
- %p
- = link_to "Harvest #{crop.name}", new_harvest_path(:crop_id => crop.id)
-- else
- = render :partial => 'shared/signin_signup', :locals => { :to => "track your #{crop.name} harvests" }
+- if crop.approved?
+ - if current_member
+ %p= link_to "Harvest #{crop.name}", new_harvest_path(:crop_id => crop.id)
+ - else
+ = render :partial => 'shared/signin_signup', :locals => { :to => "track your #{crop.name} harvests" }
diff --git a/app/views/crops/_plantings.html.haml b/app/views/crops/_plantings.html.haml
index 621a6d125..026f6f7fb 100644
--- a/app/views/crops/_plantings.html.haml
+++ b/app/views/crops/_plantings.html.haml
@@ -13,9 +13,9 @@
ago.
%p
= link_to "View all #{crop.name} plantings", plantings_by_crop_path(crop)
-- if current_member
- %p
- = link_to "Plant #{crop.name}", new_planting_path(:crop_id => crop.id)
-- else
- = render :partial => 'shared/signin_signup', :locals => { :to => "track your #{crop.name} plantings" }
+- if crop.approved?
+ - if current_member
+ %p= link_to "Plant #{crop.name}", new_planting_path(:crop_id => crop.id)
+ - else
+ = render :partial => 'shared/signin_signup', :locals => { :to => "track your #{crop.name} plantings" }
diff --git a/app/views/crops/edit.html.haml b/app/views/crops/edit.html.haml
index dca7fb221..da8863252 100644
--- a/app/views/crops/edit.html.haml
+++ b/app/views/crops/edit.html.haml
@@ -1,10 +1,19 @@
-- content_for :title, "Review crop: #{@crop.name}"
+- content_for :title, "Edit crop: #{@crop.name}"
-%p
- Added by
- = @crop.creator
- = distance_of_time_in_words(@crop.created_at, Time.zone.now)
- ago.
+- if @crop.approval_status == "approved"
+ - if @crop.requester
+ %p Requested by #{link_to @crop.requester, @crop.requester} #{distance_of_time_in_words(@crop.created_at, Time.zone.now)} ago.
+ %p Approved by #{link_to @crop.creator, @crop.creator}.
+ - else
+ %p Added by #{link_to @crop.creator, @crop.creator} #{distance_of_time_in_words(@crop.created_at, Time.zone.now)} ago.
+- elsif @crop.approval_status == "pending"
+ .alert.alert-danger
+ %p Requested by #{link_to @crop.requester, @crop.requester} #{distance_of_time_in_words(@crop.created_at, Time.zone.now)} ago.
+ %p Status: #{@crop.approval_status}.
+- elsif @crop.approval_status == "rejected"
+ .alert.alert-danger
+ %p Requested by #{link_to @crop.requester, @crop.requester} #{distance_of_time_in_words(@crop.created_at, Time.zone.now)} ago.
+ %p Status: #{@crop.approval_status} by #{link_to @crop.creator, @crop.creator}.
= render 'form'
diff --git a/spec/features/crops/request_new_crop_spec.rb b/spec/features/crops/request_new_crop_spec.rb
index 0a1cac2a7..afe03a0a1 100644
--- a/spec/features/crops/request_new_crop_spec.rb
+++ b/spec/features/crops/request_new_crop_spec.rb
@@ -29,7 +29,7 @@ feature "Requesting a new crop" do
scenario "Approve a request" do
visit edit_crop_path(crop)
- select "approved", from: "Approval Status"
+ select "approved", from: "Approval status"
click_button "Save"
expect(page).to have_content "En wikipedia url is not a valid English Wikipedia URL"
fill_in "Wikipedia URL", with: "http://en.wikipedia.org/wiki/Aung_San_Suu_Kyi"
@@ -39,7 +39,7 @@ feature "Requesting a new crop" do
scenario "Rejecting a crop" do
visit edit_crop_path(crop)
- select "rejected", from: "Approval Status"
+ select "rejected", from: "Approval status"
select "not edible", from: "Reason for rejection"
click_button "Save"
expect(page).to have_content "Crop was successfully updated."
@@ -47,4 +47,4 @@ feature "Requesting a new crop" do
end
-end
\ No newline at end of file
+end