aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Landauer <matthew@openaustralia.org>2013-02-13 16:24:43 +1100
committerMatthew Landauer <matthew@openaustralia.org>2013-02-15 12:22:22 +1100
commita5e2adf08cdcea0bec25e14b83584091edfb79fb (patch)
tree5eefcb37ad57b535ef15085fd5321138030669cc
parentf54aaf27a19739b44c5ec032a4b1b2b172074a9c (diff)
Make links to within the site use relative urls
-rwxr-xr-xapp/helpers/link_to_helper.rb12
-rw-r--r--app/views/request/_after_actions.rhtml12
-rw-r--r--app/views/request/_bubble.rhtml12
-rw-r--r--app/views/request/_correspondence.rhtml4
-rw-r--r--app/views/request/_followup.rhtml8
-rw-r--r--app/views/request/_request_listing_short_via_event.rhtml2
-rw-r--r--app/views/request/_request_listing_single.rhtml2
-rw-r--r--app/views/request/_request_listing_via_event.rhtml8
-rw-r--r--app/views/request/_sidebar.rhtml2
-rw-r--r--app/views/request/_view_html_prefix.rhtml2
-rw-r--r--app/views/request/details.rhtml4
-rw-r--r--app/views/request/show.rhtml4
12 files changed, 42 insertions, 30 deletions
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb
index 6af0b9a29..48423ff45 100755
--- a/app/helpers/link_to_helper.rb
+++ b/app/helpers/link_to_helper.rb
@@ -44,14 +44,26 @@ module LinkToHelper
return request_url(incoming_message.info_request, options.merge(:anchor => "incoming-#{incoming_message.id}"))
end
+ def incoming_message_path(incoming_message)
+ incoming_message_url(incoming_message, :only_path => true)
+ end
+
def outgoing_message_url(outgoing_message, options = {})
return request_url(outgoing_message.info_request, options.merge(:anchor => "outgoing-#{outgoing_message.id}"))
end
+ def outgoing_message_path(outgoing_message)
+ outgoing_message_url(outgoing_message, :only_path => true)
+ end
+
def comment_url(comment, options = {})
return request_url(comment.info_request, options.merge(:anchor => "comment-#{comment.id}"))
end
+ def comment_path(comment)
+ comment_url(comment, :only_path => true)
+ end
+
# Respond to request
def respond_to_last_url(info_request, options = {})
last_response = info_request.get_last_response
diff --git a/app/views/request/_after_actions.rhtml b/app/views/request/_after_actions.rhtml
index 3d74cf42d..96c9d0598 100644
--- a/app/views/request/_after_actions.rhtml
+++ b/app/views/request/_after_actions.rhtml
@@ -17,7 +17,7 @@
<% end %>
<% if @info_request.all_can_view? %>
<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_path(:url_title => @info_request.url_title) %>
</li>
<% end %>
</ul>
@@ -29,18 +29,18 @@
<li>
<% if @last_response.nil? %>
- <%= link_to _("Send a followup"), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil) + "#followup" %>
+ <%= link_to _("Send a followup"), show_response_no_followup_path(: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" %>
+ <%= link_to _("Write a reply"), show_response_path(: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) %>
+ <%= link_to _("Update the status of this request"), request_path(@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" %>
+ <%= link_to _("Request an internal review"), show_response_no_followup_path(:id => @info_request.id, :incoming_message_id => nil) + "?internal_review=1#followup" %>
</li>
</ul>
</div>
@@ -50,7 +50,7 @@
<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_path(:url_title => @info_request.url_title) %>
</li>
</ul>
</div>
diff --git a/app/views/request/_bubble.rhtml b/app/views/request/_bubble.rhtml
index 747e2aa1f..94498612a 100644
--- a/app/views/request/_bubble.rhtml
+++ b/app/views/request/_bubble.rhtml
@@ -5,26 +5,26 @@
<% attachments.each do |a| %>
<p class="attachment">
<%
- attachment_url = get_attachment_url(:id => incoming_message.info_request_id,
+ attachment_path = get_attachment_path(:id => incoming_message.info_request_id,
:incoming_message_id => incoming_message.id, :part => a.url_part_number,
:file_name => a.display_filename)
- attachment_as_html_url = get_attachment_as_html_url(:id => incoming_message.info_request_id,
+ attachment_as_html_path = get_attachment_as_html_path(:id => incoming_message.info_request_id,
:incoming_message_id => incoming_message.id, :part => a.url_part_number,
:file_name => a.display_filename + '.html')
%>
<% img_filename = "icon_" + a.content_type.sub('/', '_') + "_large.png"
full_filename = File.expand_path(File.join(File.dirname(__FILE__), "../../../public/images", img_filename))
if File.exist?(full_filename) %>
- <a href="<%=attachment_url%>"><img class="attachment_image" alt="Attachment" src="/images/<%=img_filename%>"></a>
+ <a href="<%=attachment_path%>"><img class="attachment_image" alt="Attachment" src="/images/<%=img_filename%>"></a>
<% else %>
- <a href="<%=attachment_url%>"><img class="attachment_image" alt="Attachment" src="/images/icon_unknown.png"></a>
+ <a href="<%=attachment_path%>"><img class="attachment_image" alt="Attachment" src="/images/icon_unknown.png"></a>
<% end %>
<strong><%= h a.display_filename %></strong>
<br>
<%= a.display_size %>
- <%= link_to "Download", attachment_url %>
+ <%= link_to "Download", attachment_path %>
<% if a.has_body_as_html? && incoming_message.info_request.all_can_view? %>
- <%= link_to "View as HTML", attachment_as_html_url %>
+ <%= link_to "View as HTML", attachment_as_html_path %>
<% end %>
<!-- (<%= a.content_type %>) -->
<%= a.extra_note %>
diff --git a/app/views/request/_correspondence.rhtml b/app/views/request/_correspondence.rhtml
index 99c6c7d26..e15ac4d27 100644
--- a/app/views/request/_correspondence.rhtml
+++ b/app/views/request/_correspondence.rhtml
@@ -23,7 +23,7 @@ if not incoming_message.nil?
<% if !@user.nil? && @user.admin_page_links? %>
<%= link_to "Admin", admin_url("request/show_raw_email/" + incoming_message.raw_email_id.to_s) %> |
<% end %>
- <%= link_to _("Link to this"), incoming_message_url(incoming_message), :class => "link_to_this" %>
+ <%= link_to _("Link to this"), incoming_message_path(incoming_message), :class => "link_to_this" %>
</p>
</div>
<%
@@ -51,7 +51,7 @@ elsif [ 'sent', 'followup_sent' ].include?(info_request_event.event_type)
<% end %>
-->
- <%= link_to _("Link to this"), outgoing_message_url(outgoing_message), :class => "link_to_this" %>
+ <%= link_to _("Link to this"), outgoing_message_path(outgoing_message), :class => "link_to_this" %>
</p>
</div>
<% elsif [ 'resent', 'followup_resent' ].include?(info_request_event.event_type) %>
diff --git a/app/views/request/_followup.rhtml b/app/views/request/_followup.rhtml
index 045bcd9ba..bccfccca7 100644
--- a/app/views/request/_followup.rhtml
+++ b/app/views/request/_followup.rhtml
@@ -25,18 +25,18 @@
<ul>
<% @info_request.who_can_followup_to(incoming_message).each do |name, email, id| %>
<% if id.nil? && !incoming_message.nil? && incoming_message.valid_to_reply_to? %>
- <li><%= link_to(_("the main FOI contact address for {{public_body}}", :public_body => name), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil)) %></li>
+ <li><%= link_to(_("the main FOI contact address for {{public_body}}", :public_body => name), show_response_no_followup_path(:id => @info_request.id, :incoming_message_id => nil)) %></li>
<% else %>
<% if !id.nil? %>
<% if @info_request.public_body.request_email == email %>
<% if !incoming_message.nil? %>
- <li><%= link_to(_("the main FOI contact address for {{public_body}}", :public_body => name), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil)) %></li>
+ <li><%= link_to(_("the main FOI contact address for {{public_body}}", :public_body => name), show_response_no_followup_path(:id => @info_request.id, :incoming_message_id => nil)) %></li>
<% end %>
<% else %>
- <li><%= link_to name, show_response_url(:id => @info_request.id, :incoming_message_id => id)%></li>
+ <li><%= link_to name, show_response_path(:id => @info_request.id, :incoming_message_id => id)%></li>
<% end %>
<% else %>
- <li><%= link_to(_("the main FOI contact address for {{public_body}}", :public_body => name), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil)) %></li>
+ <li><%= link_to(_("the main FOI contact address for {{public_body}}", :public_body => name), show_response_no_followup_path(:id => @info_request.id, :incoming_message_id => nil)) %></li>
<% end %>
<% end %>
diff --git a/app/views/request/_request_listing_short_via_event.rhtml b/app/views/request/_request_listing_short_via_event.rhtml
index d93a91070..f837d8143 100644
--- a/app/views/request/_request_listing_short_via_event.rhtml
+++ b/app/views/request/_request_listing_short_via_event.rhtml
@@ -3,7 +3,7 @@
end %>
<div class="request_short_listing">
- <h3><%= link_to highlight_words(info_request.title, @highlight_words), request_url(info_request) %></h3>
+ <h3><%= link_to highlight_words(info_request.title, @highlight_words), request_path(info_request) %></h3>
<p>
<%= _('To {{public_body_link_absolute}}',:public_body_link_absolute => public_body_link_absolute(info_request.public_body))%>
diff --git a/app/views/request/_request_listing_single.rhtml b/app/views/request/_request_listing_single.rhtml
index e8c1a393f..506d70684 100644
--- a/app/views/request/_request_listing_single.rhtml
+++ b/app/views/request/_request_listing_single.rhtml
@@ -1,6 +1,6 @@
<div class="request_listing">
<span class="head">
- <%= link_to h(info_request.title), (@play_urls ? request_path(:url_title => info_request.url_title) : request_url(info_request)) %>
+ <%= link_to h(info_request.title), (@play_urls ? request_path(:url_title => info_request.url_title) : request_path(info_request)) %>
</span>
<span class="desc">
<%= excerpt(info_request.initial_request_text, "", 150) %>
diff --git a/app/views/request/_request_listing_via_event.rhtml b/app/views/request/_request_listing_via_event.rhtml
index 2ba9613e5..cc8bae8a9 100644
--- a/app/views/request/_request_listing_via_event.rhtml
+++ b/app/views/request/_request_listing_via_event.rhtml
@@ -6,13 +6,13 @@ end %>
<div class="request_left">
<span class="head">
<% if event.is_incoming_message? %>
- <%= link_to highlight_words(info_request.title, @highlight_words), incoming_message_url(event.incoming_message_selective_columns("incoming_messages.id")) %>
+ <%= link_to highlight_words(info_request.title, @highlight_words), incoming_message_path(event.incoming_message_selective_columns("incoming_messages.id")) %>
<% elsif event.is_outgoing_message? and event.event_type == 'followup_sent' %>
- <%= link_to highlight_words(info_request.title, @highlight_words), outgoing_message_url(event.outgoing_message) %>
+ <%= link_to highlight_words(info_request.title, @highlight_words), outgoing_message_path(event.outgoing_message) %>
<% elsif event.is_comment? %>
- <%= link_to highlight_words(info_request.title, @highlight_words), comment_url(event.comment) %>
+ <%= link_to highlight_words(info_request.title, @highlight_words), comment_path(event.comment) %>
<% else %>
- <%= link_to highlight_words(info_request.title, @highlight_words), request_url(info_request) %>
+ <%= link_to highlight_words(info_request.title, @highlight_words), request_path(info_request) %>
<% end %>
</span>
<div class="requester">
diff --git a/app/views/request/_sidebar.rhtml b/app/views/request/_sidebar.rhtml
index c0d35a0f8..fdf64ac66 100644
--- a/app/views/request/_sidebar.rhtml
+++ b/app/views/request/_sidebar.rhtml
@@ -53,7 +53,7 @@
<%= render :partial => 'request/request_listing_short_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %>
<% end %>
<% if @xapian_similar_more %>
- <p><%= link_to _("More similar requests"), request_similar_url(@info_request) %></p>
+ <p><%= link_to _("More similar requests"), request_similar_path(@info_request) %></p>
<% end %>
<!-- Important terms: <%= @xapian_similar.important_terms.join(" ") %> -->
<% end %>
diff --git a/app/views/request/_view_html_prefix.rhtml b/app/views/request/_view_html_prefix.rhtml
index b29830ac7..3a9946745 100644
--- a/app/views/request/_view_html_prefix.rhtml
+++ b/app/views/request/_view_html_prefix.rhtml
@@ -7,6 +7,6 @@
<br>(<%=h @attachment.name_of_content_type %>)
</div>
<%= _('This is an HTML version of an attachment to the Freedom of Information request')%>
- '<%=link_to h(@info_request.title), incoming_message_url(@incoming_message)%>'.
+ '<%=link_to h(@info_request.title), incoming_message_path(@incoming_message)%>'.
</div>
diff --git a/app/views/request/details.rhtml b/app/views/request/details.rhtml
index d4c63902f..3cb2f5afe 100644
--- a/app/views/request/details.rhtml
+++ b/app/views/request/details.rhtml
@@ -36,10 +36,10 @@ way authorities use it. Plus you\'ll need to be an elite statistician. Please
<% end %>
<td>
<% if info_request_event.outgoing_message %>
- <%= link_to "outgoing", outgoing_message_url(info_request_event.outgoing_message) %>
+ <%= link_to "outgoing", outgoing_message_path(info_request_event.outgoing_message) %>
<% end %>
<% if info_request_event.incoming_message %>
- <%= link_to "incoming", incoming_message_url(info_request_event.incoming_message) %>
+ <%= link_to "incoming", incoming_message_path(info_request_event.incoming_message) %>
<% end %>
</td>
</tr>
diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml
index 77a80e9f0..0dc422cd8 100644
--- a/app/views/request/show.rhtml
+++ b/app/views/request/show.rhtml
@@ -87,7 +87,7 @@
(<%= raw(_('<a href="%s">details</a>') % [help_requesting_path + '#quickly_response']) %>).
<% if !@info_request.is_external? %>
<%= _('You can <strong>complain</strong> by') %>
- <%= link_to _("requesting an internal review"), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil) + "?internal_review=1#followup" %>.
+ <%= link_to _("requesting an internal review"), show_response_no_followup_path(:id => @info_request.id, :incoming_message_id => nil) + "?internal_review=1#followup" %>.
<% end %>
<% elsif @status == 'not_held' %>
<%= public_body_link(@info_request.public_body) %> <%= _('<strong>did not have</strong> the information requested.') %>
@@ -106,7 +106,7 @@
<%= _('The request is <strong>waiting for clarification</strong>.') %>
<% if !@info_request.is_external? %>
<%= _('If you are {{user_link}}, please',:user_link=>user_link_for_request(@info_request)) %>
- <%= link_to _("sign in"), signin_url(:r => request.request_uri) %> <%= _('to send a follow up message.') %>
+ <%= link_to _("sign in"), signin_path(:r => request.request_uri) %> <%= _('to send a follow up message.') %>
<% end %>
<% end %>
<% elsif @status == 'gone_postal' %>