mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-23 07:18:22 -04:00
Merge pull request #726 from maco/approved_crops
Crop accept/reject notification improvements
This commit is contained in:
commit
d7ef598654
6 files changed
+29
-7
No files matched your search
@@ -299,6 +299,14 @@ class Crop < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def rejection_explanation
|
||||
if reason_for_rejection == "other"
|
||||
return rejection_notes
|
||||
else
|
||||
return reason_for_rejection
|
||||
end
|
||||
end
|
||||
|
||||
# Crop.search(string)
|
||||
def self.search(query)
|
||||
if ENV['GROWSTUFF_ELASTICSEARCH'] == "true"
|
||||
|
||||
@@ -8,4 +8,4 @@
|
||||
|
||||
- if crop.rejected?
|
||||
.alert.alert-danger
|
||||
%b This crop was rejected for the following reason: #{crop.reason_for_rejection == "other" ? crop.rejection_notes : crop.reason_for_rejection}.
|
||||
%b This crop was rejected for the following reason: #{crop.rejection_explanation}
|
||||
@@ -2,7 +2,7 @@
|
||||
%p Hello #{@member.login_name},
|
||||
|
||||
%p
|
||||
Your request for the new crop: #{link_to @crop.name, crop_url(@crop)} has been approved!
|
||||
Your request for the new crop: #{link_to @crop.name, crop_url(@crop)} has been approved! Thank you for helping us make our listing ever more complete!
|
||||
|
||||
%ul
|
||||
%li
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
%p Hello #{@member.login_name},
|
||||
|
||||
%p
|
||||
Your request for the new crop: #{link_to @crop.name, crop_url(@crop)} has been rejected for the following reason.
|
||||
We're sorry, but your request for the new crop: #{link_to @crop.name, crop_url(@crop)} has been rejected for the following reason: #{@crop.rejection_explanation}
|
||||
|
||||
= @crop.reason_for_rejection
|
||||
|
||||
= render :partial => 'signature'
|
||||
= render :partial => 'signature'
|
||||
@@ -8,6 +8,7 @@
|
||||
%ul
|
||||
%li Name: #{@request.name}
|
||||
%li Wikipedia URL: #{@request.en_wikipedia_url.present? ? @request.en_wikipedia_url : "not specified"}
|
||||
%li Notes: #{@request.request_notes}
|
||||
|
||||
%p
|
||||
As a crop wrangler, you can #{link_to "approve or reject this request", edit_crop_url(@request)}.
|
||||
@@ -18,4 +19,4 @@
|
||||
%p
|
||||
Thanks for your help!
|
||||
|
||||
= render :partial => 'signature'
|
||||
= render :partial => 'signature'
|
||||
@@ -554,4 +554,19 @@ describe Crop do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "crop rejections" do
|
||||
let!(:rejected_reason) { FactoryGirl.create(:crop, :name => 'tomato', :approval_status => 'rejected', :reason_for_rejection => 'not edible') }
|
||||
let!(:rejected_other) { FactoryGirl.create(:crop, :name => 'tomato', :approval_status => 'rejected', :reason_for_rejection => 'other', :rejection_notes => 'blah blah blah') }
|
||||
|
||||
describe "rejecting a crop" do
|
||||
it "should give reason if a default option" do
|
||||
expect(rejected_reason.rejection_explanation).to eq "not edible"
|
||||
end
|
||||
|
||||
it "should show rejection notes if reason was other" do
|
||||
expect(rejected_other.rejection_explanation).to eq "blah blah blah"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user