diff options
-rw-r--r-- | app/views/request/new_report_request.html.erb | 34 | ||||
-rw-r--r-- | spec/views/request/new_report_request.html.erb_spec.rb | 29 |
2 files changed, 48 insertions, 15 deletions
diff --git a/app/views/request/new_report_request.html.erb b/app/views/request/new_report_request.html.erb index 7f815344c..4ac110f80 100644 --- a/app/views/request/new_report_request.html.erb +++ b/app/views/request/new_report_request.html.erb @@ -1,22 +1,26 @@ <h1>Report request: <%= @info_request.title %></h1> -<p> - Reporting a request notifies the site administrators. They will respond as soon as possible. -</p> -<p>Why specifically do you consider this request unsuitable?</p> - -<%= form_tag report_path(:url_title => @info_request.url_title) do %> - <p> - <label class="form_label" for="reason">Reason:</label> - <%= select_tag :reason, options_for_select(["Contains defamatory material", "Not a valid request", "Request for personal information", "Contains personal information", "Vexatious", "Other"]), :prompt => "Choose a reason" %> - </p> +<% if @info_request.attention_requested %> + <p><%= _("This request has already been reported for administrator attention") %></p> +<% else %> <p> - <label class="form_label" for="message">Please tell us more:</label> - <%= text_area_tag :message, "", :rows => 10, :cols => 60 %> + Reporting a request notifies the site administrators. They will respond as soon as possible. </p> + <p>Why specifically do you consider this request unsuitable?</p> + + <%= form_tag report_path(:url_title => @info_request.url_title) do %> + <p> + <label class="form_label" for="reason">Reason:</label> + <%= select_tag :reason, options_for_select(["Contains defamatory material", "Not a valid request", "Request for personal information", "Contains personal information", "Vexatious", "Other"]), :prompt => "Choose a reason" %> + </p> + <p> + <label class="form_label" for="message">Please tell us more:</label> + <%= text_area_tag :message, "", :rows => 10, :cols => 60 %> + </p> - <div class="form_button"> - <%= submit_tag _("Report request") %> - </div> + <div class="form_button"> + <%= submit_tag _("Report request") %> + </div> + <% end %> <% end %> diff --git a/spec/views/request/new_report_request.html.erb_spec.rb b/spec/views/request/new_report_request.html.erb_spec.rb new file mode 100644 index 000000000..b1ccf36c9 --- /dev/null +++ b/spec/views/request/new_report_request.html.erb_spec.rb @@ -0,0 +1,29 @@ +require File.expand_path(File.join('..', '..', '..', 'spec_helper'), __FILE__) + +describe 'request/new_report_request.html.erb' do + let(:info_request) { mock_model(InfoRequest, :url_title => "foo") } + before :each do + assign(:info_request, info_request) + end + + it "should show a form" do + render + rendered.should have_selector("form") + end + + context "request has already been reported" do + before :each do + info_request.stub!(:attention_requested).and_return(true) + end + + it "should not show a form" do + render + rendered.should_not have_selector("form") + end + + it "should say it's already been reported" do + render + rendered.should contain("This request has already been reported") + end + end +end |