diff options
-rwxr-xr-x | app/helpers/link_to_helper.rb | 11 | ||||
-rw-r--r-- | app/views/request/show.rhtml | 2 | ||||
-rw-r--r-- | spec/views/request/show.rhtml_spec.rb | 4 |
3 files changed, 10 insertions, 7 deletions
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index 1463096e8..5c9f51baa 100755 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -53,14 +53,17 @@ module LinkToHelper end # Respond to request - def respond_to_last_url(info_request) + def respond_to_last_url(info_request, options = {}) last_response = info_request.get_last_response if last_response.nil? - respond_url = show_response_no_followup_url(:id => info_request.id) + show_response_no_followup_url(options.merge(:id => info_request.id)) else - respond_url = show_response_url(:id => info_request.id, :incoming_message_id => last_response.id) + show_response_url(options.merge(:id => info_request.id, :incoming_message_id => last_response.id)) end - return respond_url + end + + def respond_to_last_path(info_request) + respond_to_last_url(info_request, :only_path => true) end # Public bodies diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml index 0cae3a9aa..77a80e9f0 100644 --- a/app/views/request/show.rhtml +++ b/app/views/request/show.rhtml @@ -101,7 +101,7 @@ <% if @is_owning_user && !@info_request.is_external? %> <%=h @info_request.public_body.name %> <%= _('is <strong>waiting for your clarification</strong>.') %> <%= _('Please') %> - <%= link_to _("send a follow up message"), respond_to_last_url(@info_request) + '#followup' %>. + <%= link_to _("send a follow up message"), respond_to_last_path(@info_request) + '#followup' %>. <% else %> <%= _('The request is <strong>waiting for clarification</strong>.') %> <% if !@info_request.is_external? %> diff --git a/spec/views/request/show.rhtml_spec.rb b/spec/views/request/show.rhtml_spec.rb index 4429e9e58..a22f29951 100644 --- a/spec/views/request/show.rhtml_spec.rb +++ b/spec/views/request/show.rhtml_spec.rb @@ -98,7 +98,7 @@ describe 'when viewing an information request' do it 'should show a link to follow up the last response with clarification' do request_page - expected_url = "http://test.host/request/#{@mock_request.id}/response/#{@mock_response.id}#followup" + expected_url = "/request/#{@mock_request.id}/response/#{@mock_response.id}#followup" response.should have_tag("a[href=#{expected_url}]", :text => 'send a follow up message') end @@ -118,7 +118,7 @@ describe 'when viewing an information request' do it 'should show a link to follow up the request without reference to a specific response' do request_page - expected_url = "http://test.host/request/#{@mock_request.id}/response#followup" + expected_url = "/request/#{@mock_request.id}/response#followup" response.should have_tag("a[href=#{expected_url}]", :text => 'send a follow up message') end end |