aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/request_controller.rb6
-rw-r--r--app/models/info_request.rb11
-rw-r--r--app/models/outgoing_message.rb2
-rw-r--r--app/models/profile_photo.rb2
-rw-r--r--app/views/admin_request/show.html.erb4
-rw-r--r--app/views/comment/_comment_form.html.erb2
-rw-r--r--app/views/general/_frontpage_bodies_list.html.erb2
-rw-r--r--app/views/general/search.html.erb14
-rw-r--r--app/views/public_body/_body_listing_single.html.erb3
-rw-r--r--app/views/public_body/_list_sidebar_extra.html.erb2
-rw-r--r--app/views/public_body/list.html.erb16
-rw-r--r--app/views/public_body/show.html.erb17
-rw-r--r--app/views/public_body/view_email.html.erb6
-rw-r--r--app/views/request/_after_actions.html.erb2
-rw-r--r--app/views/request/_followup.html.erb15
-rw-r--r--app/views/request/_hidden_correspondence.html.erb12
-rw-r--r--app/views/request/_sidebar.html.erb16
-rw-r--r--app/views/request/followup_bad.html.erb12
-rw-r--r--app/views/request/hidden.html.erb6
-rw-r--r--app/views/request/new.html.erb11
-rw-r--r--app/views/request/new_please_describe.html.erb2
-rw-r--r--app/views/request/preview.html.erb10
-rw-r--r--app/views/request/select_authority.html.erb16
-rw-r--r--app/views/request/show.html.erb8
-rw-r--r--app/views/request/show_response.html.erb4
-rw-r--r--app/views/request/upload_response.html.erb4
-rw-r--r--app/views/user/_signup.html.erb12
-rw-r--r--app/views/user/no_cookies.html.erb4
-rw-r--r--app/views/user/show.html.erb6
-rw-r--r--app/views/user/wrong_user_unknown_email.html.erb4
30 files changed, 131 insertions, 100 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index ea84d3b10..4ef36b6d8 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -324,9 +324,9 @@ class RequestController < ApplicationController
message = ""
if @outgoing_message.contains_email?
if @user.nil?
- message += (_("<p>You do not need to include your email in the request in order to get a reply, as we will ask for it on the next screen (<a href=\"%s\">details</a>).</p>") % [help_privacy_path+"#email_address"]).html_safe;
+ message += _("<p>You do not need to include your email in the request in order to get a reply, as we will ask for it on the next screen (<a href=\"{{url}}\">details</a>).</p>", :url => (help_privacy_path+"#email_address").html_safe);
else
- message += (_("<p>You do not need to include your email in the request in order to get a reply (<a href=\"%s\">details</a>).</p>") % [help_privacy_path+"#email_address"]).html_safe;
+ message += _("<p>You do not need to include your email in the request in order to get a reply (<a href=\"{{url}}\">details</a>).</p>", :url => (help_privacy_path+"#email_address").html_safe);
end
message += _("<p>We recommend that you edit your request and remove the email address.
If you leave it, the email address will be sent to the authority, but will not be displayed on the site.</p>")
@@ -625,7 +625,7 @@ class RequestController < ApplicationController
if !params[:submitted_followup].nil? && !params[:reedit]
if @info_request.allow_new_responses_from == 'nobody'
- flash[:error] = (_('Your follow up has not been sent because this request has been stopped to prevent spam. Please <a href="%s">contact us</a> if you really want to send a follow up message.') % [help_contact_path]).html_safe
+ flash[:error] = _('Your follow up has not been sent because this request has been stopped to prevent spam. Please <a href="{{url}}">contact us</a> if you really want to send a follow up message.', :url => help_contact_path.html_safe)
else
if @info_request.find_existing_outgoing_message(params[:outgoing_message][:body])
flash[:error] = _('You previously submitted that exact follow up message for this request.')
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 156399b99..cf1af0e87 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -478,6 +478,17 @@ public
incoming_message = IncomingMessage.new
ActiveRecord::Base.transaction do
+
+ # To avoid a deadlock when simultaneously dealing with two
+ # incoming emails that refer to the same InfoRequest, we
+ # lock the row for update. In Rails 3.2.0 and later this
+ # can be done with info_request.with_lock or
+ # info_request.lock!, but upgrading to that version of
+ # Rails creates many other problems at the moment. In the
+ # interim, just use raw SQL to do the SELECT ... FOR UPDATE
+ raw_sql = "SELECT * FROM info_requests WHERE id = #{self.id} LIMIT 1 FOR UPDATE"
+ ActiveRecord::Base.connection.execute(raw_sql)
+
raw_email = RawEmail.new
incoming_message.raw_email = raw_email
incoming_message.info_request = self
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb
index 11711090e..dbe2cf1ca 100644
--- a/app/models/outgoing_message.rb
+++ b/app/models/outgoing_message.rb
@@ -269,7 +269,7 @@ class OutgoingMessage < ActiveRecord::Base
end
end
if self.body =~ /#{get_signoff}\s*\Z/m
- errors.add(:body, _("Please sign at the bottom with your name, or alter the \"%{signoff}\" signature" % { :signoff => get_signoff }))
+ errors.add(:body, _("Please sign at the bottom with your name, or alter the \"{{signoff}}\" signature", :signoff => get_signoff))
end
if !MySociety::Validate.uses_mixed_capitals(self.body)
errors.add(:body, _('Please write your message using a mixture of capital and lower case letters. This makes it easier for others to read.'))
diff --git a/app/models/profile_photo.rb b/app/models/profile_photo.rb
index 8a6fe1636..5d542daf1 100644
--- a/app/models/profile_photo.rb
+++ b/app/models/profile_photo.rb
@@ -85,7 +85,7 @@ class ProfilePhoto < ActiveRecord::Base
end
if !self.draft && (self.image.columns != WIDTH || self.image.rows != HEIGHT)
- errors.add(:data, N_("Failed to convert image to the correct size: at %{cols}x%{rows}, need %{width}x%{height}" % { :cols => self.image.columns, :rows => self.image.rows, :width => WIDTH, :height => HEIGHT }))
+ errors.add(:data, N_("Failed to convert image to the correct size: at {{cols}}x{{rows}}, need {{width}}x{{height}}", :cols => self.image.columns, :rows => self.image.rows, :width => WIDTH, :height => HEIGHT))
end
if self.draft && self.user_id
diff --git a/app/views/admin_request/show.html.erb b/app/views/admin_request/show.html.erb
index 9cbcb68f0..e18e319be 100644
--- a/app/views/admin_request/show.html.erb
+++ b/app/views/admin_request/show.html.erb
@@ -258,7 +258,7 @@
</td>
<td>
<% if column_name == 'body' %>
- <%= simple_format(truncate(outgoing_message.body, :length => 400, :omission => link_to("...", "#", :class => "toggle-hidden" ))) %>
+ <%= simple_format(truncate(h(outgoing_message.body), :length => 400, :omission => link_to("...", "#", :class => "toggle-hidden" )).html_safe) %>
<div style="display:none;"><%= simple_format( outgoing_message.body ) %></div>
<% else %>
<%= admin_value(value) %>
@@ -303,7 +303,7 @@
</td>
<td>
<% if column_name =~ /^cached_.*?$/ %>
- <%= simple_format( truncate(value, :length => 400, :omission => link_to("...", "#", :class => "toggle-hidden"))) %>
+ <%= simple_format( truncate(h(value), :length => 400, :omission => link_to("...", "#", :class => "toggle-hidden")).html_safe) %>
<div style="display:none;"><%= simple_format(value) %></div>
<% else %>
<%= simple_format(value.to_s) %>
diff --git a/app/views/comment/_comment_form.html.erb b/app/views/comment/_comment_form.html.erb
index 91cd8f7d0..b78532768 100644
--- a/app/views/comment/_comment_form.html.erb
+++ b/app/views/comment/_comment_form.html.erb
@@ -13,7 +13,7 @@
<%= hidden_field_tag 'submitted_comment', 1 %>
<%= hidden_field_tag 'preview', 1 %>
<%= submit_tag _('Preview your annotation') %>
- <%= raw(_(' (<strong>no ranty</strong> politics, read our <a href="%s">moderation policy</a>)') % [help_requesting_path+'#moderation']) %>
+ <%= _(' (<strong>no ranty</strong> politics, read our <a href="{{url}}">moderation policy</a>)', :url => (help_requesting_path+'#moderation').html_safe) %>
</p>
<% end %>
diff --git a/app/views/general/_frontpage_bodies_list.html.erb b/app/views/general/_frontpage_bodies_list.html.erb
index 54400602b..75daea41d 100644
--- a/app/views/general/_frontpage_bodies_list.html.erb
+++ b/app/views/general/_frontpage_bodies_list.html.erb
@@ -6,7 +6,7 @@
<ul>
<% for popular_body in @popular_bodies %>
<li><%=public_body_link(popular_body)%>
- <%= n_('%d request', '%d requests', popular_body.info_requests_count) % popular_body.info_requests_count %>
+ <%= n_('{{count}} request', '{{count}} requests', popular_body.info_requests_count, :count => popular_body.info_requests_count) %>
</li>
<% end%>
</ul>
diff --git a/app/views/general/search.html.erb b/app/views/general/search.html.erb
index 7072ab90f..6234687f2 100644
--- a/app/views/general/search.html.erb
+++ b/app/views/general/search.html.erb
@@ -16,7 +16,7 @@
<% if @query.nil? %>
<h1><%= _("Search") %></h1>
<% else %>
- <h1><%= _("Search results") %></h1>
+ <h1><%= _("Search results") %></h1>
<% end%>
<% if @advanced %>
@@ -56,7 +56,7 @@
["all", _("everything")]]%>
<% for variety, label in labels %>
<% if @variety_postfix != variety %>
- <%= link_to label, search_path([params[:query], variety, @sort_postfix]) %>
+ <%= link_to label, search_path([params[:query], variety, @sort_postfix]) %>
<% else %>
<%= label %>
<% end %>
@@ -94,7 +94,7 @@
<div>
<h3 class="title"><%= _("Search in") %></h3>
- <% [["sent", _("messages from users")],
+ <% [["sent", _("messages from users")],
["response", _("messages from authorities")],
["comment", _("comments")]].each_with_index do |item, index|
variety, title = item %>
@@ -110,14 +110,14 @@
<label class="form_label" for="query">&nbsp;<%= _("and") %></label>
<%= text_field_tag(:request_date_before, params[:request_date_before], {:class => "use-datepicker", :size => 10}) %>
</div>
- </div>
+ </div>
<% end %>
-
+
<div>
<%= submit_tag _("Filter") if @variety_postfix == "requests"%>
</div>
<% end # Search form%>
-
+
<% end # if @advanced %>
<% if !@query.nil? %>
@@ -164,7 +164,7 @@
<% if @spelling_correction %>
<p id="did_you_mean"><%= _('Did you mean: {{correction}}', :correction => search_link(@spelling_correction)) %></p>
<% end %>
- <p><%= raw(_('<a href="%s">Browse all</a> or <a href="%s">ask us to add one</a>.') % [list_public_bodies_default_url, help_requesting_path + '#missing_body']) %></p>
+ <p><%= raw(_('<a href="{{browse_url}}">Browse all</a> or <a href="{{add_url}}">ask us to add one</a>.', :browse_url => list_public_bodies_default_path.html_safe, :add_url => (help_requesting_path + '#missing_body').html_safe)) %></p>
<% end %>
</div>
diff --git a/app/views/public_body/_body_listing_single.html.erb b/app/views/public_body/_body_listing_single.html.erb
index d0496fbb8..8e0a64df7 100644
--- a/app/views/public_body/_body_listing_single.html.erb
+++ b/app/views/public_body/_body_listing_single.html.erb
@@ -18,7 +18,8 @@
<% end %>
</span>
<span class="bottomline">
- <%= n_('%d request made.', '%d requests made.', public_body.info_requests.size) % public_body.info_requests.size %>
+ <%= n_('{{count}} request made.', '{{count}} requests made.', public_body.info_requests.size,
+ :count => public_body.info_requests.size) %>
<% if !@include_request_link_in_authority_listing.nil? %>
<%= link_to _("Make your own request"), public_body_path(public_body) %>.
<% end %>
diff --git a/app/views/public_body/_list_sidebar_extra.html.erb b/app/views/public_body/_list_sidebar_extra.html.erb
index d3d65fec8..290593d6a 100644
--- a/app/views/public_body/_list_sidebar_extra.html.erb
+++ b/app/views/public_body/_list_sidebar_extra.html.erb
@@ -1,5 +1,5 @@
<p>
- <%= raw(_('<a href="%s">Are we missing a public authority?</a>') % [help_requesting_path + '#missing_body']) %>
+ <%= link_to _('Are we missing a public authority?'), help_requesting_path + '#missing_body' %>
</p>
<p>
<%= link_to _('List of all authorities (CSV)'), all_public_bodies_csv_path %>
diff --git a/app/views/public_body/list.html.erb b/app/views/public_body/list.html.erb
index 3d73090d4..ce24daaf9 100644
--- a/app/views/public_body/list.html.erb
+++ b/app/views/public_body/list.html.erb
@@ -10,7 +10,7 @@
<% for row in PublicBodyCategories::get().with_headings() %>
<% if row.instance_of?(Array) %>
<li>
- <%= link_to_unless (@tag == row[0]), row[1], list_public_bodies_path(:tag => row[0]) %>
+ <%= link_to_unless (@tag == row[0]), row[1], list_public_bodies_path(:tag => row[0]) %>
</li>
<% else %>
<% if not first_row %>
@@ -23,7 +23,7 @@
<% end %>
<% end %>
<% if not first_row %>
- </ul>
+ </ul>
<% end %>
<%= render :partial => "list_sidebar_extra" %>
</div>
@@ -34,14 +34,20 @@
<%= form_tag(list_public_bodies_default_url, :method => "get", :id=>"search_form") do %>
<div>
- <%= text_field_tag(:public_body_query, params[:public_body_query], { :title => "type your search term here" } ) %>
+ <%= text_field_tag(:public_body_query, params[:public_body_query], { :title => "type your search term here" } ) %>
<%= submit_tag(_("Search")) %>
</div>
<% end %>
-<h2 class="publicbody_results"><%= n_('Found %d public authority %s', 'Found %d public authorities %s', @public_bodies.total_entries) % [@public_bodies.total_entries, @description] %></h2>
+<h2 class="publicbody_results">
+ <%= n_('Found {{count}} public authority {{description}}',
+ 'Found {{count}} public authorities {{description}}',
+ @public_bodies.total_entries,
+ :count => @public_bodies.total_entries,
+ :description => @description) %>
+</h2>
<%= render :partial => 'body_listing', :locals => { :public_bodies => @public_bodies } %>
<%= will_paginate(@public_bodies) %><br/>
- <%= raw _('<a href="%s">Can\'t find the one you want?</a>') % [help_requesting_path + '#missing_body'] %>
+ <%= link_to _("Can't find the one you want?"), help_requesting_path + '#missing_body' %>
</div>
diff --git a/app/views/public_body/show.html.erb b/app/views/public_body/show.html.erb
index df6346e4f..fa6243b47 100644
--- a/app/views/public_body/show.html.erb
+++ b/app/views/public_body/show.html.erb
@@ -4,7 +4,12 @@
<h2><%= _('Follow this authority')%></h2>
<% follower_count = TrackThing.count(:all, :conditions => ["public_body_id = ?", @public_body.id]) %>
- <p><%= raw(n_("<span id='follow_count'>%d</span> person is following this authority", "<span id='follow_count'>%d</span> people are following this authority", follower_count) % follower_count) %></p>
+ <p>
+ <%= n_("{{count}} person is following this authority",
+ "{{count}} people are following this authority",
+ follower_count,
+ :count => content_tag(:span, follower_count, :id => "follow_count")) %>
+ </p>
<%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'sidebar' } %>
<h2><%= _('More about this authority')%></h2>
@@ -56,7 +61,7 @@
<% else %>
<%= _('Make a new <strong>Freedom of Information</strong> request to {{public_body}}', :public_body => h(@public_body.name))%>
<% end %>
- &nbsp;<%= _('<a class="link_button_green" href="{{url}}">{{text}}</a>', :url=>new_request_to_body_url(:url_name => @public_body.url_name), :text=>_("Start"))%>
+ &nbsp;<%= link_to _("Start"), new_request_to_body_url(:url_name => @public_body.url_name), :class => "link_button_green" %>
<% elsif @public_body.has_notes? %>
<%= @public_body.notes_as_html.html_safe %>
<% elsif @public_body.not_requestable_reason == 'not_apply' %>
@@ -91,9 +96,13 @@
<%= pluralize(@public_body.info_requests.size, "Environmental Information Regulations request made using this site") %>
<% else %>
<% if @public_body.info_requests.size > 4 %>
- <%= n_('Search within the %d Freedom of Information requests to %s', 'Search within the %d Freedom of Information requests made to %s', @public_body.info_requests.size) % [@public_body.info_requests.size, @public_body.name] %>
+ <%= n_('Search within the {{count}} Freedom of Information requests to {{public_body_name}}', 'Search within the {{count}} Freedom of Information requests made to {{public_body_name}}', @public_body.info_requests.size, :count => @public_body.info_requests.size, :public_body_name => @public_body.name) %>
<% else %>
- <%= n_('%d Freedom of Information request to %s', '%d Freedom of Information requests to %s', @public_body.info_requests.size) % [@public_body.info_requests.size, @public_body.name] %>
+ <%= n_('{{count}} Freedom of Information request to {{public_body_name}}',
+ '{{count}} Freedom of Information requests to {{public_body_name}}',
+ @public_body.info_requests.size,
+ :count => @public_body.info_requests.size,
+ :public_body_name => @public_body.name) %>
<% end %>
<% end %>
<%= @page_desc %>
diff --git a/app/views/public_body/view_email.html.erb b/app/views/public_body/view_email.html.erb
index 3799d227b..3f0a558c7 100644
--- a/app/views/public_body/view_email.html.erb
+++ b/app/views/public_body/view_email.html.erb
@@ -25,10 +25,10 @@
<p>
<% if @public_body.is_requestable? || @public_body.not_requestable_reason != 'bad_contact' %>
- <%= raw _('If the address is wrong, or you know a better address, please <a href="%s">contact us</a>.')% [help_contact_path]%>
+ <%= raw(_('If the address is wrong, or you know a better address, please <a href="{{url}}">contact us</a>.', :url => help_contact_path.html_safe)) %>
<% else %>
- <%= raw _(' If you know the address to use, then please <a href="%s">send it to us</a>.
- You may be able to find the address on their website, or by phoning them up and asking.')% [help_contact_path] %>
+ <%= raw(_(' If you know the address to use, then please <a href="{{url}}">send it to us</a>.
+ You may be able to find the address on their website, or by phoning them up and asking.', :url =>help_contact_path.html_safe)) %>
<% end %>
</p>
diff --git a/app/views/request/_after_actions.html.erb b/app/views/request/_after_actions.html.erb
index d3ddb981b..b54a8f5fb 100644
--- a/app/views/request/_after_actions.html.erb
+++ b/app/views/request/_after_actions.html.erb
@@ -7,7 +7,7 @@
<ul>
<% if @info_request.comments_allowed? %>
<li>
- <%= raw(_('<a href="%s">Add an annotation</a> (to help the requester or others)') % [new_comment_path(:url_title => @info_request.url_title)]) %>
+ <%= raw(_('<a href="{{url}}">Add an annotation</a> (to help the requester or others)', :url => new_comment_url(:url_title => @info_request.url_title).html_safe)) %>
</li>
<% end %>
<% if @old_unclassified %>
diff --git a/app/views/request/_followup.html.erb b/app/views/request/_followup.html.erb
index 6d2282613..bb099ff15 100644
--- a/app/views/request/_followup.html.erb
+++ b/app/views/request/_followup.html.erb
@@ -49,9 +49,9 @@
<% else %>
<% if @internal_review %>
<p>
- <%= raw(_('If you are dissatisfied by the response you got from
+ <%= _('If you are dissatisfied by the response you got from
the public authority, you have the right to
- complain (<a href="%s">details</a>).') % "http://foiwiki.com/foiwiki/index.php/Internal_reviews") %>
+ complain (<a href="{{url}}">details</a>).', :url => "http://foiwiki.com/foiwiki/index.php/Internal_reviews".html_safe) %>
</p>
<% end %>
@@ -61,21 +61,20 @@
<% status = @info_request.calculate_status %>
<% if status == 'waiting_response_overdue' %>
- <p><%= _('The response to your request has been <strong>delayed</strong>. You can say that,
+ <p><%= _('The response to your request has been <strong>delayed</strong>. You can say that,
by law, the authority should normally have responded
<strong>promptly</strong> and') %>
<% if @info_request.public_body.is_school? %>
<%= _('in term time') %>
<% end %>
<%= _('by <strong>{{date}}</strong>',:date=>simple_date(@info_request.date_response_required_by)) %>
- (<%= raw(_('<a href="%s">details</a>') % ["#{help_requesting_path}#quickly_response"]) %>).
-
+ (<%= link_to _('details'), "#{help_requesting_path}#quickly_response" %>).
</p>
<% elsif status == 'waiting_response_very_overdue' %>
<p>
- <%= _('The response to your request is <strong>long overdue</strong>. You can say that, by
+ <%= _('The response to your request is <strong>long overdue</strong>. You can say that, by
law, under all circumstances, the authority should have responded
- by now') %> (<%= raw(_('<a href="%s">details</a>') % ["#{help_requesting_path}#quickly_response"]) %>).
+ by now') %> (<%= link_to _('details'), "#{help_requesting_path}#quickly_response" %>).
</p>
<% end %>
@@ -103,7 +102,7 @@
<div>
<%= radio_button "outgoing_message", "what_doing", "internal_review", :id => "internal_review" %>
<label for="internal_review"><%= _('I am requesting an <strong>internal review</strong>') %>
- <%= raw(_('<a href="%s">what\'s that?</a>') % ["/help/unhappy"]) %>
+ <%= link_to _("what's that?"), "/help/unhappy" %>
</label>
</div>
<div>
diff --git a/app/views/request/_hidden_correspondence.html.erb b/app/views/request/_hidden_correspondence.html.erb
index a5e680385..5ee9a4724 100644
--- a/app/views/request/_hidden_correspondence.html.erb
+++ b/app/views/request/_hidden_correspondence.html.erb
@@ -7,21 +7,21 @@
%>
<div class="correspondence" id="incoming-<%=incoming_message.id.to_s%>">
<p>
- <%= raw(_('This response has been hidden. See annotations to find out why.
- If you are the requester, then you may <a href="%s">sign in</a> to view the response.') % [signin_url(:r => request.fullpath)]) %>
+ <%= _('This response has been hidden. See annotations to find out why.
+ If you are the requester, then you may <a href="{{url}}">sign in</a> to view the response.', :url => signin_url(:r => request.fullpath).html_safe) %>
</p>
</div>
<% elsif [ 'sent', 'followup_sent', 'resent', 'followup_resent' ].include?(info_request_event.event_type) %>
<div class="correspondence" id="outgoing-<%=outgoing_message.id.to_s%>">
<p>
- <%= raw(_('This outgoing message has been hidden. See annotations to
- find out why. If you are the requester, then you may <a href="%s">sign in</a> to view the response.') % [signin_url(:r => request.fullpath)]) %>
+ <%= _('This outgoing message has been hidden. See annotations to
+ find out why. If you are the requester, then you may <a href="{{url}}">sign in</a> to view the response.', :url => signin_url(:r => request.fullpath).html_safe) %>
</p>
</div>
<% elsif info_request_event.event_type == 'comment' %>
<div class="comment_in_request" id="comment-<%=comment.id.to_s%>">
- <p><%= raw(_('This comment has been hidden. See annotations to
- find out why. If you are the requester, then you may <a href="%s">sign in</a> to view the response.') % [signin_url(:r => request.fullpath)]) %>
+ <p><%= _('This comment has been hidden. See annotations to
+ find out why. If you are the requester, then you may <a href="{{url}}">sign in</a> to view the response.', :url => signin_url(:r => request.fullpath).html_safe) %>
</p>
</div>
<% end %>
diff --git a/app/views/request/_sidebar.html.erb b/app/views/request/_sidebar.html.erb
index 80536da3e..e0b01924d 100644
--- a/app/views/request/_sidebar.html.erb
+++ b/app/views/request/_sidebar.html.erb
@@ -3,7 +3,12 @@
<h2><%= _('Follow this request') %></h2>
<% follower_count = TrackThing.count(:all, :conditions => ["info_request_id = ?", @info_request.id]) + 1 %>
- <p><%= n_("There is %d person following this request", "There are %d people following this request", follower_count) % follower_count %></p>
+ <p>
+ <%= n_("There is {{count}} person following this request",
+ "There are {{count}} people following this request",
+ follower_count,
+ :count => follower_count) %>
+ </p>
<%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => @info_request.user && @info_request.user == @user, :location => 'sidebar' } %>
</div>
<% if @info_request.described_state != "attention_requested" %>
@@ -17,10 +22,10 @@
<% elsif @info_request.prominence == 'requester_only' %>
<%# The eccentric formatting of the following string is in order that it be identical
to the corresponding string in request/show.html.erb %>
- <p><%= raw(_('This request is hidden, so that only you the requester can see it. Please
- <a href="%s">contact us</a> if you are not sure why.') % [help_requesting_path]) %></p>
+ <p><%= _('This request is hidden, so that only you the requester can see it. Please
+ <a href="{{url}}">contact us</a> if you are not sure why.', :url => help_requesting_path.html_safe) %></p>
<% else %>
- <p><%= raw(_('This request has been marked for review by the site administrators, who have not hidden it at this time. If you believe it should be hidden, please <a href="%s">contact us</a>.') % [help_requesting_path]) %></p>
+ <p><%= _('This request has been marked for review by the site administrators, who have not hidden it at this time. If you believe it should be hidden, please <a href="{{url}}">contact us</a>.', :url => help_requesting_path.html_safe) %></p>
<% end %>
<% else %>
<p><%= _('Requests for personal information and vexatious requests are not considered valid for FOI purposes (<a href="/help/about">read more</a>).') %></p>
@@ -62,7 +67,6 @@
<!-- this link with this wording is here for legal reasons, discuss with
board and our lawyer before changing or removing it -->
- <p><small><%= raw(_('<a href="%s">Are you the owner of
- any commercial copyright on this page?</a>') % [help_officers_path+"#copyright"]) %></small></p>
+ <p><small><%= link_to _('Are you the owner of any commercial copyright on this page?'), help_officers_path+"#copyright" %></small></p>
</div>
diff --git a/app/views/request/followup_bad.html.erb b/app/views/request/followup_bad.html.erb
index c892263e6..ea2400c5d 100644
--- a/app/views/request/followup_bad.html.erb
+++ b/app/views/request/followup_bad.html.erb
@@ -9,21 +9,21 @@
<% if @reason == 'not_apply' %>
<!-- we should never get here, but just in case give a sensible message -->
<p><%= _('Freedom of Information law no longer applies to') %> <%=h @info_request.public_body.name %>.
- <%= raw(_('From the request page, try replying to a particular message, rather than sending
+ <%= _('From the request page, try replying to a particular message, rather than sending
a general followup. If you need to make a general followup, and know
- an email which will go to the right place, please <a href="%s">send it to us</a>.') % [help_contact_path]) %>
+ an email which will go to the right place, please <a href="{{url}}">send it to us</a>.', :url => help_contact_path.html_safe) %>
</p>
<% elsif @reason == 'defunct' %>
<!-- we should never get here, but just in case give a sensible message -->
- <p><%=h @info_request.public_body.name %> <%= raw(_('no longer exists. If you are trying to make
+ <p><%=h @info_request.public_body.name %> <%= _('no longer exists. If you are trying to make
From the request page, try replying to a particular message, rather than sending
a general followup. If you need to make a general followup, and know
- an email which will go to the right place, please <a href="%s">send it to us</a>.') % [help_contact_path]) %>
+ an email which will go to the right place, please <a href="{{url}}">send it to us</a>.', :url => help_contact_path.html_safe) %>
</p>
<% elsif @reason == 'bad_contact' %>
- <p><%= _('We do not have a working {{law_used_full}} address for {{public_body_name}}.',:law_used_full=>h(@info_request.law_used_full),:public_body_name=>h(@info_request.public_body.name)) %> <%= raw(_('You may be able to find
+ <p><%= _('We do not have a working {{law_used_full}} address for {{public_body_name}}.',:law_used_full=>h(@info_request.law_used_full),:public_body_name=>h(@info_request.public_body.name)) %> <%= _('You may be able to find
one on their website, or by phoning them up and asking. If you manage
- to find one, then please <a href="%s">send it to us</a>.') % [help_contact_path]) %>
+ to find one, then please <a href="{{url}}">send it to us</a>.', :url => help_contact_path.html_safe) %>
</p>
<% elsif @reason == 'external' %>
<p><%= _("Followups cannot be sent for this request, as it was made externally, and published here by {{public_body_name}} on the requester's behalf.", :public_body_name => h(@info_request.public_body.name)) %>
diff --git a/app/views/request/hidden.html.erb b/app/views/request/hidden.html.erb
index 41b2ff7e4..f2f76a817 100644
--- a/app/views/request/hidden.html.erb
+++ b/app/views/request/hidden.html.erb
@@ -6,13 +6,13 @@
<%=@details%>
</p>
-<p><%= raw(_('The request you have tried to view has been removed. There are
+<p><%= _('The request you have tried to view has been removed. There are
various reasons why we might have done this, sorry we can\'t be more specific here. Please <a
- href="%s">contact us</a> if you have any questions.') % [help_contact_path]) %>
+ href="{{url}}">contact us</a> if you have any questions.', :url => help_contact_path.html_safe) %>
</p>
<% if @info_request.prominence == 'requester_only' %>
<p>
- <%= raw(_('If you are the requester, then you may <a href="%s">sign in</a> to view the request.') % [signin_url(:r => request.fullpath)]) %>
+ <%= _('If you are the requester, then you may <a href="{{url}}">sign in</a> to view the request.', :url => signin_url(:r => request.fullpath).html_safe) %>
</p>
<% end %>
diff --git a/app/views/request/new.html.erb b/app/views/request/new.html.erb
index 398147041..8b7d38ac0 100644
--- a/app/views/request/new.html.erb
+++ b/app/views/request/new.html.erb
@@ -98,7 +98,7 @@
<ul>
<li><%= _('Write your request in <strong>simple, precise language</strong>.') %></li>
<li><%= _('Ask for <strong>specific</strong> documents or information, this site is not suitable for general enquiries.') %></li>
- <li><%= raw(_('Keep it <strong>focused</strong>, you\'ll be more likely to get what you want (<a href="%s">why?</a>).') % [help_requesting_path + '#focused']) %></li>
+ <li><%= _('Keep it <strong>focused</strong>, you\'ll be more likely to get what you want (<a href="{{url}}">why?</a>).', :url => (help_requesting_path + '#focused').html_safe) %></li>
</ul>
</div>
@@ -112,23 +112,24 @@
<% if !@user %>
<p class="form_note">
+
<%= raw(_('Everything that you enter on this page, including <strong>your name</strong>,
will be <strong>displayed publicly</strong> on
- this website forever (<a href="%s">why?</a>).') % [help_privacy_path+"#public_request"]) %>
+ this website forever (<a href="{{url}}">why?</a>).', :url => (help_privacy_path+"#public_request").html_safe)) %>
<%= raw(_('If you are thinking of using a pseudonym,
- please <a href="%s">read this first</a>.') % [help_privacy_path+"#real_name"]) %>
+ please <a href="{{url}}">read this first</a>.', :url => (help_privacy_path+"#real_name").html_safe)) %>
</p>
<% else %>
<p class="form_note">
<%= raw(_('Everything that you enter on this page
will be <strong>displayed publicly</strong> on
- this website forever (<a href="%s">why?</a>).') % [help_privacy_path+"#public_request"]) %>
+ this website forever (<a href="{{url}}">why?</a>).', :url => (help_privacy_path+"#public_request").html_safe)) %>
</p>
<% end %>
<p class="form_note">
<%= raw(_("<strong> Can I request information about myself?</strong>\n" +
- "\t\t\t<a href=\"%s\">No! (Click here for details)</a>") % [help_requesting_path+"#data_protection"]) %>
+ "\t\t\t<a href=\"{{url}}\">No! (Click here for details)</a>", :url => (help_requesting_path+"#data_protection").html_safe)) %>
</p>
<div class="form_button">
diff --git a/app/views/request/new_please_describe.html.erb b/app/views/request/new_please_describe.html.erb
index 6a193e70d..5a67d01f9 100644
--- a/app/views/request/new_please_describe.html.erb
+++ b/app/views/request/new_please_describe.html.erb
@@ -13,7 +13,7 @@ if they are successful yet or not.') %>
</ul>
<p>
- <%= raw(_('When you\'re done, <strong>come back here</strong>, <a href="%s">reload this page</a> and file your new request.') % [request.fullpath]) %>
+ <%= _('When you\'re done, <strong>come back here</strong>, <a href="{{url}}">reload this page</a> and file your new request.', :url => request.fullpath.html_safe) %>
</p>
<p>
diff --git a/app/views/request/preview.html.erb b/app/views/request/preview.html.erb
index 84be15ed2..243dc90a9 100644
--- a/app/views/request/preview.html.erb
+++ b/app/views/request/preview.html.erb
@@ -6,7 +6,7 @@
<ul>
<li><%= _('Check you haven\'t included any <strong>personal information</strong>.') %></li>
<li><%= raw(_('Your name, request and any responses will appear in <strong>search engines</strong>
- (<a href="%s">details</a>).') % [help_privacy_path+"#public_request"]) %>
+ (<a href="{{url}}">details</a>).', :url => (help_privacy_path+"#public_request").html_safe)) %>
</li>
</ul>
@@ -23,13 +23,13 @@
<%= o.hidden_field(:body) %>
</div>
- <p class="event_actions">
+ <p class="event_actions">
</p>
</div>
<% end %>
- <p><%= raw(_('<strong>Privacy note:</strong> If you want to request private information about
- yourself then <a href="%s">click here</a>.') % [help_requesting_path+"#data_protection"]) %>
+ <p><%= _('<strong>Privacy note:</strong> If you want to request private information about
+ yourself then <a href="{{url}}">click here</a>.', :url => (help_requesting_path+"#data_protection").html_safe) %>
<p>
<%= f.hidden_field(:title) %>
@@ -38,7 +38,7 @@
<%= hidden_field_tag(:submitted_new_request, 1) %>
<%= hidden_field_tag(:preview, 0 ) %>
<%= submit_tag _("Edit this request"), :name => 'reedit', :id => 'reedit_button' %>
- <%= submit_tag _("Send request"), :name => 'submit', :id => 'submit_button' %>
+ <%= submit_tag _("Send request"), :name => 'submit', :id => 'submit_button' %>
</p>
<% if !@info_request.tag_string.empty? %>
diff --git a/app/views/request/select_authority.html.erb b/app/views/request/select_authority.html.erb
index 43a91beff..c01e2776f 100644
--- a/app/views/request/select_authority.html.erb
+++ b/app/views/request/select_authority.html.erb
@@ -2,22 +2,22 @@
<script type="text/javascript">
$(document).ready(function(){
$("#authority_preview").hide();
-
+
// Avoid triggering too often (on each keystroke) by using the debounce jQuery plugin:
// http://benalman.com/projects/jquery-throttle-debounce-plugin/
- $("#query").keypress($.debounce( 300, function() {
+ $("#query").keypress($.debounce( 300, function() {
// Do a type ahead search and display results
$("#typeahead_response").load("<%=search_ahead_bodies_url%>?query="+encodeURI(this.value), function() {
$("#authority_preview").hide(); // Hide the preview, since results have changed
});
}));
- // We're using the existing body list: we intercept the clicks on the titles to
+ // We're using the existing body list: we intercept the clicks on the titles to
// display a preview on the right hand side of the screen
$("#typeahead_response .head a").live('click', function() {
$("#authority_preview").load(this.href+" #public_body_show", function() {
$("#authority_preview").show();
- $(window).scrollTop($("#banner").height());
+ $(window).scrollTop($("#banner").height());
$("#authority_preview #header_right").hide();
});
return false;
@@ -33,9 +33,9 @@
<%= form_tag({:controller => "request", :action => "select_authority"}, {:id => "search_form", :method => "get"}) do %>
<div>
<p>
- <%= raw(_('First, type in the <strong>name of the UK public authority</strong> you\'d
+ <%= _('First, type in the <strong>name of the UK public authority</strong> you\'d
like information from. <strong>By law, they have to respond</strong>
- (<a href="%s#%s">why?</a>).') % [help_about_path, "whybother_them"]) %>
+ (<a href="{{url}}">why?</a>).', :url => (help_about_path + "#whybother_them").html_safe) %>
</p>
<%= text_field_tag 'query', params[:query], { :size => 30, :title => "type your search term here" } %>
<%= hidden_field_tag 'bodies', 1 %>
@@ -64,7 +64,7 @@
</div>
</div>
-
+
<div id="authority_preview">
</div>
-
+
diff --git a/app/views/request/show.html.erb b/app/views/request/show.html.erb
index 54006b291..4b0663f76 100644
--- a/app/views/request/show.html.erb
+++ b/app/views/request/show.html.erb
@@ -10,8 +10,8 @@
<% end %>
<% if @info_request.prominence == 'requester_only' %>
<p id="hidden_request">
- <%= raw(_('This request is hidden, so that only you the requester can see it. Please
- <a href="%s">contact us</a> if you are not sure why.') % [help_requesting_path]) %>
+ <%= _('This request is hidden, so that only you the requester can see it. Please
+ <a href="{{url}}">contact us</a> if you are not sure why.', :url => help_requesting_path.html_safe) %>
</p>
<% end %>
@@ -80,11 +80,11 @@
<%= _('in term time') %>
<% end %>
<%= _('by') %> <strong><%= simple_date(@info_request.date_response_required_by) %></strong>
- (<%= raw(_('<a href="%s">details</a>') % [help_requesting_path + '#quickly_response']) %>)
+ (<%= link_to _('details'), help_requesting_path + '#quickly_response' %>)
<% elsif @status == 'waiting_response_very_overdue' %>
<%= _('Response to this request is <strong>long overdue</strong>.') %>
<%= _('By law, under all circumstances, {{public_body_link}} should have responded by now',:public_body_link => public_body_link(@info_request.public_body)) %>
- (<%= raw(_('<a href="%s">details</a>') % [help_requesting_path + '#quickly_response']) %>).
+ (<%= link_to _('details'), 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_path(:id => @info_request.id, :incoming_message_id => nil) + "?internal_review=1#followup" %>.
diff --git a/app/views/request/show_response.html.erb b/app/views/request/show_response.html.erb
index ac1f04227..a61359679 100644
--- a/app/views/request/show_response.html.erb
+++ b/app/views/request/show_response.html.erb
@@ -26,8 +26,8 @@
<%= _('The authority only has a <strong>paper copy</strong> of the information.') %>
</dt>
<dd>
- <%= raw(_('At the bottom of this page, write a reply to them trying to persuade them to scan it in
- (<a href="%s">more details</a>).') % [help_privacy_path + '#postal_answer']) %>
+ <%= _('At the bottom of this page, write a reply to them trying to persuade them to scan it in
+ (<a href="{{url}}">more details</a>).', :url => (help_privacy_path + '#postal_answer').html_safe) %>
</dd>
<dt>
diff --git a/app/views/request/upload_response.html.erb b/app/views/request/upload_response.html.erb
index 158d5d3c4..f5fd6f000 100644
--- a/app/views/request/upload_response.html.erb
+++ b/app/views/request/upload_response.html.erb
@@ -12,7 +12,7 @@
<h1><%= _('Respond to the FOI request')%> '<%=request_link(@info_request)%>'<% _(' made by ')%><%=user_link(@info_request.user) %></h1>
<p>
- <%= raw(_('Your response will <strong>appear on the Internet</strong>, <a href="%s">read why</a> and answers to other questions.') % [help_officers_path]) %>
+ <%= raw(_('Your response will <strong>appear on the Internet</strong>, <a href="{{url}}">read why</a> and answers to other questions.', :url => help_officers_path.html_safe)) %>
</p>
<h2><%= _('Respond by email')%></h2>
@@ -28,7 +28,7 @@
<h2><%= _('Respond using the web')%></h2>
<p><%= raw(_('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>
+ <a href="{{url}}">contact us</a> if you need more).', :url => help_contact_path.html_safe)) %></p>
<%= form_tag '', :id => 'upload_response_form', :multipart => true do %>
<p>
diff --git a/app/views/user/_signup.html.erb b/app/views/user/_signup.html.erb
index ac4fd3e10..ec6541881 100644
--- a/app/views/user/_signup.html.erb
+++ b/app/views/user/_signup.html.erb
@@ -10,8 +10,8 @@
<%= text_field 'user_signup', 'email', { :size => 20, :tabindex => 60 } %>
</p>
<div class="form_item_note">
- <%= raw(_('We will not reveal your email address to anybody unless you or
- the law tell us to (<a href="%s">details</a>). ') %[help_privacy_path]) %>
+ <%= _('We will not reveal your email address to anybody unless you or
+ the law tell us to (<a href="{{url}}">details</a>). ', :url => help_privacy_path) %>
</div>
<p>
@@ -19,11 +19,11 @@
<%= text_field 'user_signup', 'name', { :size => 20, :tabindex => 70, :autocomplete => "off" } %>
</p>
<div class="form_item_note">
- <%= raw(_('Your <strong>name will appear publicly</strong>
- (<a href="%s">why?</a>)
+ <%= _('Your <strong>name will appear publicly</strong>
+ (<a href="{{why_url}}">why?</a>)
on this website and in search engines. If you
- are thinking of using a pseudonym, please
- <a href="%s">read this first</a>.') % [help_privacy_path+"#public_request", help_privacy_path+"#real_name"]) %>
+ are thinking of using a pseudonym, please
+ <a href="{{help_url}}">read this first</a>.', :why_url => (help_privacy_path+"#public_request").html_safe, :help_url => (help_privacy_path+"#real_name").html_safe) %>
</div>
<p>
diff --git a/app/views/user/no_cookies.html.erb b/app/views/user/no_cookies.html.erb
index c291367f2..0a4a39b1b 100644
--- a/app/views/user/no_cookies.html.erb
+++ b/app/views/user/no_cookies.html.erb
@@ -12,11 +12,11 @@ browser. Then press refresh to have another go.')%></p>
<p><%= _('If your browser is set to accept cookies and you are seeing this message,
then there is probably a fault with our server.')%>
-<%= raw(_('Please <a href="%s">get in touch</a> with us so we can fix it.') % [help_contact_path]) %>
+<%= _('Please <a href="{{url}}">get in touch</a> with us so we can fix it.', :url => help_contact_path.html_safe) %>
<%= _('Let us know what you were doing when this message
appeared and your browser and operating system type and version.')%></p>
-<p><%= raw(_('If you are still having trouble, please <a href="%s">contact us</a>.') % [help_contact_path]) %>
+<p><%= _('If you are still having trouble, please <a href="{{url}}">contact us</a>.', :url => help_contact_path.html_safe) %>
</p>
diff --git a/app/views/user/show.html.erb b/app/views/user/show.html.erb
index b92ffcff2..c9862effe 100644
--- a/app/views/user/show.html.erb
+++ b/app/views/user/show.html.erb
@@ -97,7 +97,7 @@
<% if not @is_you %>
<p id="user_not_logged_in">
- <%= raw(_('<a href="%s">Sign in</a> to change password, subscriptions and more ({{user_name}} only)',:user_name=>h(@display_user.name)) % [signin_url(:r => request.fullpath)]) %>
+ <%= _('<a href="{{url}}">Sign in</a> to change password, subscriptions and more ({{user_name}} only)',:user_name=>h(@display_user.name), :url => signin_url(:r => request.fullpath).html_safe) %>
</p>
<% end %>
</div>
@@ -128,7 +128,7 @@
<% end %>
<% else %>
<h2 class="foi_results" id="foi_requests">
- <%= @is_you ? n_('Your %d Freedom of Information request', 'Your %d Freedom of Information requests', @xapian_requests.matches_estimated) % @xapian_requests.matches_estimated.to_s : n_('This person\'s %d Freedom of Information request', 'This person\'s %d Freedom of Information requests', @xapian_requests.matches_estimated) % @xapian_requests.matches_estimated %>
+ <%= @is_you ? n_('Your {{count}} Freedom of Information request', 'Your {{count}} Freedom of Information requests', @xapian_requests.matches_estimated, :count => @xapian_requests.matches_estimated) : n_("This person's {{count}} Freedom of Information request", "This person's {{count}} Freedom of Information requests", @xapian_requests.matches_estimated, :count => @xapian_requests.matches_estimated) %>
<!-- matches_estimated <%=@xapian_requests.matches_estimated%> -->
<%= @match_phrase %>
<%= @page_desc %>
@@ -158,7 +158,7 @@
<% end %>
<% else %>
<h2 id="annotations">
- <%= @is_you ? n_('Your %d annotation', 'Your %d annotations', @display_user.visible_comments.size) % @display_user.visible_comments.size : n_('This person\'s %d annotation', 'This person\'s %d annotations', @display_user.visible_comments.size) % @display_user.visible_comments.size %>
+ <%= @is_you ? n_('Your {{count}} annotation', 'Your {{count}} annotations', @display_user.visible_comments.size, :count => @display_user.visible_comments.size) : n_("This person's {{count}} annotation", "This person's {{count}} annotations", @display_user.visible_comments.size, :count => @display_user.visible_comments.size) %>
<!-- matches_estimated <%=@xapian_comments.matches_estimated%> -->
<%= @page_desc %>
</h2>
diff --git a/app/views/user/wrong_user_unknown_email.html.erb b/app/views/user/wrong_user_unknown_email.html.erb
index c59c56941..c1967fc1f 100644
--- a/app/views/user/wrong_user_unknown_email.html.erb
+++ b/app/views/user/wrong_user_unknown_email.html.erb
@@ -1,8 +1,8 @@
<p id="sign_in_reason">
-<%= @reason_params[:web] %>. <%= raw(_('Unfortunately we don\'t know the FOI
+<%= @reason_params[:web] %>. <%= _('Unfortunately we don\'t know the FOI
email address for that authority, so we can\'t validate this.
-Please <a href="%s">contact us</a> to sort it out.') % [help_contact_path]) %>
+Please <a href="{{url}}">contact us</a> to sort it out.', :url => help_contact_path.html_safe) %>
</p>