aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin_public_body_controller.rb10
-rw-r--r--app/controllers/general_controller.rb2
-rw-r--r--app/controllers/public_body_controller.rb6
-rw-r--r--app/controllers/request_controller.rb12
-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/models/public_body.rb53
-rw-r--r--app/models/track_mailer.rb7
-rw-r--r--app/models/user.rb7
-rw-r--r--app/views/admin_request/show.rhtml6
-rw-r--r--app/views/comment/_comment_form.rhtml2
-rw-r--r--app/views/general/_frontpage_bodies_list.rhtml2
-rw-r--r--app/views/general/search.rhtml14
-rw-r--r--app/views/public_body/_body_listing_single.rhtml3
-rw-r--r--app/views/public_body/_list_sidebar_extra.rhtml2
-rw-r--r--app/views/public_body/list.rhtml16
-rw-r--r--app/views/public_body/show.rhtml17
-rw-r--r--app/views/public_body/view_email.rhtml6
-rw-r--r--app/views/request/_after_actions.rhtml2
-rw-r--r--app/views/request/_followup.rhtml15
-rw-r--r--app/views/request/_hidden_correspondence.rhtml12
-rw-r--r--app/views/request/_sidebar.rhtml16
-rw-r--r--app/views/request/followup_bad.rhtml12
-rw-r--r--app/views/request/hidden.rhtml6
-rw-r--r--app/views/request/new.rhtml11
-rw-r--r--app/views/request/new_please_describe.rhtml2
-rw-r--r--app/views/request/preview.rhtml12
-rw-r--r--app/views/request/select_authority.rhtml16
-rw-r--r--app/views/request/show.rhtml8
-rw-r--r--app/views/request/show_response.rhtml4
-rw-r--r--app/views/request/upload_response.rhtml4
-rw-r--r--app/views/user/_signup.rhtml12
-rw-r--r--app/views/user/no_cookies.rhtml4
-rw-r--r--app/views/user/show.rhtml6
-rw-r--r--app/views/user/wrong_user_unknown_email.rhtml4
36 files changed, 174 insertions, 152 deletions
diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb
index bb5e98852..93715d364 100644
--- a/app/controllers/admin_public_body_controller.rb
+++ b/app/controllers/admin_public_body_controller.rb
@@ -14,7 +14,7 @@ class AdminPublicBodyController < AdminController
def _lookup_query_internal
@locale = self.locale_from_params()
- PublicBody.with_locale(@locale) do
+ I18n.with_locale(@locale) do
@query = params[:query]
if @query == ""
@query = nil
@@ -75,7 +75,7 @@ class AdminPublicBodyController < AdminController
def show
@locale = self.locale_from_params()
- PublicBody.with_locale(@locale) do
+ I18n.with_locale(@locale) do
@public_body = PublicBody.find(params[:id])
render
end
@@ -87,7 +87,7 @@ class AdminPublicBodyController < AdminController
end
def create
- PublicBody.with_locale(I18n.default_locale) do
+ I18n.with_locale(I18n.default_locale) do
params[:public_body][:last_edit_editor] = admin_current_user()
@public_body = PublicBody.new(params[:public_body])
if @public_body.save
@@ -106,7 +106,7 @@ class AdminPublicBodyController < AdminController
end
def update
- PublicBody.with_locale(I18n.default_locale) do
+ I18n.with_locale(I18n.default_locale) do
params[:public_body][:last_edit_editor] = admin_current_user()
@public_body = PublicBody.find(params[:id])
if @public_body.update_attributes(params[:public_body])
@@ -120,7 +120,7 @@ class AdminPublicBodyController < AdminController
def destroy
@locale = self.locale_from_params()
- PublicBody.with_locale(@locale) do
+ I18n.with_locale(@locale) do
public_body = PublicBody.find(params[:id])
if public_body.info_requests.size > 0
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index f6a46458e..0783fc579 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -25,7 +25,7 @@ class GeneralController < ApplicationController
@locale = self.locale_from_params()
locale_condition = 'public_body_translations.locale = ?'
conditions = [locale_condition, @locale]
- PublicBody.with_locale(@locale) do
+ I18n.with_locale(@locale) do
if body_short_names.empty?
# This is too slow
@popular_bodies = PublicBody.visible.find(:all,
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb
index aa6980b69..1821e6725 100644
--- a/app/controllers/public_body_controller.rb
+++ b/app/controllers/public_body_controller.rb
@@ -16,7 +16,7 @@ class PublicBodyController < ApplicationController
return
end
@locale = self.locale_from_params()
- PublicBody.with_locale(@locale) do
+ I18n.with_locale(@locale) do
@public_body = PublicBody.find_by_url_name_with_historic(params[:url_name])
raise ActiveRecord::RecordNotFound.new("None found") if @public_body.nil?
if @public_body.url_name.nil?
@@ -69,7 +69,7 @@ class PublicBodyController < ApplicationController
@public_body = PublicBody.find_by_url_name_with_historic(params[:url_name])
raise ActiveRecord::RecordNotFound.new("None found") if @public_body.nil?
- PublicBody.with_locale(self.locale_from_params()) do
+ I18n.with_locale(self.locale_from_params()) do
if params[:submitted_view_email]
if verify_recaptcha
flash.discard(:error)
@@ -127,7 +127,7 @@ class PublicBodyController < ApplicationController
@description = _("in the category ‘{{category_name}}’", :category_name=>category_name)
end
end
- PublicBody.with_locale(@locale) do
+ I18n.with_locale(@locale) do
@public_bodies = PublicBody.paginate(
:order => "public_body_translations.name", :page => params[:page], :per_page => 100,
:conditions => conditions,
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index ec5c9d055..e82871d7b 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -52,7 +52,7 @@ class RequestController < ApplicationController
medium_cache
end
@locale = self.locale_from_params()
- PublicBody.with_locale(@locale) do
+ I18n.with_locale(@locale) do
# Look up by old style numeric identifiers
if params[:url_title].match(/^[0-9]+$/)
@@ -321,9 +321,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>")
@@ -624,7 +624,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.')
@@ -811,7 +811,7 @@ class RequestController < ApplicationController
# FOI officers can upload a response
def upload_response
@locale = self.locale_from_params()
- PublicBody.with_locale(@locale) do
+ I18n.with_locale(@locale) do
@info_request = InfoRequest.find_by_url_title!(params[:url_title])
@reason_params = {
@@ -868,7 +868,7 @@ class RequestController < ApplicationController
def download_entire_request
@locale = self.locale_from_params()
- PublicBody.with_locale(@locale) do
+ I18n.with_locale(@locale) do
@info_request = InfoRequest.find_by_url_title!(params[:url_title])
# Test for whole request being hidden or requester-only
if !@info_request.all_can_view?
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 237364f56..eaed25a61 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -474,6 +474,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 c75894e6a..248125808 100644
--- a/app/models/outgoing_message.rb
+++ b/app/models/outgoing_message.rb
@@ -268,7 +268,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 73d7ca12b..f6aec6338 100644
--- a/app/models/profile_photo.rb
+++ b/app/models/profile_photo.rb
@@ -101,7 +101,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/models/public_body.rb b/app/models/public_body.rb
index 168b9f4c7..b4d36fe91 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -106,28 +106,25 @@ class PublicBody < ActiveRecord::Base
# like find_by_url_name but also search historic url_name if none found
def self.find_by_url_name_with_historic(name)
- locale = self.locale || I18n.locale
- PublicBody.with_locale(locale) do
- found = PublicBody.find(:all,
- :conditions => ["public_body_translations.url_name=?", name],
- :joins => :translations,
- :readonly => false)
- # If many bodies are found (usually because the url_name is the same across
- # locales) return any of them
- return found.first if found.size >= 1
-
- # If none found, then search the history of short names
- old = PublicBody::Version.find_all_by_url_name(name)
- # Find unique public bodies in it
- old = old.map { |x| x.public_body_id }
- old = old.uniq
- # Maybe return the first one, so we show something relevant,
- # rather than throwing an error?
- raise "Two bodies with the same historical URL name: #{name}" if old.size > 1
- return unless old.size == 1
- # does acts_as_versioned provide a method that returns the current version?
- return PublicBody.find(old.first)
- end
+ found = PublicBody.find(:all,
+ :conditions => ["public_body_translations.url_name=?", name],
+ :joins => :translations,
+ :readonly => false)
+ # If many bodies are found (usually because the url_name is the same across
+ # locales) return any of them
+ return found.first if found.size >= 1
+
+ # If none found, then search the history of short names
+ old = PublicBody::Version.find_all_by_url_name(name)
+ # Find unique public bodies in it
+ old = old.map { |x| x.public_body_id }
+ old = old.uniq
+ # Maybe return the first one, so we show something relevant,
+ # rather than throwing an error?
+ raise "Two bodies with the same historical URL name: #{name}" if old.size > 1
+ return unless old.size == 1
+ # does acts_as_versioned provide a method that returns the current version?
+ return PublicBody.find(old.first)
end
# Set the first letter, which is used for faster queries
@@ -243,13 +240,13 @@ class PublicBody < ActiveRecord::Base
# When name or short name is changed, also change the url name
def short_name=(short_name)
- globalize.write(self.class.locale || I18n.locale, :short_name, short_name)
+ globalize.write(I18n.locale, :short_name, short_name)
self[:short_name] = short_name
self.update_url_name
end
def name=(name)
- globalize.write(self.class.locale || I18n.locale, :name, name)
+ globalize.write(I18n.locale, :name, name)
self[:name] = name
self.update_url_name
end
@@ -329,7 +326,7 @@ class PublicBody < ActiveRecord::Base
# The "internal admin" is a special body for internal use.
def PublicBody.internal_admin_body
- PublicBody.with_locale(I18n.default_locale) do
+ I18n.with_locale(I18n.default_locale) do
pb = PublicBody.find_by_url_name("internal_admin_authority")
if pb.nil?
pb = PublicBody.new(
@@ -367,7 +364,7 @@ class PublicBody < ActiveRecord::Base
# of updating them
bodies_by_name = {}
set_of_existing = Set.new()
- PublicBody.with_locale(I18n.default_locale) do
+ I18n.with_locale(I18n.default_locale) do
bodies = (tag.nil? || tag.empty?) ? PublicBody.find(:all) : PublicBody.find_by_tag(tag)
for existing_body in bodies
# Hide InternalAdminBody from import notes
@@ -410,7 +407,7 @@ class PublicBody < ActiveRecord::Base
if public_body = bodies_by_name[name] # Existing public body
available_locales.each do |locale|
- PublicBody.with_locale(locale) do
+ I18n.with_locale(locale) do
changed = ActiveSupport::OrderedHash.new
field_list.each do |field_name|
localized_field_name = (locale.to_s == I18n.default_locale.to_s) ? field_name : "#{field_name}.#{locale}"
@@ -445,7 +442,7 @@ class PublicBody < ActiveRecord::Base
else # New public body
public_body = PublicBody.new(:name=>"", :short_name=>"", :request_email=>"")
available_locales.each do |locale|
- PublicBody.with_locale(locale) do
+ I18n.with_locale(locale) do
changed = ActiveSupport::OrderedHash.new
field_list.each do |field_name|
localized_field_name = (locale.to_s == I18n.default_locale.to_s) ? field_name : "#{field_name}.#{locale}"
diff --git a/app/models/track_mailer.rb b/app/models/track_mailer.rb
index 51440e4d7..7262c82f3 100644
--- a/app/models/track_mailer.rb
+++ b/app/models/track_mailer.rb
@@ -91,10 +91,9 @@ class TrackMailer < ApplicationMailer
if email_about_things.size > 0
# Send the email
- previous_locale = I18n.locale
- I18n.locale = user.get_locale
- TrackMailer.deliver_event_digest(user, email_about_things)
- I18n.locale = previous_locale
+ I18n.with_locale(user.get_locale) do
+ TrackMailer.deliver_event_digest(user, email_about_things)
+ end
end
# Record that we've now sent those alerts to that user
diff --git a/app/models/user.rb b/app/models/user.rb
index e6c666e47..612ac7fa2 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -98,12 +98,7 @@ class User < ActiveRecord::Base
end
def get_locale
- if !self.locale.nil?
- locale = self.locale
- else
- locale = I18n.locale
- end
- return locale.to_s
+ (self.locale || I18n.locale).to_s
end
def visible_comments
diff --git a/app/views/admin_request/show.rhtml b/app/views/admin_request/show.rhtml
index 8606d21fa..2b37e8afb 100644
--- a/app/views/admin_request/show.rhtml
+++ b/app/views/admin_request/show.rhtml
@@ -207,7 +207,7 @@
</td>
<td>
<% if column_name == 'params_yaml' %>
- <%= info_request_event.params_yaml_as_html %>
+ <%= info_request_event.params_yaml_as_html.html_safe %>
<% elsif value.nil? %>
nil
<% elsif %w(text string).include?(type) %>
@@ -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) %>
diff --git a/app/views/comment/_comment_form.rhtml b/app/views/comment/_comment_form.rhtml
index 120929643..d834b5b90 100644
--- a/app/views/comment/_comment_form.rhtml
+++ b/app/views/comment/_comment_form.rhtml
@@ -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.rhtml b/app/views/general/_frontpage_bodies_list.rhtml
index 54400602b..75daea41d 100644
--- a/app/views/general/_frontpage_bodies_list.rhtml
+++ b/app/views/general/_frontpage_bodies_list.rhtml
@@ -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.rhtml b/app/views/general/search.rhtml
index 50f9f9286..df114782f 100644
--- a/app/views/general/search.rhtml
+++ b/app/views/general/search.rhtml
@@ -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.rhtml b/app/views/public_body/_body_listing_single.rhtml
index d0496fbb8..8e0a64df7 100644
--- a/app/views/public_body/_body_listing_single.rhtml
+++ b/app/views/public_body/_body_listing_single.rhtml
@@ -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.rhtml b/app/views/public_body/_list_sidebar_extra.rhtml
index d3d65fec8..290593d6a 100644
--- a/app/views/public_body/_list_sidebar_extra.rhtml
+++ b/app/views/public_body/_list_sidebar_extra.rhtml
@@ -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.rhtml b/app/views/public_body/list.rhtml
index ea5cd9613..34b34d550 100644
--- a/app/views/public_body/list.rhtml
+++ b/app/views/public_body/list.rhtml
@@ -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.rhtml b/app/views/public_body/show.rhtml
index df6346e4f..fa6243b47 100644
--- a/app/views/public_body/show.rhtml
+++ b/app/views/public_body/show.rhtml
@@ -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.rhtml b/app/views/public_body/view_email.rhtml
index 3799d227b..3f0a558c7 100644
--- a/app/views/public_body/view_email.rhtml
+++ b/app/views/public_body/view_email.rhtml
@@ -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.rhtml b/app/views/request/_after_actions.rhtml
index d3ddb981b..b54a8f5fb 100644
--- a/app/views/request/_after_actions.rhtml
+++ b/app/views/request/_after_actions.rhtml
@@ -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.rhtml b/app/views/request/_followup.rhtml
index bccfccca7..3776980a0 100644
--- a/app/views/request/_followup.rhtml
+++ b/app/views/request/_followup.rhtml
@@ -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.rhtml b/app/views/request/_hidden_correspondence.rhtml
index 0873b312f..a08c1badf 100644
--- a/app/views/request/_hidden_correspondence.rhtml
+++ b/app/views/request/_hidden_correspondence.rhtml
@@ -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.request_uri)]) %>
+ <%= _('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.request_uri).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.request_uri)]) %>
+ <%= _('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.request_uri).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.request_uri)]) %>
+ <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.request_uri).html_safe) %>
</p>
</div>
<% end %>
diff --git a/app/views/request/_sidebar.rhtml b/app/views/request/_sidebar.rhtml
index af33d31a2..c7d21d867 100644
--- a/app/views/request/_sidebar.rhtml
+++ b/app/views/request/_sidebar.rhtml
@@ -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.rhtml %>
- <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>
@@ -65,7 +70,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.rhtml b/app/views/request/followup_bad.rhtml
index c892263e6..ea2400c5d 100644
--- a/app/views/request/followup_bad.rhtml
+++ b/app/views/request/followup_bad.rhtml
@@ -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.rhtml b/app/views/request/hidden.rhtml
index 2d038a663..4190fb47c 100644
--- a/app/views/request/hidden.rhtml
+++ b/app/views/request/hidden.rhtml
@@ -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.request_uri)]) %>
+ <%= _('If you are the requester, then you may <a href="{{url}}">sign in</a> to view the request.', :url => signin_url(:r => request.request_uri).html_safe) %>
</p>
<% end %>
diff --git a/app/views/request/new.rhtml b/app/views/request/new.rhtml
index 4766c981b..0790bd0ac 100644
--- a/app/views/request/new.rhtml
+++ b/app/views/request/new.rhtml
@@ -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.rhtml b/app/views/request/new_please_describe.rhtml
index ff27405b8..808fbb206 100644
--- a/app/views/request/new_please_describe.rhtml
+++ b/app/views/request/new_please_describe.rhtml
@@ -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.request_uri]) %>
+ <%= _('When you\'re done, <strong>come back here</strong>, <a href="{{url}}">reload this page</a> and file your new request.', :url => request.request_uri.html_safe) %>
</p>
<p>
diff --git a/app/views/request/preview.rhtml b/app/views/request/preview.rhtml
index 8d1fd753e..424277b50 100644
--- a/app/views/request/preview.rhtml
+++ b/app/views/request/preview.rhtml
@@ -1,12 +1,12 @@
<% @title = "Preview new " + h(@info_request.law_used_short) + " request to '" + h(@info_request.public_body.name) + "'" %>
<% form_for(:info_request, @info_request, :html => { :id => 'preview_form' } ) do |f| %>
-
+
<h1><%= _('3. Now check your request') %></h1>
<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.rhtml b/app/views/request/select_authority.rhtml
index 94e690e64..737541872 100644
--- a/app/views/request/select_authority.rhtml
+++ b/app/views/request/select_authority.rhtml
@@ -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.rhtml b/app/views/request/show.rhtml
index ef49ef958..a33bc7037 100644
--- a/app/views/request/show.rhtml
+++ b/app/views/request/show.rhtml
@@ -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.rhtml b/app/views/request/show_response.rhtml
index ac1f04227..a61359679 100644
--- a/app/views/request/show_response.rhtml
+++ b/app/views/request/show_response.rhtml
@@ -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.rhtml b/app/views/request/upload_response.rhtml
index 675951595..f9f818e86 100644
--- a/app/views/request/upload_response.rhtml
+++ b/app/views/request/upload_response.rhtml
@@ -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.rhtml b/app/views/user/_signup.rhtml
index 89ab19b7e..eba3b8522 100644
--- a/app/views/user/_signup.rhtml
+++ b/app/views/user/_signup.rhtml
@@ -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.rhtml b/app/views/user/no_cookies.rhtml
index c291367f2..0a4a39b1b 100644
--- a/app/views/user/no_cookies.rhtml
+++ b/app/views/user/no_cookies.rhtml
@@ -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.rhtml b/app/views/user/show.rhtml
index a3dea619d..c538426ce 100644
--- a/app/views/user/show.rhtml
+++ b/app/views/user/show.rhtml
@@ -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.request_uri)]) %>
+ <%= _('<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.request_uri).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.rhtml b/app/views/user/wrong_user_unknown_email.rhtml
index c59c56941..c1967fc1f 100644
--- a/app/views/user/wrong_user_unknown_email.rhtml
+++ b/app/views/user/wrong_user_unknown_email.rhtml
@@ -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>