diff options
-rw-r--r-- | app/views/request/_after_actions.rhtml | 57 | ||||
-rw-r--r-- | app/views/request/upload_response.rhtml | 6 | ||||
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 12 |
3 files changed, 44 insertions, 31 deletions
diff --git a/app/views/request/_after_actions.rhtml b/app/views/request/_after_actions.rhtml index 02ed7c849..15ca6302e 100644 --- a/app/views/request/_after_actions.rhtml +++ b/app/views/request/_after_actions.rhtml @@ -1,51 +1,52 @@ <div id="after_actions"> - + <h2><%= _('Things to do with this request') %></h2> <div id="anyone_actions"> <strong><%= _('Anyone:') %></strong> <ul> <li> - <%= _('<a href="%s">Add an annotation</a> (to help the requester or others)') % [new_comment_url(:url_title => @info_request.url_title)] %> + <%= _('<a href="%s">Add an annotation</a> (to help the requester or others)') % [new_comment_url(:url_title => @info_request.url_title)] %> </li> - <% if @old_unclassified %> + <% if @old_unclassified %> <li> <%= link_to _('Update the status of this request'), '#describe_state_form_1' %> </li> <% end %> <li> - <%= link_to _("Download a zip file of all correspondence"), download_entire_request_url(:url_title => @info_request.url_title) %> + <%= link_to _("Download a zip file of all correspondence"), download_entire_request_url(:url_title => @info_request.url_title) %> </li> </ul> </div> + <% if ! @info_request.is_external? %> + <div id="owner_actions"> + <strong><%= _('{{info_request_user_name}} only:',:info_request_user_name=>h(@info_request.user_name)) %></strong> + <ul> + + <li> + <% if @last_response.nil? %> + <%= link_to _("Send a followup"), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil) + "#followup" %> + <% else %> + <%= link_to _("Write a reply"), show_response_url(:id => @info_request.id, :incoming_message_id => @last_response.id) + "#followup" %> + <% end %> + </li> + <% if !@old_unclassified %> + <li> + <%= link_to _("Update the status of this request"), request_url(@info_request, :update_status => 1) %> + </li> + <% end %> + <li> + <%= link_to _("Request an internal review"), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil) + "?internal_review=1#followup" %> + </li> + </ul> + </div> + <% end %> - <div id="owner_actions"> - <strong><%= _('{{info_request_user_name}} only:',:info_request_user_name=>h(@info_request.user_name)) %></strong> - <ul> - - <li> - <% if @last_response.nil? %> - <%= link_to _("Send a followup"), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil) + "#followup" %> - <% else %> - <%= link_to _("Write a reply"), show_response_url(:id => @info_request.id, :incoming_message_id => @last_response.id) + "#followup" %> - <% end %> - </li> - <% if !@old_unclassified %> - <li> - <%= link_to _("Update the status of this request"), request_url(@info_request, :update_status => 1) %> - </li> - <% end %> - <li> - <%= link_to _("Request an internal review"), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil) + "?internal_review=1#followup" %> - </li> - </ul> - </div> - <div id="public_body_actions"> - <strong><%= _('{{public_body_name}} only:',:public_body_name=>h(@info_request.public_body.name) ) %> </strong> + <strong><%= _('{{public_body_name}} only:',:public_body_name=>h(@info_request.public_body.name) ) %> </strong> <ul> <li> - <%= link_to _("Respond to request"), upload_response_url(:url_title => @info_request.url_title) %> + <%= link_to _("Respond to request"), upload_response_url(:url_title => @info_request.url_title) %> </li> </ul> </div> diff --git a/app/views/request/upload_response.rhtml b/app/views/request/upload_response.rhtml index 0de96c5f3..697ff99aa 100644 --- a/app/views/request/upload_response.rhtml +++ b/app/views/request/upload_response.rhtml @@ -27,17 +27,17 @@ <h2><%= _('Respond using the web')%></h2> - <p><%= _('Enter your response below. You may attach one file (use email, or + <p><%= _('Enter your response below. You may attach one file (use email, or <a href="%s">contact us</a> if you need more).')% [help_contact_path] %></p> <% form_tag '', :id => 'upload_response_form', :multipart => true do %> <p> - <label class="form_label" for="body"><% _('Response:')%></label> + <label class="form_label" for="body"><% _('Response:')%></label> <%= text_area_tag :body, "", :rows => 10, :cols => 55 %> </p> <p> - <label class="form_label" for="file_1"><% _('Attachment (optional):')%></label> + <label class="form_label" for="file_1"><% _('Attachment (optional):')%></label> <%= file_field_tag :file_1, :size => 35 %> </p> diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 6cbe1c836..3ffc81b4c 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -233,6 +233,11 @@ describe RequestController, "when showing one request" do response.should redirect_to(:action => 'show', :url_title => info_requests(:naughty_chicken_request).url_title) end + it 'should show actions the request owner can take' do + get :show, :url_title => 'why_do_you_have_such_a_fancy_dog' + response.should have_tag('div', :id => 'owner_actions') + end + describe 'when showing an external request' do it 'should be successful with no logged in user' do @@ -244,8 +249,15 @@ describe RequestController, "when showing one request" do get :show, { :url_title => 'balalas' }, { :user_id => users(:admin_user).id } response.should be_success end + + it 'should not display actions the request owner can take' do + get :show, :url_title => 'balalas' + response.should_not have_tag('div', :id => 'owner_actions') + end + end + describe 'when handling an update_status parameter' do it 'should assign the "update status" flag to the view as true if the parameter is present' do get :show, :url_title => 'why_do_you_have_such_a_fancy_dog', :update_status => 1 |