aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin_censor_rule_controller.rb2
-rw-r--r--app/controllers/admin_controller.rb2
-rw-r--r--app/controllers/admin_general_controller.rb2
-rw-r--r--app/controllers/admin_public_body_controller.rb2
-rw-r--r--app/controllers/admin_request_controller.rb2
-rw-r--r--app/controllers/admin_track_controller.rb2
-rw-r--r--app/controllers/admin_user_controller.rb2
-rw-r--r--app/controllers/application_controller.rb61
-rw-r--r--app/controllers/comment_controller.rb2
-rw-r--r--app/controllers/general_controller.rb21
-rw-r--r--app/controllers/help_controller.rb2
-rw-r--r--app/controllers/holiday_controller.rb2
-rw-r--r--app/controllers/public_body_controller.rb2
-rw-r--r--app/controllers/request_controller.rb21
-rw-r--r--app/controllers/request_game_controller.rb2
-rw-r--r--app/controllers/track_controller.rb4
-rw-r--r--app/controllers/user_controller.rb6
-rw-r--r--app/helpers/application_helper.rb2
-rwxr-xr-xapp/helpers/link_to_helper.rb4
-rw-r--r--app/mailers/application_mailer.rb34
-rw-r--r--app/mailers/contact_mailer.rb2
-rw-r--r--app/mailers/outgoing_mailer.rb2
-rw-r--r--app/mailers/request_mailer.rb4
-rw-r--r--app/mailers/track_mailer.rb2
-rw-r--r--app/mailers/user_mailer.rb2
-rw-r--r--app/models/about_me_validator.rb2
-rw-r--r--app/models/censor_rule.rb2
-rw-r--r--app/models/change_email_validator.rb2
-rw-r--r--app/models/comment.rb2
-rw-r--r--app/models/contact_validator.rb2
-rw-r--r--app/models/foi_attachment.rb9
-rw-r--r--app/models/holiday.rb2
-rw-r--r--app/models/incoming_message.rb55
-rw-r--r--app/models/info_request.rb53
-rw-r--r--app/models/info_request_event.rb2
-rw-r--r--app/models/mail_server_log.rb4
-rw-r--r--app/models/mail_server_log_done.rb2
-rw-r--r--app/models/outgoing_message.rb26
-rw-r--r--app/models/post_redirect.rb2
-rw-r--r--app/models/profile_photo.rb4
-rw-r--r--app/models/purge_request.rb2
-rw-r--r--app/models/raw_email.rb2
-rw-r--r--app/models/track_thing.rb2
-rw-r--r--app/models/track_things_sent_email.rb2
-rw-r--r--app/models/user.rb2
-rw-r--r--app/models/user_info_request_sent_alert.rb2
-rw-r--r--app/views/admin_censor_rule/new.html.erb2
-rw-r--r--app/views/admin_request/hidden_user_explanation.html.erb10
-rw-r--r--app/views/admin_request/show.html.erb10
-rw-r--r--app/views/admin_user/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/_search_ahead.html.erb5
-rw-r--r--app/views/public_body/list.html.erb16
-rw-r--r--app/views/public_body/show.html.erb22
-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.erb20
-rw-r--r--app/views/request/_wall_listing.html.erb2
-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.erb4
-rw-r--r--app/views/request/preview.html.erb10
-rw-r--r--app/views/request/select_authority.html.erb37
-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/set_crop_profile_photo.html.erb2
-rw-r--r--app/views/user/show.html.erb6
-rw-r--r--app/views/user/sign.html.erb2
-rw-r--r--app/views/user/wrong_user_unknown_email.html.erb4
79 files changed, 300 insertions, 345 deletions
diff --git a/app/controllers/admin_censor_rule_controller.rb b/app/controllers/admin_censor_rule_controller.rb
index d3e9e47d2..6f79b5ba1 100644
--- a/app/controllers/admin_censor_rule_controller.rb
+++ b/app/controllers/admin_censor_rule_controller.rb
@@ -2,7 +2,7 @@
# For modifying requests.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class AdminCensorRuleController < AdminController
def new
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index c4d96eb78..0bccd3358 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -2,7 +2,7 @@
# All admin controllers are dervied from this.
#
# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
require 'fileutils'
diff --git a/app/controllers/admin_general_controller.rb b/app/controllers/admin_general_controller.rb
index 800678787..b64fcac3e 100644
--- a/app/controllers/admin_general_controller.rb
+++ b/app/controllers/admin_general_controller.rb
@@ -2,7 +2,7 @@
# Controller for main admin pages.
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class AdminGeneralController < AdminController
skip_before_filter :authenticate, :only => :admin_js
diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb
index ec1848fd3..52b56eda2 100644
--- a/app/controllers/admin_public_body_controller.rb
+++ b/app/controllers/admin_public_body_controller.rb
@@ -2,7 +2,7 @@
# Controller for editing public bodies from the admin interface.
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
require "public_body_categories"
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb
index 699c79b47..66989ea93 100644
--- a/app/controllers/admin_request_controller.rb
+++ b/app/controllers/admin_request_controller.rb
@@ -2,7 +2,7 @@
# Controller for viewing FOI requests from the admin interface.
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
require 'ostruct'
diff --git a/app/controllers/admin_track_controller.rb b/app/controllers/admin_track_controller.rb
index bd0eee27b..085c9c6cc 100644
--- a/app/controllers/admin_track_controller.rb
+++ b/app/controllers/admin_track_controller.rb
@@ -2,7 +2,7 @@
# Show email alerts / RSS feeds from admin interface.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class AdminTrackController < AdminController
def list
diff --git a/app/controllers/admin_user_controller.rb b/app/controllers/admin_user_controller.rb
index e6a167de8..929b93e0e 100644
--- a/app/controllers/admin_user_controller.rb
+++ b/app/controllers/admin_user_controller.rb
@@ -2,7 +2,7 @@
# Controller for viewing user accounts from the admin interface.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class AdminUserController < AdminController
def index
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index a2951bb42..3a1ec95cc 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -5,13 +5,18 @@
# will be available for all controllers.
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
require 'open-uri'
class ApplicationController < ActionController::Base
class PermissionDenied < StandardError
end
+ class RouteNotFound < StandardError
+ end
+ # assign our own handler method for non-local exceptions
+ rescue_from Exception, :with => :render_exception
+
# Standard headers, footers and navigation for whole site
layout "default"
include FastGettext::Translation # make functions like _, n_, N_ etc available)
@@ -111,55 +116,35 @@ class ApplicationController < ActionController::Base
end
end
- # Override default error handler, for production sites.
- def rescue_action_in_public(exception)
- # Looks for before_filters called something like `set_view_paths_{themename}`. These
- # are set by the themes.
- # Normally, this is called by the theme itself in a
- # :before_filter, but when there's an error, this doesn't
- # happen. By calling it here, we can ensure error pages are
- # still styled according to the theme.
- ActionController::Base.before_filters.select{|f| f.to_s =~ /set_view_paths/}.each do |f|
- self.send(f)
- end
- # Make sure expiry time for session is set (before_filters are
- # otherwise missed by this override)
- session_remember_me
+ def render_exception(exception)
- # Make sure the locale is set correctly too
- set_gettext_locale
+ # In development, or the admin interface, or for a local request, let Rails handle the exception
+ # with its stack trace templates. Local requests in testing are a special case so that we can
+ # test this method - there we use consider_all_requests_local to control behaviour.
+ if Rails.application.config.consider_all_requests_local || local_request? ||
+ (request.local? && !Rails.env.test?)
+ raise exception
+ end
+ @exception_backtrace = exception.backtrace.join("\n")
+ @exception_class = exception.class.to_s
+ @exception_message = exception.message
case exception
- when ActiveRecord::RecordNotFound, ActionController::UnknownAction, ActionController::RoutingError
+ when ActiveRecord::RecordNotFound, RouteNotFound
@status = 404
when PermissionDenied
@status = 403
else
+ message = "\n#{@exception_class} (#{@exception_message}):\n"
+ backtrace = Rails.backtrace_cleaner.clean(exception.backtrace, :silent)
+ message << " " << backtrace.join("\n ")
+ Rails.logger.fatal("#{message}\n\n")
+ ExceptionNotifier::Notifier.exception_notification(request.env, exception).deliver
@status = 500
- notify_about_exception exception
end
- # Display user appropriate error message
- @exception_backtrace = exception.backtrace.join("\n")
- @exception_class = exception.class.to_s
- @exception_message = exception.message
render :template => "general/exception_caught", :status => @status
end
- # FIXME: This was disabled during the Rails 3 upgrade as this is now handled by Rack
- # # For development sites.
- # alias original_rescue_action_locally rescue_action_locally
- # def rescue_action_locally(exception)
- # # Make sure expiry time for session is set (before_filters are
- # # otherwise missed by this override)
- # session_remember_me
-
- # # Make sure the locale is set correctly too
- # set_gettext_locale
-
- # # Display default, detailed error for developers
- # original_rescue_action_locally(exception)
- # end
-
def local_request?
false
end
diff --git a/app/controllers/comment_controller.rb b/app/controllers/comment_controller.rb
index ed249d6cc..d4b17e9d2 100644
--- a/app/controllers/comment_controller.rb
+++ b/app/controllers/comment_controller.rb
@@ -2,7 +2,7 @@
# Show annotations upon a request or other object.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class CommentController < ApplicationController
before_filter :check_read_only, :only => [ :new ]
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index 53cf58170..52b4b3e0e 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -3,14 +3,7 @@
# particular model.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
-
-begin
- require 'xmlsimple'
-rescue LoadError
- # Debian maintainers put their xmlsimple in a different location :(
- require 'lib/xmlsimple'
-end
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
require 'open-uri'
@@ -216,16 +209,16 @@ class GeneralController < ApplicationController
@feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ]
end
- # Jump to a random request
- def random_request
- info_request = InfoRequest.random
- redirect_to request_url(info_request)
- end
-
def custom_css
long_cache
@locale = self.locale_from_params()
render(:layout => false, :content_type => 'text/css')
end
+
+ # Handle requests for non-existent URLs - will be handled by ApplicationController::render_exception
+ def not_found
+ raise RouteNotFound
+ end
+
end
diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb
index 5ab44fe1a..9959df6d8 100644
--- a/app/controllers/help_controller.rb
+++ b/app/controllers/help_controller.rb
@@ -2,7 +2,7 @@
# Show information about one particular request.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class HelpController < ApplicationController
diff --git a/app/controllers/holiday_controller.rb b/app/controllers/holiday_controller.rb
index 939f26776..efc20701d 100644
--- a/app/controllers/holiday_controller.rb
+++ b/app/controllers/holiday_controller.rb
@@ -2,7 +2,7 @@
# Calculate dates
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class HolidayController < ApplicationController
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb
index 8d4883938..74ea043bb 100644
--- a/app/controllers/public_body_controller.rb
+++ b/app/controllers/public_body_controller.rb
@@ -3,7 +3,7 @@
# Show information about a public body.
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
require 'fastercsv'
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index cad5d5597..e8547f72f 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -1,10 +1,10 @@
+# encoding: UTF-8
# app/controllers/request_controller.rb:
# Show information about one particular request.
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
-require 'alaveteli_file_types'
require 'zip/zip'
require 'open-uri'
@@ -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.')
@@ -721,7 +721,7 @@ class RequestController < ApplicationController
yield
- if params[:skip_cache].nil?
+ if params[:skip_cache].nil? && response.status == 200
# write it to the fileystem ourselves, so is just a plain file. (The
# various fragment cache functions using Ruby Marshall to write the file
# which adds a header, so isnt compatible with images that have been
@@ -736,6 +736,7 @@ class RequestController < ApplicationController
def get_attachment
get_attachment_internal(false)
+ return unless @attachment
# Prevent spam to magic request address. Note that the binary
# subsitution method used depends on the content type
@@ -755,6 +756,7 @@ class RequestController < ApplicationController
raise ActiveRecord::RecordNotFound.new("Attachment HTML not found.")
end
get_attachment_internal(true)
+ return unless @attachment
# images made during conversion (e.g. images in PDF files) are put in the cache directory, so
# the same cache code in cache_attachments above will display them.
@@ -801,8 +803,11 @@ class RequestController < ApplicationController
# check permissions
raise "internal error, pre-auth filter should have caught this" if !@info_request.user_can_view?(authenticated_user)
- @attachment = IncomingMessage.get_attachment_by_url_part_number(@incoming_message.get_attachments_for_display, @part_number)
- raise ActiveRecord::RecordNotFound.new("attachment not found part number " + @part_number.to_s + " incoming_message " + @incoming_message.id.to_s) if @attachment.nil?
+ @attachment = IncomingMessage.get_attachment_by_url_part_number_and_filename(@incoming_message.get_attachments_for_display, @part_number, @original_filename)
+ # If we can't find the right attachment, redirect to the incoming message:
+ unless @attachment
+ return redirect_to incoming_message_url(@incoming_message), :status => 303
+ end
# check filename in URL matches that in database (use a censor rule if you want to change a filename)
raise ActiveRecord::RecordNotFound.new("please use same filename as original file has, display: '" + @attachment.display_filename + "' old_display: '" + @attachment.old_display_filename + "' original: '" + @original_filename + "'") if @attachment.display_filename != @original_filename && @attachment.old_display_filename != @original_filename
diff --git a/app/controllers/request_game_controller.rb b/app/controllers/request_game_controller.rb
index 4b6f02970..6eac399ac 100644
--- a/app/controllers/request_game_controller.rb
+++ b/app/controllers/request_game_controller.rb
@@ -2,7 +2,7 @@
# The 'categorise old requests' game
#
# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class RequestGameController < ApplicationController
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb
index 2679cacc9..40e82e7a4 100644
--- a/app/controllers/track_controller.rb
+++ b/app/controllers/track_controller.rb
@@ -3,7 +3,7 @@
# social bookmarking.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class TrackController < ApplicationController
@@ -157,7 +157,7 @@ class TrackController < ApplicationController
format.json { render :json => @xapian_object.results.map { |r| r[:model].json_for_api(true,
lambda { |t| view_context.highlight_and_excerpt(t, @xapian_object.words_to_highlight, 150) }
) } }
- format.any { render :template => 'track/atom_feed.atom', :layout => false, :content_type => :atom }
+ format.any { render :template => 'track/atom_feed.atom', :layout => false, :content_type => 'application/atom+xml' }
end
end
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index ed05b750b..1ccab3003 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -2,7 +2,7 @@
# Show information about a user.
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
require 'set'
@@ -531,7 +531,7 @@ class UserController < ApplicationController
def get_draft_profile_photo
profile_photo = ProfilePhoto.find(params[:id])
response.content_type = "image/png"
- render_for_text(profile_photo.data)
+ render :text => profile_photo.data
end
# actual profile photo of a user
@@ -546,7 +546,7 @@ class UserController < ApplicationController
end
response.content_type = "image/png"
- render_for_text(@display_user.profile_photo.data)
+ render :text => @display_user.profile_photo.data
end
# Change about me text on your profile page
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 42f9d30f1..e3b1e57ac 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -3,7 +3,7 @@
# in the application.
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
require 'languages'
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb
index ffa34e345..238a36ce4 100755
--- a/app/helpers/link_to_helper.rb
+++ b/app/helpers/link_to_helper.rb
@@ -3,7 +3,7 @@
# -
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
module LinkToHelper
@@ -36,7 +36,7 @@ module LinkToHelper
end
def outgoing_message_url(outgoing_message, options = {})
- return request_path(outgoing_message.info_request, options.merge(:anchor => "outgoing-#{outgoing_message.id}"))
+ request_url(outgoing_message.info_request, options.merge(:anchor => "outgoing-#{outgoing_message.id}"))
end
def outgoing_message_path(outgoing_message)
diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb
index e4178081f..d2230bb82 100644
--- a/app/mailers/application_mailer.rb
+++ b/app/mailers/application_mailer.rb
@@ -2,7 +2,7 @@
# Shared code between different mailers.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
require 'action_mailer/version'
class ApplicationMailer < ActionMailer::Base
@@ -26,37 +26,5 @@ class ApplicationMailer < ActionMailer::Base
# Site-wide access to configuration settings
include ConfigHelper
- # For each multipart template (e.g. "the_template_file.text.html.erb") available,
- # add the one from the view path with the highest priority as a part to the mail
- def render_multipart_templates
- added_content_types = {}
- self.view_paths.each do |view_path|
- Dir.glob("#{view_path}/#{mailer_name}/#{@template}.*").each do |path|
- template = view_path["#{mailer_name}/#{File.basename(path)}"]
-
- # Skip unless template has a multipart format
- next unless template && template.multipart?
- next if added_content_types[template.content_type] == true
- @parts << Part.new(
- :content_type => template.content_type,
- :disposition => "inline",
- :charset => charset,
- :body => render_message(template, @body)
- )
- added_content_types[template.content_type] = true
- end
- end
- end
-
- # Look for the current template in each element of view_paths in order,
- # return the first
- def find_template
- self.view_paths.each do |view_path|
- if template = view_path["#{mailer_name}/#{@template}"]
- return template
- end
- end
- return nil
- end
end
diff --git a/app/mailers/contact_mailer.rb b/app/mailers/contact_mailer.rb
index 383f1a6e6..4dc49bf8b 100644
--- a/app/mailers/contact_mailer.rb
+++ b/app/mailers/contact_mailer.rb
@@ -2,7 +2,7 @@
# Sends contact form mails.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class ContactMailer < ApplicationMailer
# Send message to administrator
diff --git a/app/mailers/outgoing_mailer.rb b/app/mailers/outgoing_mailer.rb
index c602359de..083c05a7c 100644
--- a/app/mailers/outgoing_mailer.rb
+++ b/app/mailers/outgoing_mailer.rb
@@ -2,7 +2,7 @@
# Emails which go to public bodies on behalf of users.
#
# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
# Note: The layout for this wraps messages by lines rather than (blank line
# separated) paragraphs, as is the convention for all the other mailers. This
diff --git a/app/mailers/request_mailer.rb b/app/mailers/request_mailer.rb
index 6102bd9d2..4dbce6738 100644
--- a/app/mailers/request_mailer.rb
+++ b/app/mailers/request_mailer.rb
@@ -2,9 +2,7 @@
# Alerts relating to requests.
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
-
-require 'alaveteli_file_types'
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class RequestMailer < ApplicationMailer
# Used when an FOI officer uploads a response from their web browser - this is
diff --git a/app/mailers/track_mailer.rb b/app/mailers/track_mailer.rb
index bd9ce658d..1bd8a7e23 100644
--- a/app/mailers/track_mailer.rb
+++ b/app/mailers/track_mailer.rb
@@ -2,7 +2,7 @@
# Emails which go to users who are tracking things.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class TrackMailer < ApplicationMailer
def event_digest(user, email_about_things)
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb
index d9d15ec68..a351147f9 100644
--- a/app/mailers/user_mailer.rb
+++ b/app/mailers/user_mailer.rb
@@ -2,7 +2,7 @@
# Emails relating to user accounts. e.g. Confirming a new account
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class UserMailer < ApplicationMailer
def confirm_login(user, reasons, url)
diff --git a/app/models/about_me_validator.rb b/app/models/about_me_validator.rb
index 1b594873c..7df70fb61 100644
--- a/app/models/about_me_validator.rb
+++ b/app/models/about_me_validator.rb
@@ -2,7 +2,7 @@
# Validates editing about me text on user profile pages.
#
# Copyright (c) 2010 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class AboutMeValidator
include ActiveModel::Validations
diff --git a/app/models/censor_rule.rb b/app/models/censor_rule.rb
index ec66074b7..f0d06e088 100644
--- a/app/models/censor_rule.rb
+++ b/app/models/censor_rule.rb
@@ -20,7 +20,7 @@
# Stores alterations to remove specific data from requests.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class CensorRule < ActiveRecord::Base
belongs_to :info_request
diff --git a/app/models/change_email_validator.rb b/app/models/change_email_validator.rb
index 00b1320a2..5cc13d4c2 100644
--- a/app/models/change_email_validator.rb
+++ b/app/models/change_email_validator.rb
@@ -2,7 +2,7 @@
# Validates email change form submissions.
#
# Copyright (c) 2010 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class ChangeEmailValidator
include ActiveModel::Validations
diff --git a/app/models/comment.rb b/app/models/comment.rb
index 70f3ba00d..9527030a9 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -18,7 +18,7 @@
# A comment by a user upon something.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class Comment < ActiveRecord::Base
strip_attributes!
diff --git a/app/models/contact_validator.rb b/app/models/contact_validator.rb
index a644de2ea..65e539669 100644
--- a/app/models/contact_validator.rb
+++ b/app/models/contact_validator.rb
@@ -2,7 +2,7 @@
# Validates contact form submissions.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class ContactValidator
include ActiveModel::Validations
diff --git a/app/models/foi_attachment.rb b/app/models/foi_attachment.rb
index a55f98b10..0340f2b83 100644
--- a/app/models/foi_attachment.rb
+++ b/app/models/foi_attachment.rb
@@ -20,7 +20,7 @@
# An attachment to an email (IncomingMessage)
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
# This is the type which is used to send data about attachments to the view
require 'digest'
@@ -71,7 +71,12 @@ class FoiAttachment < ActiveRecord::Base
tries = 0
delay = 1
begin
- @cached_body = File.open(self.filepath, "rb" ).read
+ binary_data = File.open(self.filepath, "rb" ).read
+ if self.content_type =~ /^text/
+ @cached_body = convert_string_to_utf8_or_binary(binary_data, 'UTF-8')
+ else
+ @cached_body = binary_data
+ end
rescue Errno::ENOENT
# we've lost our cached attachments for some reason. Reparse them.
if tries > BODY_MAX_TRIES
diff --git a/app/models/holiday.rb b/app/models/holiday.rb
index 13258396a..98f73e963 100644
--- a/app/models/holiday.rb
+++ b/app/models/holiday.rb
@@ -19,7 +19,7 @@
# -- Freedom of Information Act 2000 section 10
#
# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class Holiday < ActiveRecord::Base
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index c9453734c..f959a8799 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -25,18 +25,15 @@
# response from the public body.
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
# TODO
# Move some of the (e.g. quoting) functions here into rblib, as they feel
# general not specific to IncomingMessage.
-require 'alaveteli_file_types'
require 'htmlentities'
require 'rexml/document'
require 'zip/zip'
-require 'mapi/msg'
-require 'mapi/convert'
require 'iconv' unless RUBY_VERSION >= '1.9'
class IncomingMessage < ActiveRecord::Base
@@ -132,6 +129,7 @@ class IncomingMessage < ActiveRecord::Base
end
self.valid_to_reply_to = self._calculate_valid_to_reply_to
self.last_parsed = Time.now
+ self.foi_attachments reload=true
self.save!
end
end
@@ -173,15 +171,29 @@ class IncomingMessage < ActiveRecord::Base
super
end
- # And look up by URL part number to get an attachment
+ # And look up by URL part number and display filename to get an attachment
# XXX relies on extract_attachments calling MailHandler.ensure_parts_counted
- def self.get_attachment_by_url_part_number(attachments, found_url_part_number)
- attachments.each do |a|
- if a.url_part_number == found_url_part_number
- return a
+ # The filename here is passed from the URL parameter, so it's the
+ # display_filename rather than the real filename.
+ def self.get_attachment_by_url_part_number_and_filename(attachments, found_url_part_number, display_filename)
+ attachment_by_part_number = attachments.detect { |a| a.url_part_number == found_url_part_number }
+ if attachment_by_part_number && attachment_by_part_number.display_filename == display_filename
+ # Then the filename matches, which is fine:
+ attachment_by_part_number
+ else
+ # Otherwise if the URL part number and filename don't
+ # match - this is probably due to a reparsing of the
+ # email. In that case, try to find a unique matching
+ # filename from any attachment.
+ attachments_by_filename = attachments.select { |a|
+ a.display_filename == display_filename
+ }
+ if attachments_by_filename.length == 1
+ attachments_by_filename[0]
+ else
+ nil
end
end
- return nil
end
# Converts email addresses we know about into textual descriptions of them
@@ -556,9 +568,11 @@ class IncomingMessage < ActiveRecord::Base
text
end
- # Returns part which contains main body text, or nil if there isn't one
- def get_main_body_text_part
- leaves = self.foi_attachments
+ # Returns part which contains main body text, or nil if there isn't one,
+ # from a set of foi_attachments. If the leaves parameter is empty or not
+ # supplied, uses its own foi_attachments.
+ def get_main_body_text_part(leaves=[])
+ leaves = self.foi_attachments if leaves.empty?
# Find first part which is text/plain or text/html
# (We have to include HTML, as increasingly there are mail clients that
@@ -592,6 +606,7 @@ class IncomingMessage < ActiveRecord::Base
# nil in this case)
return p
end
+
# Returns attachments that are uuencoded in main body part
def _uudecode_and_save_attachments(text)
# Find any uudecoded things buried in it, yeuchly
@@ -645,12 +660,16 @@ class IncomingMessage < ActiveRecord::Base
attachment = self.foi_attachments.find_or_create_by_hexdigest(attrs[:hexdigest])
attachment.update_attributes(attrs)
attachment.save!
- attachments << attachment.id
+ attachments << attachment
end
+
# Reload to refresh newly created foi_attachments
self.reload
- main_part = get_main_body_text_part
+ # get the main body part from the set of attachments we just created,
+ # not from the self.foi_attachments association - some of the total set of
+ # self.foi_attachments may now be obsolete
+ main_part = get_main_body_text_part(attachments)
# we don't use get_main_body_text_internal, as we want to avoid charset
# conversions, since /usr/bin/uudecode needs to deal with those.
# e.g. for https://secure.mysociety.org/admin/foi/request/show_raw_email/24550
@@ -661,12 +680,14 @@ class IncomingMessage < ActiveRecord::Base
c += 1
uudecode_attachment.url_part_number = c
uudecode_attachment.save!
- attachments << uudecode_attachment.id
+ attachments << uudecode_attachment
end
end
+ attachment_ids = attachments.map{ |attachment| attachment.id }
# now get rid of any attachments we no longer have
- FoiAttachment.destroy_all("id NOT IN (#{attachments.join(',')}) AND incoming_message_id = #{self.id}")
+ FoiAttachment.destroy_all(["id NOT IN (?) AND incoming_message_id = ?",
+ attachment_ids, self.id])
end
# Returns body text as HTML with quotes flattened, and emails removed.
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 499fb20a9..553bb2436 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -325,7 +325,10 @@ public
# copying an email, and that doesn't matter)
def InfoRequest.find_by_incoming_email(incoming_email)
id, hash = InfoRequest._extract_id_hash_from_email(incoming_email)
- return self.find_by_magic_email(id, hash)
+ if hash_from_id(id) == hash
+ # Not using find(id) because we don't exception raised if nothing found
+ find_by_id(id)
+ end
end
# Return list of info requests which *might* be right given email address
@@ -452,6 +455,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
@@ -876,24 +890,6 @@ public
return Digest::SHA1.hexdigest(id.to_s + AlaveteliConfiguration::incoming_email_secret)[0,8]
end
- # Called by find_by_incoming_email - and used to be called by separate
- # function for envelope from address, until we abandoned it.
- def InfoRequest.find_by_magic_email(id, hash)
- expected_hash = InfoRequest.hash_from_id(id)
- #print "expected: " + expected_hash + "\nhash: " + hash + "\n"
- if hash != expected_hash
- return nil
- else
- begin
- return self.find(id)
- rescue ActiveRecord::RecordNotFound
- # so error email is sent to admin, rather than the exception sending weird
- # error to the public body.
- return nil
- end
- end
- end
-
# Used to find when event last changed
def InfoRequest.last_event_time_clause(event_type=nil)
event_type_clause = ''
@@ -1044,25 +1040,6 @@ public
InfoRequest.update_all "allow_new_responses_from = 'nobody' where updated_at < (now() - interval '1 year') and allow_new_responses_from in ('anybody', 'authority_only') and url_title <> 'holding_pen'"
end
- # Returns a random FOI request
- def InfoRequest.random
- max_id = InfoRequest.connection.select_value('select max(id) as a from info_requests').to_i
- info_request = nil
- count = 0
- while info_request.nil?
- if count > 100
- return nil
- end
- id = rand(max_id) + 1
- begin
- count += 1
- info_request = find(id, :conditions => ["prominence = 'normal'"])
- rescue ActiveRecord::RecordNotFound
- end
- end
- return info_request
- end
-
def json_for_api(deep)
ret = {
:id => self.id,
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index b52bb371e..469aabc4a 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -20,7 +20,7 @@
# models/info_request_event.rb:
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class InfoRequestEvent < ActiveRecord::Base
belongs_to :info_request
diff --git a/app/models/mail_server_log.rb b/app/models/mail_server_log.rb
index 77cd23a96..7f61377ce 100644
--- a/app/models/mail_server_log.rb
+++ b/app/models/mail_server_log.rb
@@ -15,9 +15,7 @@
# We load log file lines for requests in here, for display in the admin interface.
#
# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
-#
-# $Id: exim_log.rb,v 1.14 2009-09-17 21:10:05 francis Exp $
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class MailServerLog < ActiveRecord::Base
belongs_to :info_request
diff --git a/app/models/mail_server_log_done.rb b/app/models/mail_server_log_done.rb
index 3fb20f0b3..0e7e9eec3 100644
--- a/app/models/mail_server_log_done.rb
+++ b/app/models/mail_server_log_done.rb
@@ -13,7 +13,7 @@
# Stores that a particular mail server log file has been loaded in, see mail_server_log.rb
#
# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class MailServerLogDone < ActiveRecord::Base
has_many :mail_server_logs
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb
index 784cf19e2..aedfb9cad 100644
--- a/app/models/outgoing_message.rb
+++ b/app/models/outgoing_message.rb
@@ -20,9 +20,17 @@
# else. e.g. An initial request for information, or a complaint.
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class OutgoingMessage < ActiveRecord::Base
+ include Rails.application.routes.url_helpers
+ include LinkToHelper
+ self.default_url_options[:host] = AlaveteliConfiguration::domain
+ # https links in emails if forcing SSL
+ if AlaveteliConfiguration::force_ssl
+ self.default_url_options[:protocol] = "https"
+ end
+
strip_attributes!
belongs_to :info_request
@@ -80,15 +88,15 @@ class OutgoingMessage < ActiveRecord::Base
end
if self.what_doing == 'internal_review'
- "Please pass this on to the person who conducts Freedom of Information reviews." +
+ _("Please pass this on to the person who conducts Freedom of Information reviews.") +
"\n\n" +
- "I am writing to request an internal review of " +
- self.info_request.public_body.name +
- "'s handling of my FOI request " +
- "'" + self.info_request.title + "'." +
+ _("I am writing to request an internal review of {{public_body_name}}'s handling of my FOI request '{{info_request_title}}'.",
+ :public_body_name => self.info_request.public_body.name,
+ :info_request_title => self.info_request.title) +
"\n\n\n\n [ " + self.get_internal_review_insert_here_note + " ] \n\n\n\n" +
- "A full history of my FOI request and all correspondence is available on the Internet at this address:\n" +
- "http://" + AlaveteliConfiguration::domain + "/request/" + self.info_request.url_title
+ _("A full history of my FOI request and all correspondence is available on the Internet at this address: {{url}}",
+ :url => request_url(self.info_request)) +
+ "\n"
else
""
end
@@ -269,7 +277,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/post_redirect.rb b/app/models/post_redirect.rb
index dfca936e2..409069cb6 100644
--- a/app/models/post_redirect.rb
+++ b/app/models/post_redirect.rb
@@ -24,7 +24,7 @@
# fakes the redirect to include POST parameters in request later.
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
require 'openssl' # for random bytes function
diff --git a/app/models/profile_photo.rb b/app/models/profile_photo.rb
index 41cb298b3..5d542daf1 100644
--- a/app/models/profile_photo.rb
+++ b/app/models/profile_photo.rb
@@ -13,7 +13,7 @@
# Image of user that goes on their profile.
#
# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class ProfilePhoto < ActiveRecord::Base
WIDTH = 96
@@ -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/models/purge_request.rb b/app/models/purge_request.rb
index 48a16f9e6..e48f3cc6f 100644
--- a/app/models/purge_request.rb
+++ b/app/models/purge_request.rb
@@ -14,7 +14,7 @@
# A queue of URLs to purge
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
#
class PurgeRequest < ActiveRecord::Base
diff --git a/app/models/raw_email.rb b/app/models/raw_email.rb
index 032839b2f..6bf01bc74 100644
--- a/app/models/raw_email.rb
+++ b/app/models/raw_email.rb
@@ -10,7 +10,7 @@
# The fat part of models/incoming_message.rb
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class RawEmail < ActiveRecord::Base
# deliberately don't strip_attributes, so keeps raw email properly
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb
index 219c66811..66b8a5c47 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -19,7 +19,7 @@
# When somebody is getting alerts for something.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
require 'set'
diff --git a/app/models/track_things_sent_email.rb b/app/models/track_things_sent_email.rb
index a0a4c0f0c..a9ea2520e 100644
--- a/app/models/track_things_sent_email.rb
+++ b/app/models/track_things_sent_email.rb
@@ -16,7 +16,7 @@
# Record that alert has arrived.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class TrackThingsSentEmail < ActiveRecord::Base
belongs_to :info_request_event
diff --git a/app/models/user.rb b/app/models/user.rb
index 63dd5b1dd..257acd0fc 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -298,7 +298,7 @@ class User < ActiveRecord::Base
text = CGI.escapeHTML(text)
text = MySociety::Format.make_clickable(text, :contract => 1)
text = text.gsub(/\n/, '<br>')
- return text
+ return text.html_safe
end
# Returns domain part of user's email address
diff --git a/app/models/user_info_request_sent_alert.rb b/app/models/user_info_request_sent_alert.rb
index cf20bcbf5..449a4c237 100644
--- a/app/models/user_info_request_sent_alert.rb
+++ b/app/models/user_info_request_sent_alert.rb
@@ -15,7 +15,7 @@
# given type of alert.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
class UserInfoRequestSentAlert < ActiveRecord::Base
belongs_to :user
diff --git a/app/views/admin_censor_rule/new.html.erb b/app/views/admin_censor_rule/new.html.erb
index 1694308f3..77d22990c 100644
--- a/app/views/admin_censor_rule/new.html.erb
+++ b/app/views/admin_censor_rule/new.html.erb
@@ -1,4 +1,4 @@
-<% @title = 'New censor rule' %>
+<% @title = _('New censor rule') %>
<h1><%=@title%></h1>
diff --git a/app/views/admin_request/hidden_user_explanation.html.erb b/app/views/admin_request/hidden_user_explanation.html.erb
index 7084e986f..d0a5d727d 100644
--- a/app/views/admin_request/hidden_user_explanation.html.erb
+++ b/app/views/admin_request/hidden_user_explanation.html.erb
@@ -1,10 +1,10 @@
-Dear <%= name_to %>,
+<%= _("Dear {{name}},", :name => name_to) %>
-Your request '<%= info_request.title.html_safe %>' at <%= info_request_url %> has been reviewed by moderators.
+<%= _("Your request '{{request}}' at {{url}} has been reviewed by moderators.", :request => info_request.title.html_safe, :url => info_request_url) %>
-We consider it <% if reason == 'not_foi' %>is not a valid FOI request<% else %>to be vexatious<% end%>, and have therefore hidden it from other users. You will still be able to view it while logged in to the site. Please reply to this email if you would like to discuss this decision further.
+<%= reason == 'not_foi' ? _("We consider it is not a valid FOI request, and have therefore hidden it from other users.") : _("We consider it to be vexatious, and have therefore hidden it from other users.") %> <%= _("You will still be able to view it while logged in to the site. Please reply to this email if you would like to discuss this decision further.") %>
-Yours,
+<%= _("Yours,") %>
-The <%= site_name %> team.
+<%= _("The {{site_name}} team.", :site_name => site_name) %>
diff --git a/app/views/admin_request/show.html.erb b/app/views/admin_request/show.html.erb
index 67f10c182..e18e319be 100644
--- a/app/views/admin_request/show.html.erb
+++ b/app/views/admin_request/show.html.erb
@@ -121,7 +121,7 @@
<p class="help-block">(see also option to general URLs for individual incoming messages below)</p>
</div>
</div>
- <% form_tag admin_request_hide_path(@info_request), :class => "form form-inline", :id => "hide_request_form", 'data-info-request-id' => @info_request.id.to_s do %>
+ <%= form_tag admin_request_hide_path(@info_request), :class => "form form-inline", :id => "hide_request_form", 'data-info-request-id' => @info_request.id.to_s do %>
<div class="control-group">
<% if @info_request.is_external? %>
<label class="control-label">Hide the request:</label>
@@ -149,7 +149,7 @@
<div class="control-group" id="request_hidden_user_subject">
<label for="request_hidden_user_subject_field" class="control-label">Subject of email:</label>
<div class="controls">
- <%= text_field_tag "subject", "Your request on WhatDoTheyKnow.com hidden", {:id => "request_hidden_user_subject_field", :cols => 100} %>
+ <%= text_field_tag "subject", _("Your request on {{site_name}} hidden", :site_name => site_name), {:id => "request_hidden_user_subject_field", :cols => 100} %>
</div>
</div>
@@ -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.to_s) %>
diff --git a/app/views/admin_user/show.html.erb b/app/views/admin_user/show.html.erb
index 26a385f31..c93c08e50 100644
--- a/app/views/admin_user/show.html.erb
+++ b/app/views/admin_user/show.html.erb
@@ -32,13 +32,13 @@
<%=link_to @admin_user.email, "mailto:#{h @admin_user.email}"%>
<% elsif column_name == 'email_bounce_message' %>
<% unless @admin_user.email_bounce_message.empty? %>
- <%= link_to _("See bounce message"), admin_user_show_bounce(@admin_user.id) %>
+ <%= link_to _("See bounce message"), admin_user_show_bounce_path(@admin_user.id) %>
<% end %>
<% else %>
<%=h admin_value(value)%>
<% end %>
<% if column_name == 'email_bounced_at' && !@admin_user.email_bounced_at.nil? %>
- <% form_tag admin_user_clear_bounce_path(@admin_user), :class => "form form-inline" do %>
+ <%= form_tag admin_user_clear_bounce_path(@admin_user), :class => "form form-inline" do %>
<input type="submit" name="action" value="Clear bounce" class="btn btn-info">
<% end %>
<% end %>
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/_search_ahead.html.erb b/app/views/public_body/_search_ahead.html.erb
index b1af2464d..3d1dc8f93 100644
--- a/app/views/public_body/_search_ahead.html.erb
+++ b/app/views/public_body/_search_ahead.html.erb
@@ -1,4 +1,4 @@
-<div>
+
<% if !@xapian_requests.nil? %>
<% if @xapian_requests.results.size > 0 %>
<h3><%= _('Top search results:') %></h3>
@@ -10,12 +10,11 @@
<% end %>
<div id="authority_search_ahead_results">
<% for result in @xapian_requests.results %>
- <%= render :partial => 'body_listing_single', :locals => { :public_body => result[:model] } %>
+ <%= render :partial => 'public_body/body_listing_single', :locals => { :public_body => result[:model] } %>
<% end %>
</div>
<%= will_paginate WillPaginate::Collection.new(@page, @per_page, @xapian_requests.matches_estimated), :params => {:controller=>"request", :action => "select_authority"} %>
<% end %>
-</div>
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..47075a1f5 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>
@@ -51,12 +56,7 @@
<div id="stepwise_make_request">
<% if @public_body.is_requestable? || @public_body.not_requestable_reason == 'bad_contact' %>
- <% if @public_body.eir_only? %>
- <%= _('Make a new <strong>Environmental Information</strong> request')%>
- <% 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"))%>
+ <%= link_to _("Make a request to this authority"), new_request_to_body_path(: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 +91,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..4c06f1f48 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..4bc8826fd 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>
@@ -31,8 +36,8 @@
<h2><%= _("Act on what you've learnt") %></h2>
<div class="act_link">
- <% tweet_link = "https://twitter.com/share?url=#{h(request.url)}&via=#{h(AlaveteliConfiguration::twitter_username)}&text='#{h(@info_request.title)}'&related=#{_('alaveteli_foi:The software that runs {{site_name}}', :site_name => h(site_name))}" %>
- <%= link_to tweet_link do %>
+ <% tweet_link = "https://twitter.com/share?" + {:url => request.url, :via => AlaveteliConfiguration::twitter_username, :text => "'#{@info_request.title}'", :related => _('alaveteli_foi:The software that runs {{site_name}}', :site_name => site_name)}.to_query %>
+ <% link_to tweet_link do %>
<%= image_tag "twitter-16.png", :alt => "twitter icon" %>
<% end %>
<%= link_to _("Tweet this request"), tweet_link %>
@@ -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/_wall_listing.html.erb b/app/views/request/_wall_listing.html.erb
index 4a76b09bf..b6b4b38b1 100644
--- a/app/views/request/_wall_listing.html.erb
+++ b/app/views/request/_wall_listing.html.erb
@@ -8,7 +8,7 @@ end %>
<% if event.event_type == 'sent' %>
<%= _('A new request, <em><a href="{{request_url}}">{{request_title}}</a></em>, was sent to {{public_body_name}} by {{info_request_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>request_user_link_absolute(info_request),:date=>simple_date(event.created_at),:request_url=>request_path(info_request),:request_title=>info_request.title) %>
<% elsif event.event_type == 'followup_sent' %>
- <%= _('A <a href="{{request_url}}">follow up</a> to <em>{{request_title}}</em> was sent to {{public_body_name}} by {{info_request_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>request_user_link_absolute(info_request),:date=>simple_date(event.created_at),:request_url=>outgoing_message_url(event.outgoing_message),:request_title=>info_request.title) %>
+ <%= _('A <a href="{{request_url}}">follow up</a> to <em>{{request_title}}</em> was sent to {{public_body_name}} by {{info_request_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>request_user_link_absolute(info_request),:date=>simple_date(event.created_at),:request_url=>outgoing_message_path(event.outgoing_message),:request_title=>info_request.title) %>
<% elsif event.event_type == 'response' %>
<%= _('A <a href="{{request_url}}">response</a> to <em>{{request_title}}</em> was sent by {{public_body_name}} to {{info_request_user}} on {{date}}. The request status is: {{request_status}}',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>request_user_link_absolute(info_request),:date=>simple_date(event.created_at),:request_url=>incoming_message_path(event.incoming_message_selective_columns("incoming_messages.id")),:request_title=>info_request.title,:request_status=>info_request.display_status) %>
<% elsif event.event_type == 'comment' %>
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..8da4eb555 100644
--- a/app/views/request/new_please_describe.html.erb
+++ b/app/views/request/new_please_describe.html.erb
@@ -1,4 +1,4 @@
-<% @title = "First, did your other requests succeed?" %>
+<% @title = _("First, did your other requests succeed?") %>
<h1><%=@title%></h1>
@@ -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..75c51fc57 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,38 +33,21 @@
<%= 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 %>
<%= submit_tag _('Search') %>
</div>
<% end %>
- <div id="typeahead_response">
- <% if !@xapian_requests.nil? %>
- <% if @xapian_requests.results.size > 0 %>
- <h3><%= _('Top search results:') %></h3>
- <p>
- <%= _('Select one to see more information about the authority.')%>
- </p>
- <% else %>
- <h3><%= _('No results found.') %></h3>
- <% end %>
- <div id="authority_search_ahead_results">
- <% for result in @xapian_requests.results %>
- <%= render :partial => 'public_body/body_listing_single', :locals => { :public_body => result[:model] } %>
- <% end %>
- </div>
-
- <% end %>
-
-
+ <div id="typeahead_response">
+ <%= render :partial => 'public_body/search_ahead' %>
</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/set_crop_profile_photo.html.erb b/app/views/user/set_crop_profile_photo.html.erb
index fea7ccab8..0a22d36dc 100644
--- a/app/views/user/set_crop_profile_photo.html.erb
+++ b/app/views/user/set_crop_profile_photo.html.erb
@@ -37,7 +37,7 @@
<p>
<%= hidden_field_tag 'submitted_crop_profile_photo', 1 %>
- <%= submit_tag _("Done") + " &gt;&gt;" %>
+ <%= submit_tag _("Done &gt;&gt;") %>
</p>
<% end %>
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/sign.html.erb b/app/views/user/sign.html.erb
index 5e8cced91..8291cdace 100644
--- a/app/views/user/sign.html.erb
+++ b/app/views/user/sign.html.erb
@@ -12,7 +12,7 @@
<% end %>
</p>
<% if @post_redirect.post_params["controller"] == "admin_general" %>
- <% unless Configuration::disable_emergency_user %>
+ <% unless AlaveteliConfiguration::disable_emergency_user %>
<p id="superuser_message">Don't have a superuser account yet? <%= link_to "Sign in as the emergency user", @post_redirect.uri + "?emergency=1" %></p>
<% end %>
<% end %>
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>