diff options
author | Matthew Landauer <matthew@openaustralia.org> | 2013-02-13 17:45:59 +1100 |
---|---|---|
committer | Matthew Landauer <matthew@openaustralia.org> | 2013-02-15 12:22:23 +1100 |
commit | 8e8f8bb435ad66deaf9d7a9eb1ec221fde3540d2 (patch) | |
tree | 9d0ef4de6705f37eaa19d30d33269a972aa9843b | |
parent | 448dce2ce597937bb7af006065076c85d11d95ff (diff) |
Make links to within the site use relative urls
-rwxr-xr-x | app/helpers/link_to_helper.rb | 5 | ||||
-rw-r--r-- | app/views/comment/_single_comment.rhtml | 4 | ||||
-rw-r--r-- | app/views/general/_frontpage_requests_list.rhtml | 2 | ||||
-rw-r--r-- | app/views/general/search.rhtml | 8 | ||||
-rw-r--r-- | app/views/help/api.rhtml | 4 | ||||
-rw-r--r-- | app/views/help/contact.rhtml | 2 | ||||
-rw-r--r-- | app/views/help/unhappy.rhtml | 2 | ||||
-rw-r--r-- | app/views/user/_show_user_info.rhtml | 8 | ||||
-rw-r--r-- | app/views/user/_signin.rhtml | 2 | ||||
-rw-r--r-- | app/views/user/show.rhtml | 4 |
10 files changed, 23 insertions, 18 deletions
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index 6682af0c4..07727a06a 100755 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -236,6 +236,11 @@ module LinkToHelper return url end + + def search_path(query, options = {}) + search_url(query, options.merge(:only_path => true)) + end + def search_link(query, variety_postfix = nil, sort_postfix = nil, advanced = nil) link_to h(query), search_url(query) end diff --git a/app/views/comment/_single_comment.rhtml b/app/views/comment/_single_comment.rhtml index b645721cf..d428aef14 100644 --- a/app/views/comment/_single_comment.rhtml +++ b/app/views/comment/_single_comment.rhtml @@ -17,11 +17,11 @@ </div> <p class="event_actions"> <% if !comment.id.nil? %> - <%= link_to "Link to this", comment_url(comment), :class => "link_to_this" %> + <%= link_to "Link to this", comment_path(comment), :class => "link_to_this" %> <% if !@user.nil? && @user.admin_page_links? %> | <%= link_to "Admin", admin_url("request/edit_comment/" + comment.id.to_s) %> <% end %> - <!-- | <%= link_to _('Report abuse'), comment_url(comment) %> --> + <!-- | <%= link_to _('Report abuse'), comment_path(comment) %> --> <% end %> </p> </div> diff --git a/app/views/general/_frontpage_requests_list.rhtml b/app/views/general/_frontpage_requests_list.rhtml index 72e768ef9..63d91d85a 100644 --- a/app/views/general/_frontpage_requests_list.rhtml +++ b/app/views/general/_frontpage_requests_list.rhtml @@ -19,7 +19,7 @@ :public_body_link => public_body_link(event.info_request.public_body)) %> <% end %> - <%=link_to h(event.info_request.title), request_url(event.info_request)%> + <%=link_to h(event.info_request.title), request_path(event.info_request)%> <%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(event.described_at)) %> <p class="excerpt" onclick="document.location.href='<%=request_url(event.info_request)%>'"><%= excerpt(event.search_text_main(true), "", 200) %></p> </li> diff --git a/app/views/general/search.rhtml b/app/views/general/search.rhtml index aabc7549a..39f4b457d 100644 --- a/app/views/general/search.rhtml +++ b/app/views/general/search.rhtml @@ -43,7 +43,7 @@ <%= hidden_field_tag 'bodies', 1 %> <% end %> <%= submit_tag _("Search") %> - <%= link_to(_("Advanced search"), advanced_search_url) %> + <%= link_to(_("Advanced search"), advanced_search_path) %> </p> <div id="common-subfilters"> @@ -56,7 +56,7 @@ ["all", _("everything")]]%> <% for variety, label in labels %> <% if @variety_postfix != variety %> - <%= link_to label, search_url([params[:query], variety, @sort_postfix]) %> + <%= link_to label, search_path([params[:query], variety, @sort_postfix]) %> <% else %> <%= label %> <% end %> @@ -122,9 +122,9 @@ <% if !@query.nil? %> <p id="search_controls"> - <%=link_to_unless @sortby == 'relevant', _("Show most relevant results first"), search_url([params[:query], @variety_postfix, 'relevant'], params) %> + <%=link_to_unless @sortby == 'relevant', _("Show most relevant results first"), search_path([params[:query], @variety_postfix, 'relevant'], params) %> | - <%=link_to_unless @sortby == 'newest', _("Newest results first"), search_url([params[:query], @variety_postfix, 'newest'], params) %> + <%=link_to_unless @sortby == 'newest', _("Newest results first"), search_path([params[:query], @variety_postfix, 'newest'], params) %> <% if @sortby == 'described' %> | <%= _('Recently described results first') %> <% end %> diff --git a/app/views/help/api.rhtml b/app/views/help/api.rhtml index da6253f87..84ec2f590 100644 --- a/app/views/help/api.rhtml +++ b/app/views/help/api.rhtml @@ -19,7 +19,7 @@ <dt>Linking to new requests</dt> <dd> <p>To encourage your users to make links to a particular public authority, use URLs of the form - <%= link_to new_request_to_body_url(:url_name => "liverpool_city_council") , new_request_to_body_url(:url_name => "liverpool_city_council") %>. + <%= link_to new_request_to_body_url(:url_name => "liverpool_city_council") , new_request_to_body_path(:url_name => "liverpool_city_council") %>. These are the parameters you can add to those URLs, either in the URL or from a form. <ul> @@ -67,7 +67,7 @@ <dd> <p> A spreadsheet file listing every body in WhatDoTheyKnow is available: - <%= link_to "all-authorities.csv", all_public_bodies_csv_url() %> + <%= link_to "all-authorities.csv", all_public_bodies_csv_path %> </p> </dd> diff --git a/app/views/help/contact.rhtml b/app/views/help/contact.rhtml index fab5017b8..b1b5d4f24 100644 --- a/app/views/help/contact.rhtml +++ b/app/views/help/contact.rhtml @@ -46,7 +46,7 @@ <p> <label class="form_label" for="contact_name">Your name:</label> <%= f.text_field :name, :size => 20 %> - (or <%= link_to "sign in", signin_url(:r => request.request_uri) %>) + (or <%= link_to "sign in", signin_path(:r => request.request_uri) %>) </p> <p> diff --git a/app/views/help/unhappy.rhtml b/app/views/help/unhappy.rhtml index 2b00341c2..3966088af 100644 --- a/app/views/help/unhappy.rhtml +++ b/app/views/help/unhappy.rhtml @@ -29,7 +29,7 @@ to your request '<%=request_link(@info_request) %>'? <p> <% if !@info_request.nil? %> - <%= link_to "Request an internal review", show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil) + "?internal_review=1#followup", :class => 'link_button_green' %> and then write a message asking the authority to review your request. + <%= link_to "Request an internal review", show_response_no_followup_path(:id => @info_request.id, :incoming_message_id => nil) + "?internal_review=1#followup", :class => 'link_button_green' %> and then write a message asking the authority to review your request. <% else %> At the bottom of the relevant request page on <%= site_name %> choose "request an internal review". Then write a message asking for an internal diff --git a/app/views/user/_show_user_info.rhtml b/app/views/user/_show_user_info.rhtml index 3c229e9ce..305300236 100644 --- a/app/views/user/_show_user_info.rhtml +++ b/app/views/user/_show_user_info.rhtml @@ -4,7 +4,7 @@ <img class="comment_quote" src="/images/quote-marks.png" alt=""> <%= @display_user.get_about_me_for_html_display %> <% if @is_you %> - (<%= link_to _("edit text about you"), set_profile_about_me_url() %>) + (<%= link_to _("edit text about you"), set_profile_about_me_path %>) <% end %> </div> <% end %> @@ -12,9 +12,9 @@ <% if @is_you %> <p id="user_change_password_email"> <% if @display_user.profile_photo %> - <%= link_to _('Change profile photo'), set_profile_photo_url() %> | + <%= link_to _('Change profile photo'), set_profile_photo_path %> | <% end %> - <%= link_to _('Change your password'), signchangepassword_url() %> | - <%= link_to _('Change your email'), signchangeemail_url() %> + <%= link_to _('Change your password'), signchangepassword_path %> | + <%= link_to _('Change your email'), signchangeemail_path %> </p> <% end %> diff --git a/app/views/user/_signin.rhtml b/app/views/user/_signin.rhtml index c4d917991..7db07e4b4 100644 --- a/app/views/user/_signin.rhtml +++ b/app/views/user/_signin.rhtml @@ -18,7 +18,7 @@ </p> <p class="form_note"> - <%= link_to _('Forgotten your password?'), signchangepassword_url + "?pretoken=" + h(params[:token]), :tabindex => 30 %> + <%= link_to _('Forgotten your password?'), signchangepassword_path + "?pretoken=" + h(params[:token]), :tabindex => 30 %> </p> <p class="form_checkbox"> diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml index 31ea2a70b..c61993688 100644 --- a/app/views/user/show.rhtml +++ b/app/views/user/show.rhtml @@ -55,7 +55,7 @@ <% else %> <% if @is_you %> <span id="set_photo"> - <%= link_to _('Set your profile photo'), set_profile_photo_url() %> + <%= link_to _('Set your profile photo'), set_profile_photo_path %> </span> <% end %> <% end %> @@ -71,7 +71,7 @@ </p> <p> - <%= link_to _('Send message to ') + h(@display_user.name), contact_user_url(:id => @display_user.id) %> + <%= link_to _('Send message to ') + h(@display_user.name), contact_user_path(:id => @display_user.id) %> <% if @is_you %> (<%= _('just to see how it works')%>) <% end %> |