diff options
102 files changed, 2524 insertions, 453 deletions
diff --git a/.gitignore b/.gitignore index 31df17a96..e0b1e3b21 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ ._* .DS_Store .autotest -/db/test_structure.sql *#*# TAGS /vendor/plugins/*theme @@ -48,6 +48,7 @@ group :test do gem 'fakeweb' gem 'rspec-rails', '~> 1.3.4' gem 'test-unit', '~> 1.2.3', :platforms => :ruby_19 + gem 'coveralls', :require => false end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 25b156184..27f574f4f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -34,11 +34,18 @@ GEM net-ssh (>= 2.0.14) net-ssh-gateway (>= 1.1.0) chunky_png (1.2.6) + colorize (0.5.8) columnize (0.3.6) compass (0.12.2) chunky_png (~> 1.2) fssm (>= 0.2.7) sass (~> 3.1) + coveralls (0.6.0) + colorize + multi_json (~> 1.3) + rest-client + simplecov (>= 0.7) + thor daemons (1.1.9) erubis (2.7.0) eventmachine (1.0.0) @@ -78,6 +85,7 @@ GEM thin memcache-client (1.8.5) mime-types (1.19) + multi_json (1.6.1) net-http-local (0.1.2) net-purge (0.1.0) net-scp (1.1.0) @@ -96,6 +104,8 @@ GEM rdoc (3.12.1) json (~> 1.4) recaptcha (0.3.4) + rest-client (1.6.7) + mime-types (>= 1.16) rmagick (2.13.1) routing-filter (0.2.4) actionpack @@ -123,6 +133,10 @@ GEM ruby_core_source (0.1.5) archive-tar-minitar (>= 0.5.2) sass (3.2.1) + simplecov (0.7.1) + multi_json (~> 1.0) + simplecov-html (~> 0.7.1) + simplecov-html (0.7.1) sinatra (1.2.8) rack (~> 1.1) tilt (>= 1.2.2, < 2.0) @@ -139,6 +153,7 @@ GEM daemons (>= 1.0.9) eventmachine (>= 0.12.6) rack (>= 1.0.0) + thor (0.17.0) tilt (1.3.3) treetop (1.4.11) polyglot @@ -157,6 +172,7 @@ DEPENDENCIES bootstrap-sass capistrano compass + coveralls erubis fakeweb fast_gettext (>= 0.6.0) @@ -1,6 +1,6 @@ # Welcome to Alaveteli! -[](http://travis-ci.org/mysociety/alaveteli) [](https://gemnasium.com/mysociety/alaveteli) +[](http://travis-ci.org/mysociety/alaveteli) [](https://gemnasium.com/mysociety/alaveteli) [](https://coveralls.io/r/mysociety/alaveteli) This is an open source project to create a standard, internationalised platform for making Freedom of Information (FOI) requests in different diff --git a/app/controllers/admin_censor_rule_controller.rb b/app/controllers/admin_censor_rule_controller.rb index 5381921bf..f6abc70df 100644 --- a/app/controllers/admin_censor_rule_controller.rb +++ b/app/controllers/admin_censor_rule_controller.rb @@ -26,9 +26,9 @@ class AdminCensorRuleController < AdminController end flash[:notice] = 'CensorRule was successfully created.' if !@censor_rule.info_request.nil? - redirect_to admin_url('request/show/' + @censor_rule.info_request.id.to_s) + redirect_to admin_request_show_url(@censor_rule.info_request) elsif !@censor_rule.user.nil? - redirect_to admin_url('user/show/' + @censor_rule.user.id.to_s) + redirect_to admin_user_show_url(@censor_rule.user) else raise "internal error" end @@ -53,9 +53,9 @@ class AdminCensorRuleController < AdminController end flash[:notice] = 'CensorRule was successfully updated.' if !@censor_rule.info_request.nil? - redirect_to admin_url('request/show/' + @censor_rule.info_request.id.to_s) + redirect_to admin_request_show_url(@censor_rule.info_request) elsif !@censor_rule.user.nil? - redirect_to admin_url('user/show/' + @censor_rule.user.id.to_s) + redirect_to admin_user_show_url(@censor_rule.user) else raise "internal error" end @@ -79,9 +79,9 @@ class AdminCensorRuleController < AdminController flash[:notice] = "CensorRule was successfully destroyed." if !info_request.nil? - redirect_to admin_url('request/show/' + info_request.id.to_s) + redirect_to admin_request_show_url(info_request) elsif !user.nil? - redirect_to admin_url('user/show/' + user.id.to_s) + redirect_to admin_user_show_url(user) else raise "internal error" end diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb index ac12e97b2..bb5e98852 100644 --- a/app/controllers/admin_public_body_controller.rb +++ b/app/controllers/admin_public_body_controller.rb @@ -92,7 +92,7 @@ class AdminPublicBodyController < AdminController @public_body = PublicBody.new(params[:public_body]) if @public_body.save flash[:notice] = 'PublicBody was successfully created.' - redirect_to admin_url('body/show/' + @public_body.id.to_s) + redirect_to admin_body_show_url(@public_body) else render :action => 'new' end @@ -111,7 +111,7 @@ class AdminPublicBodyController < AdminController @public_body = PublicBody.find(params[:id]) if @public_body.update_attributes(params[:public_body]) flash[:notice] = 'PublicBody was successfully updated.' - redirect_to admin_url('body/show/' + @public_body.id.to_s) + redirect_to admin_body_show_url(@public_body) else render :action => 'edit' end diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index ed8de7755..d84b44b6f 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -42,7 +42,7 @@ class AdminRequestController < AdminController vars = OpenStruct.new(:name_to => @info_request.user_name, :name_from => Configuration::contact_name, :info_request => @info_request, :reason => params[:reason], - :info_request_url => 'http://' + Configuration::domain + request_url(@info_request), + :info_request_url => 'http://' + Configuration::domain + request_path(@info_request), :site_name => site_name) template = File.read(File.join(File.dirname(__FILE__), "..", "views", "admin_request", "hidden_user_explanation.rhtml")) @request_hidden_user_explanation = ERB.new(template).result(vars.instance_eval { binding }) @@ -52,7 +52,7 @@ class AdminRequestController < AdminController @outgoing_message = OutgoingMessage.find(params[:outgoing_message_id]) @outgoing_message.resend_message flash[:notice] = "Outgoing message resent" - redirect_to request_admin_url(@outgoing_message.info_request) + redirect_to admin_request_show_url(@outgoing_message.info_request) end def edit @@ -98,7 +98,7 @@ class AdminRequestController < AdminController # expire cached files expire_for_request(@info_request) flash[:notice] = 'Request successfully updated.' - redirect_to request_admin_url(@info_request) + redirect_to admin_request_show_url(@info_request) else render :action => 'edit' end @@ -114,7 +114,7 @@ class AdminRequestController < AdminController # expire cached files expire_for_request(@info_request) flash[:notice] = "Request #{url_title} has been completely destroyed. Email of user who made request: " + user.email - redirect_to admin_url('request/list') + redirect_to admin_request_list_url end def edit_outgoing @@ -131,7 +131,7 @@ class AdminRequestController < AdminController { :editor => admin_current_user(), :deleted_outgoing_message_id => outgoing_message_id }) flash[:notice] = 'Outgoing message successfully destroyed.' - redirect_to request_admin_url(@info_request) + redirect_to admin_request_show_url(@info_request) end def update_outgoing @@ -144,7 +144,7 @@ class AdminRequestController < AdminController { :outgoing_message_id => @outgoing_message.id, :editor => admin_current_user(), :old_body => old_body, :body => @outgoing_message.body }) flash[:notice] = 'Outgoing message successfully updated.' - redirect_to request_admin_url(@outgoing_message.info_request) + redirect_to admin_request_show_url(@outgoing_message.info_request) else render :action => 'edit_outgoing' end @@ -168,7 +168,7 @@ class AdminRequestController < AdminController :old_visible => old_visible, :visible => @comment.visible, }) flash[:notice] = 'Comment successfully updated.' - redirect_to request_admin_url(@comment.info_request) + redirect_to admin_request_show_url(@comment.info_request) else render :action => 'edit_comment' end @@ -186,7 +186,7 @@ class AdminRequestController < AdminController # expire cached files expire_for_request(@info_request) flash[:notice] = 'Incoming message successfully destroyed.' - redirect_to request_admin_url(@info_request) + redirect_to admin_request_show_url(@info_request) end def redeliver_incoming @@ -203,7 +203,7 @@ class AdminRequestController < AdminController end if destination_request.nil? flash[:error] = "Failed to find destination request '" + m + "'" - return redirect_to request_admin_url(previous_request) + return redirect_to admin_request_show_url(previous_request) end raw_email_data = incoming_message.raw_email.data @@ -223,7 +223,7 @@ class AdminRequestController < AdminController expire_for_request(previous_request) incoming_message.fully_destroy end - redirect_to request_admin_url(destination_request) + redirect_to admin_request_show_url(destination_request) end # change user or public body of a request magically @@ -246,7 +246,7 @@ class AdminRequestController < AdminController info_request.reindex_request_events flash[:notice] = "Message has been moved to new user" end - redirect_to request_admin_url(info_request) + redirect_to admin_request_show_url(info_request) elsif params[:commit] == 'Move request to authority' && !params[:public_body_url_name].blank? old_public_body = info_request.public_body destination_public_body = PublicBody.find_by_url_name(params[:public_body_url_name]) @@ -265,10 +265,10 @@ class AdminRequestController < AdminController flash[:notice] = "Request has been moved to new body" end - redirect_to request_admin_url(info_request) + redirect_to admin_request_show_url(info_request) else flash[:error] = "Please enter the user or authority to move the request to" - redirect_to request_admin_url(info_request) + redirect_to admin_request_show_url(info_request) end end @@ -292,20 +292,20 @@ class AdminRequestController < AdminController if !info_request.public_body.is_foi_officer?(user) flash[:notice] = user.email + " is not an email at the domain @" + info_request.public_body.foi_officer_domain_required + ", so won't be able to upload." - redirect_to request_admin_url(info_request) + redirect_to admin_request_show_url(info_request) return end # Bejeeps, look, sometimes a URL is something that belongs in a controller, jesus. - # XXX hammer this square peg into the round MVC hole - should be calling main_url(upload_response_url()) + # XXX hammer this square peg into the round MVC hole post_redirect = PostRedirect.new( - :uri => main_url(upload_response_url(:url_title => info_request.url_title, :only_path => true)), + :uri => upload_response_url(:url_title => info_request.url_title), :user_id => user.id) post_redirect.save! - url = main_url(confirm_url(:email_token => post_redirect.email_token, :only_path => true)) + url = confirm_url(:email_token => post_redirect.email_token) - flash[:notice] = 'Send "' + name + '" <<a href="mailto:' + email + '">' + email + '</a>> this URL: <a href="' + url + '">' + url + "</a> - it will log them in and let them upload a response to this request.".html_safe - redirect_to request_admin_url(info_request) + flash[:notice] = ("Send \"#{name}\" <<a href=\"mailto:#{email}\">#{email}</a>> this URL: <a href=\"#{url}\">#{url}</a> - it will log them in and let them upload a response to this request.").html_safe + redirect_to admin_request_show_url(info_request) end def show_raw_email @@ -355,7 +355,7 @@ class AdminRequestController < AdminController info_request_event.save! flash[:notice] = "Old response marked as having been a clarification" - redirect_to request_admin_url(info_request_event.info_request) + redirect_to admin_request_show_url(info_request_event.info_request) end def hide_request @@ -387,7 +387,7 @@ class AdminRequestController < AdminController end # expire cached files expire_for_request(info_request) - redirect_to request_admin_url(info_request) + redirect_to admin_request_show_url(info_request) end end diff --git a/app/controllers/admin_user_controller.rb b/app/controllers/admin_user_controller.rb index ed20ddcf4..feffa208e 100644 --- a/app/controllers/admin_user_controller.rb +++ b/app/controllers/admin_user_controller.rb @@ -48,7 +48,7 @@ class AdminUserController < AdminController if @admin_user.valid? @admin_user.save! flash[:notice] = 'User successfully updated.' - redirect_to user_admin_url(@admin_user) + redirect_to admin_user_show_url(@admin_user) else render :action => 'edit' end @@ -58,7 +58,7 @@ class AdminUserController < AdminController track_thing = TrackThing.find(params[:track_id].to_i) track_thing.destroy flash[:notice] = 'Track destroyed' - redirect_to user_admin_url(track_thing.tracking_user) + redirect_to admin_user_show_url(track_thing.tracking_user) end def clear_bounce @@ -66,15 +66,15 @@ class AdminUserController < AdminController user.email_bounced_at = nil user.email_bounce_message = "" user.save! - redirect_to user_admin_url(user) + redirect_to admin_user_show_url(user) end def login_as @admin_user = User.find(params[:id]) # check user does exist - post_redirect = PostRedirect.new( :uri => main_url(user_url(@admin_user)), :user_id => @admin_user.id, :circumstance => "login_as" ) + post_redirect = PostRedirect.new( :uri => user_url(@admin_user), :user_id => @admin_user.id, :circumstance => "login_as" ) post_redirect.save! - url = main_url(confirm_url(:email_token => post_redirect.email_token, :only_path => true)) + url = confirm_url(:email_token => post_redirect.email_token) redirect_to url end @@ -91,7 +91,7 @@ class AdminUserController < AdminController end flash[:notice] = "Profile photo cleared" - redirect_to user_admin_url(@admin_user) + redirect_to admin_user_show_url(@admin_user) end private diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 15fb4f5f9..5d8ceb888 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -220,7 +220,7 @@ class ApiController < ApplicationController :event_id => event.id, :created_at => event.created_at.iso8601, :event_type => event.event_type, - :request_url => main_url(request_url(request)), + :request_url => request_url(request), :request_email => request.incoming_email, :title => request.title, :body => event.outgoing_message.body, @@ -228,7 +228,7 @@ class ApiController < ApplicationController :user_name => request.user_name, } if request.user - this_event[:user_url] = main_url(user_url(request.user)) + this_event[:user_url] = user_url(request.user) end @event_data.push(this_event) diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb index 1bcc0145c..aa6980b69 100644 --- a/app/controllers/public_body_controller.rb +++ b/app/controllers/public_body_controller.rb @@ -31,7 +31,7 @@ class PublicBodyController < ApplicationController set_last_body(@public_body) - top_url = main_url("/") + top_url = frontpage_url @searched_to_send_request = false referrer = request.env['HTTP_REFERER'] if !referrer.nil? && referrer.match(%r{^#{top_url}search/.*/bodies$}) diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 6b8444f90..fe948db19 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -166,7 +166,7 @@ class RequestController < ApplicationController @view = params[:view] @page = get_search_page_from_params if !@page # used in cache case, as perform_search sets @page as side effect if @view == "recent" - return redirect_to request_list_all_path(:action => "list", :view => "all", :page => @page), :status => :moved_permanently + return redirect_to request_list_all_url(:action => "list", :view => "all", :page => @page), :status => :moved_permanently end # Later pages are very expensive to load @@ -369,7 +369,7 @@ class RequestController < ApplicationController <p>If you write about this request (for example in a forum or a blog) please link to this page, and add an annotation below telling people about your writing.</p>",:law_used_full=>@info_request.law_used_full, :late_number_of_days => Configuration::reply_late_after_days) - redirect_to show_new_request_path(:url_title => @info_request.url_title) + redirect_to show_new_request_url(:url_title => @info_request.url_title) end # Submitted to the describing state of messages form @@ -438,8 +438,8 @@ class RequestController < ApplicationController # Don't give advice on what to do next, as it isn't their request RequestMailer.deliver_old_unclassified_updated(@info_request) if !@info_request.is_external? if session[:request_game] - flash[:notice] = _('Thank you for updating the status of the request \'<a href="{{url}}">{{info_request_title}}</a>\'. There are some more requests below for you to classify.',:info_request_title=>CGI.escapeHTML(@info_request.title), :url=>CGI.escapeHTML(request_url(@info_request))) - redirect_to play_url + flash[:notice] = _('Thank you for updating the status of the request \'<a href="{{url}}">{{info_request_title}}</a>\'. There are some more requests below for you to classify.',:info_request_title=>CGI.escapeHTML(@info_request.title), :url=>CGI.escapeHTML(request_path(@info_request))) + redirect_to categorise_play_url else flash[:notice] = _('Thank you for updating this request!') redirect_to request_url(@info_request) @@ -894,7 +894,7 @@ class RequestController < ApplicationController convert_command = Configuration::html_to_pdf_command done = false if !convert_command.blank? && File.exists?(convert_command) - url = "http://#{Configuration::domain}#{request_url(@info_request)}?print_stylesheet=1" + url = "http://#{Configuration::domain}#{request_path(@info_request)}?print_stylesheet=1" tempfile = Tempfile.new('foihtml2pdf') output = AlaveteliExternalCommand.run(convert_command, url, tempfile.path) if !output.nil? diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb index a27e71264..e75dac903 100644 --- a/app/controllers/services_controller.rb +++ b/app/controllers/services_controller.rb @@ -38,7 +38,7 @@ class ServicesController < ApplicationController :locals => {:name_to => info_request.user_name, :name_from => Configuration::contact_name, :info_request => info_request, :reason => params[:reason], - :info_request_url => 'http://' + Configuration::domain + request_url(info_request), + :info_request_url => 'http://' + Configuration::domain + request_path(info_request), :site_name => site_name} end diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 4ee527bae..fc8b6e014 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -422,7 +422,7 @@ class UserController < ApplicationController ContactMailer.deliver_user_message( @user, @recipient_user, - main_url(user_url(@user)), + user_url(@user), params[:contact][:subject], params[:contact][:message] ) diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index 42c1e0549..15cce39eb 100755 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -10,95 +10,105 @@ module LinkToHelper # Links to various models # Requests - def request_url(info_request, extra_params={}) - params = {:url_title => info_request.url_title, :only_path => true} - return show_request_url(params.merge(extra_params)) + def request_url(info_request, options = {}) + show_request_url({:url_title => info_request.url_title}.merge(options)) end - def request_link(info_request, cls=nil ) - link_to h(info_request.title), request_url(info_request), :class => cls + def request_path(info_request, options = {}) + request_url(info_request, {:only_path => true}.merge(options)) end - def request_admin_url(info_request) - return admin_url('request/show/' + info_request.id.to_s) + def request_link(info_request, cls=nil ) + link_to h(info_request.title), request_path(info_request), :class => cls end def request_admin_link(info_request, name="admin", cls=nil) - link_to name, request_admin_url(info_request), :class => cls + link_to name, admin_request_show_url(info_request), :class => cls end def request_both_links(info_request) - link_to(h(info_request.title), main_url(request_url(info_request))) + " (" + link_to("admin", request_admin_url(info_request)) + ")" + link_to(h(info_request.title), request_url(info_request)) + " (" + link_to("admin", admin_request_show_url(info_request)) + ")" end - def request_similar_url(info_request) - return similar_request_url(:url_title => info_request.url_title, :only_path => true) + def request_details_path(info_request) + details_request_path(:url_title => info_request.url_title) end - def request_details_url(info_request) - return details_request_url(:url_title => info_request.url_title, :only_path => true) + # Incoming / outgoing messages + def incoming_message_url(incoming_message, options = {}) + return request_url(incoming_message.info_request, options.merge(:anchor => "incoming-#{incoming_message.id}")) end - # Incoming / outgoing messages - def incoming_message_url(incoming_message) - return request_url(incoming_message.info_request)+"#incoming-"+incoming_message.id.to_s + def incoming_message_path(incoming_message) + incoming_message_url(incoming_message, :only_path => true) + end + + def outgoing_message_url(outgoing_message, options = {}) + return request_path(outgoing_message.info_request, options.merge(:anchor => "outgoing-#{outgoing_message.id}")) + end + + def outgoing_message_path(outgoing_message) + outgoing_message_url(outgoing_message, :only_path => true) end - def outgoing_message_url(outgoing_message) - return request_url(outgoing_message.info_request)+"#outgoing-"+outgoing_message.id.to_s + def comment_url(comment, options = {}) + request_url(comment.info_request, options.merge(:anchor => "comment-#{comment.id}")) end - def comment_url(comment) - return request_url(comment.info_request)+"#comment-"+comment.id.to_s + def comment_path(comment) + comment_url(comment, :only_path => true) end # Respond to request - def respond_to_last_url(info_request) + def respond_to_last_url(info_request, options = {}) last_response = info_request.get_last_response if last_response.nil? - respond_url = show_response_no_followup_url(:id => info_request.id) + show_response_no_followup_url(options.merge(:id => info_request.id)) else - respond_url = show_response_url(:id => info_request.id, :incoming_message_id => last_response.id) + show_response_url(options.merge(:id => info_request.id, :incoming_message_id => last_response.id)) end - return respond_url + end + + def respond_to_last_path(info_request) + respond_to_last_url(info_request, :only_path => true) end # Public bodies - def public_body_url(public_body) - public_body.url_name.nil? ? '' : show_public_body_url(:url_name => public_body.url_name, :only_path => true) + def public_body_url(public_body, options = {}) + public_body.url_name.nil? ? '' : show_public_body_url(options.merge(:url_name => public_body.url_name)) + end + + def public_body_path(public_body) + public_body_url(public_body, :only_path => true) end def public_body_link_short(public_body) - link_to h(public_body.short_or_long_name), public_body_url(public_body) + link_to h(public_body.short_or_long_name), public_body_path(public_body) end def public_body_link(public_body, cls=nil) - link_to h(public_body.name), public_body_url(public_body), :class => cls + link_to h(public_body.name), public_body_path(public_body), :class => cls end def public_body_link_absolute(public_body) # e.g. for in RSS - link_to h(public_body.name), main_url(public_body_url(public_body)) - end - - def public_body_admin_url(public_body) - return admin_url('body/show/' + public_body.id.to_s) + link_to h(public_body.name), public_body_url(public_body) end def public_body_both_links(public_body) - link_to(h(public_body.name), main_url(public_body_url(public_body))) + " (" + link_to("admin", public_body_admin_url(public_body)) + ")" + link_to(h(public_body.name), public_body_url(public_body)) + " (" + link_to("admin", admin_body_show_url(public_body)) + ")" end - def list_public_bodies_default - list_public_bodies_url(:tag => 'all') + # Users + def user_url(user, options = {}) + show_user_url(options.merge(:url_name => user.url_name)) end - # Users - def user_url(user) - return show_user_url(:url_name => user.url_name, :only_path => true) + def user_path(user) + user_url(user, :only_path => true) end def user_link(user, cls=nil) - link_to h(user.name), user_url(user), :class => cls + link_to h(user.name), user_path(user), :class => cls end def user_link_for_request(request, cls=nil) @@ -110,7 +120,7 @@ module LinkToHelper user_name end else - link_to h(request.user.name), user_url(request.user), :class => cls + link_to h(request.user.name), user_path(request.user), :class => cls end end @@ -119,12 +129,16 @@ module LinkToHelper text = external_text ? external_text : (request.external_user_name || _("Anonymous user")) + " (external)" else text = internal_text ? internal_text : request.user.name - link_to(h(text), user_admin_url(request.user)) + link_to(h(text), admin_user_show_url(request.user)) end end def user_link_absolute(user) - link_to h(user.name), main_url(user_url(user)) + link_to h(user.name), user_url(user) + end + + def user_link(user) + link_to h(user.name), user_path(user) end def request_user_link_absolute(request) @@ -135,11 +149,19 @@ module LinkToHelper end end + def request_user_link(request) + if request.is_external? + request.external_user_name || _("Anonymous user") + else + user_link(request.user) + end + end + def user_or_you_link(user) if @user && user == @user - link_to h("you"), user_url(user) + link_to h("you"), user_path(user) else - link_to h(user.name), user_url(user) + link_to h(user.name), user_path(user) end end @@ -152,40 +174,40 @@ module LinkToHelper end def user_or_you_capital_link(user) - link_to user_or_you_capital(user), user_url(user) - end - - def user_admin_url(user) - return admin_url('user/show/' + user.id.to_s) + link_to user_or_you_capital(user), user_path(user) end def user_admin_link(user, name="admin", cls=nil) - link_to name, user_admin_url(user), :class => cls + link_to name, admin_user_show_url(user), :class => cls end def user_both_links(user) - link_to(h(user.name), main_url(user_url(user))) + " (" + link_to("admin", user_admin_url(user)) + ")" + link_to(h(user.name), user_url(user)) + " (" + link_to("admin", admin_user_show_url(user)) + ")" end # Tracks. feed can be 'track' or 'feed' - def do_track_url(track_thing, feed = 'track') + def do_track_url(track_thing, feed = 'track', options = {}) if track_thing.track_type == 'request_updates' - track_request_url(:url_title => track_thing.info_request.url_title, :feed => feed) + track_request_url(options.merge(:url_title => track_thing.info_request.url_title, :feed => feed)) elsif track_thing.track_type == 'all_new_requests' - track_list_url(:view => 'recent', :feed => feed) + track_list_url(options.merge(:view => 'recent', :feed => feed)) elsif track_thing.track_type == 'all_successful_requests' - track_list_url(:view => 'successful', :feed => feed) + track_list_url(options.merge(:view => 'successful', :feed => feed)) elsif track_thing.track_type == 'public_body_updates' - track_public_body_url(:url_name => track_thing.public_body.url_name, :feed => feed) + track_public_body_url(options.merge(:url_name => track_thing.public_body.url_name, :feed => feed)) elsif track_thing.track_type == 'user_updates' - track_user_url(:url_name => track_thing.tracked_user.url_name, :feed => feed) + track_user_url(options.merge(:url_name => track_thing.tracked_user.url_name, :feed => feed)) elsif track_thing.track_type == 'search_query' - track_search_url(:query_array => track_thing.track_query, :feed => feed) + track_search_url(options.merge(:query_array => track_thing.track_query, :feed => feed)) else raise "unknown tracking type " + track_thing.track_type end end + def do_track_path(track_thing, feed = 'track') + do_track_url(track_thing, feed, :only_path => true) + end + # General pages. def search_url(query, params = nil) if query.kind_of?(Array) @@ -213,31 +235,26 @@ module LinkToHelper return url end - def search_link(query, variety_postfix = nil, sort_postfix = nil, advanced = nil) - link_to h(query), search_url(query) - end - # Admin pages - def admin_url(relative_path) - admin_url_prefix = Configuration::admin_base_url - (admin_url_prefix.empty? ? admin_general_index_url + '/' : admin_url_prefix) + relative_path + def search_path(query, options = {}) + search_url(query, options.merge(:only_path => true)) end - # About page URLs - def about_url - return help_general_url(:action => 'about') + def search_link(query) + link_to h(query), search_url(query) end - def unhappy_url(info_request = nil) - if info_request.nil? - return help_general_url(:action => 'unhappy') - else - return help_unhappy_url(:url_title => info_request.url_title) - end + # Deprecated helper + # TODO: Remove in next release + def admin_url(relative_path) + warn "[DEPRECATION] admin_url is deprecated. Please remove it from your theme." + relative_path end - + # Deprecated helper + # TODO: Remove in next release def main_url(relative_path, append = nil) + warn "[DEPRECATION] main_url is deprecated. Please remove it from your theme." url_prefix = "http://" + Configuration::domain url = url_prefix + relative_path if !append.nil? @@ -253,6 +270,19 @@ module LinkToHelper return url end + # About page URLs + def about_url + return help_general_url(:action => 'about') + end + + def unhappy_url(info_request = nil) + if info_request.nil? + return help_general_url(:action => 'unhappy') + else + return help_unhappy_url(:url_title => info_request.url_title) + end + end + # Basic date format def simple_date(date) date = date.in_time_zone.to_date unless date.is_a? Date diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb index dc2c5fe21..6f8d88a1a 100644 --- a/app/models/request_mailer.rb +++ b/app/models/request_mailer.rb @@ -71,8 +71,8 @@ class RequestMailer < ApplicationMailer @from = user.name_and_email @recipients = contact_from_name_and_email @subject = _("FOI response requires admin ({{reason}}) - {{title}}", :reason => info_request.described_state, :title => info_request.title) - url = main_url(request_url(info_request)) - admin_url = request_admin_url(info_request) + url = request_url(info_request) + admin_url = admin_request_show_url(info_request) @body = {:reported_by => user, :info_request => info_request, :url => url, :admin_url => admin_url } end @@ -80,14 +80,14 @@ class RequestMailer < ApplicationMailer def new_response(info_request, incoming_message) # Don't use login link here, just send actual URL. This is # because people tend to forward these emails amongst themselves. - url = main_url(incoming_message_url(incoming_message)) + url = incoming_message_url(incoming_message) @from = contact_from_name_and_email headers 'Return-Path' => blackhole_email, 'Reply-To' => @from, # not much we can do if the user's email is broken 'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834 'X-Auto-Response-Suppress' => 'OOF' @recipients = info_request.user.name_and_email - @subject = _("New response to your FOI request - ") + info_request.title + @subject = (_("New response to your FOI request - ") + info_request.title).html_safe @body = { :incoming_message => incoming_message, :info_request => info_request, :url => url } end @@ -106,7 +106,7 @@ class RequestMailer < ApplicationMailer 'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834 'X-Auto-Response-Suppress' => 'OOF' @recipients = user.name_and_email - @subject = _("Delayed response to your FOI request - ") + info_request.title + @subject = (_("Delayed response to your FOI request - ") + info_request.title).html_safe @body = { :info_request => info_request, :url => url } end @@ -125,7 +125,7 @@ class RequestMailer < ApplicationMailer 'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834 'X-Auto-Response-Suppress' => 'OOF' @recipients = user.name_and_email - @subject = _("You're long overdue a response to your FOI request - ") + info_request.title + @subject = (_("You're long overdue a response to your FOI request - ") + info_request.title).html_safe @body = { :info_request => info_request, :url => url } end @@ -135,7 +135,7 @@ class RequestMailer < ApplicationMailer # Make a link going to the form to describe state, and which logs the # user in. post_redirect = PostRedirect.new( - :uri => main_url(request_url(info_request)) + "#describe_state_form_1", + :uri => request_url(info_request) + "#describe_state_form_1", :user_id => info_request.user.id) post_redirect.save! url = confirm_url(:email_token => post_redirect.email_token) @@ -157,7 +157,7 @@ class RequestMailer < ApplicationMailer 'X-Auto-Response-Suppress' => 'OOF' @recipients = info_request.user.name_and_email @subject = _("Someone has updated the status of your request") - url = main_url(request_url(info_request)) + url = request_url(info_request) @body = {:info_request => info_request, :url => url} end @@ -177,7 +177,7 @@ class RequestMailer < ApplicationMailer 'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834 'X-Auto-Response-Suppress' => 'OOF' @recipients = info_request.user.name_and_email - @subject = _("Clarify your FOI request - ") + info_request.title + @subject = (_("Clarify your FOI request - ") + info_request.title).html_safe @body = { :incoming_message => incoming_message, :info_request => info_request, :url => url } end @@ -188,8 +188,8 @@ class RequestMailer < ApplicationMailer 'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834 'X-Auto-Response-Suppress' => 'OOF' @recipients = info_request.user.name_and_email - @subject = _("Somebody added a note to your FOI request - ") + info_request.title - @body = { :comment => comment, :info_request => info_request, :url => main_url(comment_url(comment)) } + @subject = (_("Somebody added a note to your FOI request - ") + info_request.title).html_safe + @body = { :comment => comment, :info_request => info_request, :url => comment_url(comment) } end def comment_on_alert_plural(info_request, count, earliest_unalerted_comment) @from = contact_from_name_and_email @@ -197,8 +197,8 @@ class RequestMailer < ApplicationMailer 'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834 'X-Auto-Response-Suppress' => 'OOF' @recipients = info_request.user.name_and_email - @subject = _("Some notes have been added to your FOI request - ") + info_request.title - @body = { :count => count, :info_request => info_request, :url => main_url(comment_url(earliest_unalerted_comment)) } + @subject = (_("Some notes have been added to your FOI request - ") + info_request.title).html_safe + @body = { :count => count, :info_request => info_request, :url => comment_url(earliest_unalerted_comment) } end # Class function, called by script/mailin with all incoming responses. diff --git a/app/models/track_mailer.rb b/app/models/track_mailer.rb index 7dfa87f52..51440e4d7 100644 --- a/app/models/track_mailer.rb +++ b/app/models/track_mailer.rb @@ -7,7 +7,7 @@ class TrackMailer < ApplicationMailer def event_digest(user, email_about_things) post_redirect = PostRedirect.new( - :uri => main_url(user_url(user)) + "#email_subscriptions", + :uri => user_url(user) + "#email_subscriptions", :user_id => user.id) post_redirect.save! unsubscribe_url = confirm_url(:email_token => post_redirect.email_token) diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb index dfe92b7fe..a0c74bdb6 100644 --- a/app/models/track_thing.rb +++ b/app/models/track_thing.rb @@ -23,6 +23,8 @@ require 'set' +# TODO: TrackThing looks like a good candidate for single table inheritance + class TrackThing < ActiveRecord::Base belongs_to :tracking_user, :class_name => 'User' validates_presence_of :track_query diff --git a/app/views/admin_general/_admin_navbar.rhtml b/app/views/admin_general/_admin_navbar.rhtml index 408c45588..5cc740f70 100644 --- a/app/views/admin_general/_admin_navbar.rhtml +++ b/app/views/admin_general/_admin_navbar.rhtml @@ -2,17 +2,17 @@ <div class="navbar navbar-fixed-top navbar-inverse"> <div class="navbar-inner"> <div class="container"> - <%= link_to 'Alaveteli', main_url('/'), :class => "brand" %> + <%= link_to 'Alaveteli', frontpage_path, :class => "brand" %> <div class="nav-collapse"> <ul class="nav"> - <li><%= link_to 'Summary', admin_url("") %></li> - <li><%= link_to 'Timeline', admin_url("timeline") %></li> - <li><%= link_to 'Stats', admin_url("stats") %></li> - <li><%= link_to 'Debug', admin_url("debug") %></li> - <li><%= link_to 'Authorities', admin_url("body/list") %></li> - <li><%= link_to 'Requests', admin_url("request/list") %></li> - <li><%= link_to 'Users', admin_url("user/list") %></li> - <li><%= link_to 'Tracks', admin_url("track/list") %></li> + <li><%= link_to 'Summary', admin_general_index_path %></li> + <li><%= link_to 'Timeline', admin_timeline_path %></li> + <li><%= link_to 'Stats', admin_stats_path %></li> + <li><%= link_to 'Debug', admin_debug_path %></li> + <li><%= link_to 'Authorities', admin_body_list_path %></li> + <li><%= link_to 'Requests', admin_request_list_path %></li> + <li><%= link_to 'Users', admin_user_list_path %></li> + <li><%= link_to 'Tracks', admin_track_list_path %></li> <li><%= link_to 'Log out', signout_path %></li> </ul> </div> diff --git a/app/views/admin_general/admin.coffee b/app/views/admin_general/admin.coffee index 407ef3e3d..8f9e879ae 100644 --- a/app/views/admin_general/admin.coffee +++ b/app/views/admin_general/admin.coffee @@ -13,7 +13,7 @@ jQuery -> info_request_id = $('#hide_request_form').attr('info_request_id') reason = $(this).val() $('#request_hidden_user_explanation_field').attr("value", "[loading default text...]") - $.ajax "<%= Configuration::admin_public_url %>/hidden_user_explanation?reason=" + reason + "&info_request_id=" + info_request_id, + $.ajax "/hidden_user_explanation?reason=" + reason + "&info_request_id=" + info_request_id, type: "GET" dataType: "text" error: (data, textStatus, jqXHR) -> diff --git a/app/views/admin_general/admin.js b/app/views/admin_general/admin.js index c4c44dff0..61382dab3 100644 --- a/app/views/admin_general/admin.js +++ b/app/views/admin_general/admin.js @@ -17,7 +17,7 @@ info_request_id = $('#hide_request_form').attr('info_request_id'); reason = $(this).val(); $('#request_hidden_user_explanation_field').attr("value", "[loading default text...]"); - return $.ajax("<%= Configuration::admin_public_url %>/hidden_user_explanation?reason=" + reason + "&info_request_id=" + info_request_id, { + return $.ajax("/hidden_user_explanation?reason=" + reason + "&info_request_id=" + info_request_id, { type: "GET", dataType: "text", error: function(data, textStatus, jqXHR) { diff --git a/app/views/admin_general/admin_js.erb b/app/views/admin_general/admin_js.erb index c4c44dff0..61382dab3 100644 --- a/app/views/admin_general/admin_js.erb +++ b/app/views/admin_general/admin_js.erb @@ -17,7 +17,7 @@ info_request_id = $('#hide_request_form').attr('info_request_id'); reason = $(this).val(); $('#request_hidden_user_explanation_field').attr("value", "[loading default text...]"); - return $.ajax("<%= Configuration::admin_public_url %>/hidden_user_explanation?reason=" + reason + "&info_request_id=" + info_request_id, { + return $.ajax("/hidden_user_explanation?reason=" + reason + "&info_request_id=" + info_request_id, { type: "GET", dataType: "text", error: function(data, textStatus, jqXHR) { diff --git a/app/views/admin_general/index.rhtml b/app/views/admin_general/index.rhtml index 68b434ad9..cf4bc4312 100644 --- a/app/views/admin_general/index.rhtml +++ b/app/views/admin_general/index.rhtml @@ -64,8 +64,8 @@ <% for @request in @error_message_requests %> <tr> <td class="link"> - <%= link_to('<i class="icon-tags"></i>'.html_safe, request_admin_url(@request))%> - <%= link_to(@request.title, main_url(request_url(@request))) %> + <%= link_to('<i class="icon-tags"></i>'.html_safe, admin_request_show_path(@request))%> + <%= link_to(@request.title, request_path(@request)) %> </td> <td class="span2"> <%=simple_date(@request.get_last_event.created_at)%> @@ -90,8 +90,8 @@ <% for @request in @attention_requests %> <tr> <td class="link"> - <%= link_to('<i class="icon-tags"></i>'.html_safe, request_admin_url(@request))%> - <%= link_to(@request.title, main_url(request_url(@request))) %> + <%= link_to('<i class="icon-tags"></i>'.html_safe, admin_request_show_path(@request))%> + <%= link_to(@request.title, request_path(@request)) %> </td> <td class="span2"> <%=simple_date(@request.get_last_event.created_at)%> @@ -115,8 +115,8 @@ <% for @request in @requires_admin_requests %> <tr> <td class="link"> - <%= link_to('<i class="icon-tags"></i>'.html_safe, request_admin_url(@request))%> - <%= link_to(@request.title, main_url(request_url(@request))) %> + <%= link_to('<i class="icon-tags"></i>'.html_safe, admin_request_show_path(@request))%> + <%= link_to(@request.title, request_path(@request)) %> </td> <td class="span2"> <%=simple_date(@request.get_last_event.created_at)%> @@ -140,8 +140,8 @@ <% for @blank_contact in @blank_contacts %> <tr> <td class="link"> - <%= link_to('<i class="icon-tags"></i>'.html_safe, public_body_admin_url(@blank_contact))%> - <%= link_to h(@blank_contact.name), main_url(public_body_url(@blank_contact)) %> + <%= link_to('<i class="icon-tags"></i>'.html_safe, admin_body_show_path(@blank_contact))%> + <%= link_to h(@blank_contact.name), public_body_path(@blank_contact) %> </td> <td class="span2"> <%=simple_date(@blank_contact.updated_at)%> @@ -165,8 +165,8 @@ <% for @request in @old_unclassified %> <tr> <td class="link"> - <%= link_to("<i class='icon-tags'></i>".html_safe, request_admin_url(@request)) %> - <%= link_to(@request.title, main_url(request_link(@request))) %> + <%= link_to("<i class='icon-tags'></i>".html_safe, admin_request_show_path(@request)) %> + <%= link_to(@request.title, request_link(@request)) %> </td> <td class="span2"> <%=simple_date(@request.get_last_response_event.created_at)%> diff --git a/app/views/admin_general/stats.rhtml b/app/views/admin_general/stats.rhtml index b17c8bb2f..277df5437 100644 --- a/app/views/admin_general/stats.rhtml +++ b/app/views/admin_general/stats.rhtml @@ -10,7 +10,7 @@ <div class="span12"> <h1>Statistics</h1> <h2>Chart of requests (excluding backpaged)</h2> - <img src="<%= main_url("/foi-live-creation.png")%>"> + <img src="/foi-live-creation.png"> </div> </div> <div class="row"> @@ -33,7 +33,7 @@ <div class="row"> <div class="span12"> <h2>Chart of users</h2> - <img src="<%= main_url("/foi-user-use.png")%>"> + <img src="/foi-user-use.png"> </div> </div> <div class="row"> @@ -58,4 +58,3 @@ <h2>Web analytics</h2> </div> </div> - diff --git a/app/views/admin_general/timeline.rhtml b/app/views/admin_general/timeline.rhtml index 743296749..0c5f24279 100644 --- a/app/views/admin_general/timeline.rhtml +++ b/app/views/admin_general/timeline.rhtml @@ -31,8 +31,8 @@ <%= simple_time(event_at) %> <% if event.is_a? InfoRequestEvent %> - <%= link_to('<i class="icon-tags"></i>'.html_safe, request_admin_url(event.info_request), :title => "view full details")%> - <%= link_to(event.info_request.title, main_url(request_url(event.info_request)), :title => "view request on public website")%> + <%= link_to('<i class="icon-tags"></i>'.html_safe, admin_request_show_path(event.info_request), :title => "view full details")%> + <%= link_to(event.info_request.title, request_path(event.info_request), :title => "view request on public website")%> <% if event.event_type == 'edit' %> was edited by administrator <strong><%=h event.params[:editor] %></strong>. @@ -79,7 +79,7 @@ <% elsif event.event_type == 'response' %> <% incoming_message = event.incoming_message %> received - <%= link_to 'a response', main_url(incoming_message_url(incoming_message)) %> + <%= link_to 'a response', incoming_message_path(incoming_message) %> from <%=h event.info_request.public_body.name %>. <% elsif event.event_type == 'sent' %> was initially sent to <%=h event.params[:email]%> at <%=h event.info_request.public_body.name %>. @@ -95,8 +95,8 @@ had '<%=event.event_type%>' done to it, parameters <%=h event.params_yaml%>. <% end %> <% else %> - <%= link_to('<i class="icon-tags"></i>'.html_safe, public_body_admin_url(event.public_body), :title => "view full details")%> - <%= link_to(event.public_body.name, main_url(public_body_url(event.public_body)), :title => "view authority on public website")%> + <%= link_to('<i class="icon-tags"></i>'.html_safe, admin_body_show_path(event.public_body), :title => "view full details")%> + <%= link_to(event.public_body.name, public_body_path(event.public_body), :title => "view authority on public website")%> was created/updated by administrator <strong><%=h event.last_edit_editor %></strong> <% end %> <% end %> diff --git a/app/views/admin_public_body/_one_list.rhtml b/app/views/admin_public_body/_one_list.rhtml index 9c1b1e39c..cf1866212 100644 --- a/app/views/admin_public_body/_one_list.rhtml +++ b/app/views/admin_public_body/_one_list.rhtml @@ -4,7 +4,7 @@ <div class="accordion-heading accordion-toggle row"> <span class="item-title span6"> <a href="#body_<%=public_body.id%>" data-toggle="collapse" data-parent="requests"><i class="icon-chevron-right"></i></a> - <%= link_to(public_body.name, public_body_admin_url(public_body), :title => "view full details")%> + <%= link_to(public_body.name, admin_body_show_path(public_body), :title => "view full details")%> </span> <span class="item-metadata span6"> <%= render :partial => 'tags', :locals => { :body => public_body} %> @@ -13,11 +13,11 @@ <div id="body_<%=public_body.id%>" class="item-detail accordion-body collapse row"> <% public_body.for_admin_column do |name, value, type| %> - <div> - <span class="span6"> + <div> + <span class="span6"> <b><%=name%></b> </span> - <span class="span6"> + <span class="span6"> <% if type == 'datetime' %> <%= I18n.l(value, :format => "%e %B %Y %H:%M:%S") %> (<%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(value)) %>) @@ -32,12 +32,15 @@ <% end %> </div> -<% form_tag(admin_url("body/mass_tag_add"), :method => "post", :class => "form form-inline" ) do %> - <%= hidden_field_tag(:query, params[:query], { :id => "mass_add_tag_query_" + table_name } ) %> - <%= hidden_field_tag(:page, params[:page], { :id => "mass_add_page_" + table_name } ) %> - <%= hidden_field_tag(:table_name, table_name, { :id => "mass_add_tag_table_name_" + table_name } ) %> - <%= text_field_tag 'new_tag', params[:new_tag], { :size => 15, :id => "mass_add_tag_new_tag_" + table_name } %> - <%= submit_tag "Add tag to all", :class => "btn btn-primary" %> - (in table just above) +<% form_tag(admin_body_mass_tag_add_url, :method => "post", :class => "form form-inline" ) do %> + <p> + <%= text_field_tag 'new_tag', params[:new_tag], { :size => 15, :id => "mass_add_tag_new_tag_" + table_name } %> + <%= hidden_field_tag(:query, params[:query], { :id => "mass_add_tag_query_" + table_name } ) %> + <%= hidden_field_tag(:page, params[:page], { :id => "mass_add_page_" + table_name } ) %> + <%= hidden_field_tag(:table_name, table_name, { :id => "mass_add_tag_table_name_" + table_name } ) %> + <%= submit_tag "Add tag to all", :class => "btn btn-primary" %> + (in table just above) + </p> + <% end %> diff --git a/app/views/admin_public_body/_tags.rhtml b/app/views/admin_public_body/_tags.rhtml index ce3f47efa..26526f304 100644 --- a/app/views/admin_public_body/_tags.rhtml +++ b/app/views/admin_public_body/_tags.rhtml @@ -1,9 +1,9 @@ <% for t in body.tags %> <span class="label label-info tag"> <% if t.value %> - <a href="<%= admin_url('body/list') %>?query=<%= h(t.name)%>"><%= h(t.name) %></a>:<a href="<%=main_url(list_public_bodies_url(:tag => t.name_and_value, :only_path => true))%>"><%= h(t.value) %></a> + <%= link_to(h(t.name), list_public_bodies_path(:tag => t.name)) %>:<%= link_to(h(t.value), list_public_bodies_path(:tag => t.name_and_value)) %> <% else %> - <a href="<%= admin_url('body/list') %>?query=<%= h(t.name)%>"><%= h(t.name) %></a> + <%= link_to(h(t.name), list_public_bodies_path(:tag => t.name)) %> <% end %> </span> <% end %> diff --git a/app/views/admin_public_body/show.rhtml b/app/views/admin_public_body/show.rhtml index ae021f2ed..c59b90697 100644 --- a/app/views/admin_public_body/show.rhtml +++ b/app/views/admin_public_body/show.rhtml @@ -47,7 +47,7 @@ </table> <%= link_to _("Edit"), "../edit/#{@public_body.id}", :class => "btn btn-primary" %> <% unless @public_body.url_name.nil? %> - <%=link_to _("Public page"), main_url(public_body_url(@public_body)), :class => "btn" %> + <%=link_to _("Public page"), public_body_path(@public_body), :class => "btn" %> <% else %> <%=_("Public page not available")%> <% end %> diff --git a/app/views/admin_request/_some_requests.rhtml b/app/views/admin_request/_some_requests.rhtml index aed6edf16..03a77dd0b 100644 --- a/app/views/admin_request/_some_requests.rhtml +++ b/app/views/admin_request/_some_requests.rhtml @@ -4,10 +4,10 @@ <div class="accordion-heading accordion-toggle row"> <span class="item-title span6"> <a href="#request_<%=info_request.id%>" data-toggle="collapse" data-parent="requests"><i class="icon-chevron-right"></i></a> - <%= link_to(info_request.title, request_admin_url(info_request), :title => "view full details") %> + <%= link_to(info_request.title, admin_request_show_path(info_request), :title => "view full details") %> </span> <span class="item-metadata span6"> - <%= user_admin_link_for_request(info_request) %> <i class="icon-arrow-right"></i> <%= link_to("#{info_request.public_body.name}", public_body_admin_url(info_request.public_body)) %>, <%= time_ago_in_words(info_request.updated_at) %> ago + <%= user_admin_link_for_request(info_request) %> <i class="icon-arrow-right"></i> <%= link_to("#{info_request.public_body.name}", admin_body_show_path(info_request.public_body)) %>, <%= time_ago_in_words(info_request.updated_at) %> ago </span> </div> <div id="request_<%=info_request.id%>" class="item-detail accordion-body collapse row"> diff --git a/app/views/admin_request/show.rhtml b/app/views/admin_request/show.rhtml index c462ef83b..def158d67 100644 --- a/app/views/admin_request/show.rhtml +++ b/app/views/admin_request/show.rhtml @@ -23,7 +23,7 @@ <tbody> <tr> <th>Public page:</th> - <td><%= link_to main_url(request_url(@info_request)), main_url(request_url(@info_request)) %></td> + <td><%= link_to request_url(@info_request), request_path(@info_request) %></td> </tr> <% @info_request.for_admin_column do |name, value, type, column_name|%> <tr> @@ -57,7 +57,7 @@ <%= link_to("<i class='icon-eye-open'></i>".html_safe, @info_request.external_url, :title => "view URL of original request on external website") %> <%= @info_request.public_body.name %> on behalf of <%= (@info_request.user_name || _('an anonymous user'))%> (using API) <% else %> - <%= link_to("<i class='icon-eye-open'></i>".html_safe, user_url(@info_request.user), :title => "view user's page on public website") %> + <%= link_to("<i class='icon-eye-open'></i>".html_safe, user_path(@info_request.user), :title => "view user's page on public website") %> <%= user_admin_link_for_request(@info_request) %> <%= link_to _("move..."), "#", :class => "btn btn-mini btn-warning toggle-hidden" %> <div style="display:none;"> @@ -74,8 +74,8 @@ <b>Public authority:</b> </td> <td> - <%= link_to("<i class='icon-eye-open'></i>".html_safe, main_url(public_body_url(@info_request.public_body)), :title => "view authority on public website") %> - <%= link_to(@info_request.public_body.name, public_body_admin_url(@info_request.public_body)) %> + <%= link_to("<i class='icon-eye-open'></i>".html_safe, public_body_path(@info_request.public_body), :title => "view authority on public website") %> + <%= link_to(@info_request.public_body.name, admin_body_show_path(@info_request.public_body)) %> <%= link_to "move...", "#", :class => "btn btn-mini btn-warning toggle-hidden" %> <div style="display:none;"> <strong>url_name of new authority:</strong> @@ -344,9 +344,9 @@ <tbody> <tr> <td colspan="2"> - By <%= link_to("<i class='icon-eye-open'></i>".html_safe, user_url(comment.user), :title => "view user's page on public website") %> + By <%= link_to("<i class='icon-eye-open'></i>".html_safe, user_path(comment.user), :title => "view user's page on public website") %> - <%= link_to(h(comment.user.name), user_admin_url(comment.user)) %> + <%= link_to(h(comment.user.name), admin_user_show_path(comment.user)) %> </td> </tr> <% comment.for_admin_column do |name, value, type, column_name |%> diff --git a/app/views/admin_track/_some_tracks.rhtml b/app/views/admin_track/_some_tracks.rhtml index 33bf98db3..8ae7bd5c1 100644 --- a/app/views/admin_track/_some_tracks.rhtml +++ b/app/views/admin_track/_some_tracks.rhtml @@ -13,17 +13,17 @@ <a href="#track_<%=track_thing.id%>" data-toggle="collapse" data-parent="requests"><i class="icon-chevron-right"></i></a> <%=track_thing.id%>: <% if track_thing.public_body_id %> - <%= link_to "<code>#{h track_thing.track_query}</code>".html_safe, main_url(public_body_url(track_thing.public_body)) %> + <%= link_to "<code>#{h track_thing.track_query}</code>".html_safe, public_body_path(track_thing.public_body) %> <% elsif track_thing.info_request_id %> - <%= link_to "<code>#{h track_thing.track_query}</code>".html_safe, main_url(request_url(track_thing.info_request)) %> + <%= link_to "<code>#{h track_thing.track_query}</code>".html_safe, request_path(track_thing.info_request) %> <% elsif track_thing.tracked_user_id %> - <%= link_to "<code>#{h track_thing.track_query}</code>".html_safe, main_url(user_url(track_thing.tracked_user)) %> + <%= link_to "<code>#{h track_thing.track_query}</code>".html_safe, user_path(track_thing.tracked_user) %> <% else %> <code><%=h track_thing.track_query%></code> <% end %> <% if @admin_user.nil? %> <%# Do not show this on the list of tracks on the user page, because it’s rather repetitive there %> - tracked by <%=link_to '<i class="icon-eye-open"></i>'.html_safe, user_admin_url(track_thing.tracking_user) %> <%=link_to h(track_thing.tracking_user.name), main_url(user_url(track_thing.tracking_user)) %> + tracked by <%=link_to '<i class="icon-eye-open"></i>'.html_safe, admin_user_show_path(track_thing.tracking_user) %> <%=link_to h(track_thing.tracking_user.name), user_path(track_thing.tracking_user) %> <% end %> </div> <div id="track_<%=track_thing.id%>" class="accordion-body collapse"> @@ -52,7 +52,7 @@ <%= I18n.l(track_thing.send(column.name), :format => "%e %B %Y %H:%M:%S") %> (<%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(track_thing.send(column.name))) %>) <% elsif column.name == 'track_medium' and track_thing.track_medium == 'feed' %> - <%= link_to track_thing.track_medium, atom_feed_url(:track_id => track_thing.id) %> + <%= link_to track_thing.track_medium, atom_feed_path(:track_id => track_thing.id) %> <% else %> <%= h track_thing.send(column.name)%> <% end %> diff --git a/app/views/admin_track/list.rhtml b/app/views/admin_track/list.rhtml index f39cc31e9..f40ad4e75 100644 --- a/app/views/admin_track/list.rhtml +++ b/app/views/admin_track/list.rhtml @@ -14,7 +14,7 @@ <h2>Current top tracks:</h2> <ol> <% for row in @popular %> - <li><%= link_to row['title'], admin_url('request/show/' + row['info_request_id']) %> (<%= row['count'] %> people following)</li> + <li><%= link_to row['title'], admin_request_show_path(row['info_request_id']) %> (<%= row['count'] %> people following)</li> <% end %> </ol> diff --git a/app/views/admin_user/_user_table.rhtml b/app/views/admin_user/_user_table.rhtml index 9c996b542..a4227e017 100644 --- a/app/views/admin_user/_user_table.rhtml +++ b/app/views/admin_user/_user_table.rhtml @@ -4,14 +4,14 @@ <div class="accordion-heading accordion-toggle"> <span class="item-title"> <a href="#user_<%=user.id%>" data-toggle="collapse" data-parent="requests"><i class="icon-chevron-right"></i></a> - <% if user.admin_level == "super" %> + <% if user.admin_level == "super" %> <span class="label">superuser</span> - <% end %> - <%= link_to("#{h(user.name)}", user_admin_url(user))%> + <% end %> + <%= link_to("#{h(user.name)}", admin_user_show_path(user))%> <%= link_to("(#{h(user.email)})", "mailto:#{h(user.email)}")%> </span> <span class="item-metadata"> - updated <%=I18n.l(user.updated_at, :format => "%e %B %Y %H:%M:%S")%> + updated <%=I18n.l(user.updated_at, :format => "%e %B %Y %H:%M:%S")%> </span> </div> <div id="user_<%=user.id%>" class="accordion-body collapse"> diff --git a/app/views/admin_user/show.rhtml b/app/views/admin_user/show.rhtml index 30251d211..ccf2694b9 100644 --- a/app/views/admin_user/show.rhtml +++ b/app/views/admin_user/show.rhtml @@ -5,7 +5,7 @@ <% if @admin_user.profile_photo %> <div class="user_photo_on_admin"> <% form_tag "../clear_profile_photo/#{@admin_user.id}", :multipart => true, :class => "form" do %> - <img src="<%= main_url(get_profile_photo_url(:url_name => @admin_user.url_name, :only_path => true)) %>"> + <img src="<%= get_profile_photo_url(:url_name => @admin_user.url_name) %>"> <br> <%= submit_tag "Clear photo", :class => "btn btn-info" %> <% end %> @@ -32,7 +32,7 @@ <%=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"), "../show_bounce_message/#{@admin_user.id}"%> + <%= link_to _("See bounce message"), admin_user_show_bounce(@admin_user.id) %> <% end %> <% else %> <%=h admin_value(value)%> @@ -48,10 +48,10 @@ </tbody> </table> + <%= link_to 'Edit', '../edit/' + @admin_user.id.to_s, :class => "btn btn-primary" %> -<%= link_to 'Public page', main_url(user_url(@admin_user)), :class => "btn" %> +<%= link_to 'Public page', user_path(@admin_user), :class => "btn" %> <%= link_to "Log in as #{@admin_user.name} (also confirms their email)", "../login_as/#{@admin_user.id}", :class => "btn btn-info" %> -</p> <hr> @@ -75,7 +75,7 @@ <td><%=h post_redirect.id %></td> <% for column in PostRedirect.content_columns.map { |c| c.name } %> <% if column == 'email_token' %> - <td><%=link_to post_redirect.send(column), main_url(confirm_url(:email_token => post_redirect.send(column), :only_path => true)) %></td> + <td><%=link_to post_redirect.send(column), confirm_path(:email_token => post_redirect.send(column)) %></td> <% else %> <td><%=h post_redirect.send(column) %></td> <% end %> diff --git a/app/views/api/request_events.atom.builder b/app/views/api/request_events.atom.builder index 44759ae7e..648a81e5c 100644 --- a/app/views/api/request_events.atom.builder +++ b/app/views/api/request_events.atom.builder @@ -8,7 +8,7 @@ atom_feed("xmlns:alaveteli" => "http://www.alaveteli.org/API/v2/RequestEvents/At entry.updated(event.created_at.utc.iso8601) entry.tag!("alaveteli:event_type", event.event_type) - entry.tag!("alaveteli:request_url", main_url(request_url(request))) + entry.tag!("alaveteli:request_url", request_url(request)) entry.title(request.title) entry.content(event.outgoing_message.body, :type => 'text') @@ -16,7 +16,7 @@ atom_feed("xmlns:alaveteli" => "http://www.alaveteli.org/API/v2/RequestEvents/At entry.author do |author| author.name(request.user_name) if !request.user.nil? - author.uri(main_url(user_url(request.user))) + author.uri(user_url(request.user)) end author.email(request.incoming_email) end diff --git a/app/views/comment/_single_comment.rhtml b/app/views/comment/_single_comment.rhtml index b645721cf..421a9d4ba 100644 --- a/app/views/comment/_single_comment.rhtml +++ b/app/views/comment/_single_comment.rhtml @@ -17,11 +17,11 @@ </div> <p class="event_actions"> <% if !comment.id.nil? %> - <%= link_to "Link to this", comment_url(comment), :class => "link_to_this" %> + <%= link_to "Link to this", comment_path(comment), :class => "link_to_this" %> <% if !@user.nil? && @user.admin_page_links? %> - | <%= link_to "Admin", admin_url("request/edit_comment/" + comment.id.to_s) %> + | <%= link_to "Admin", admin_request_edit_comment_path(comment) %> <% end %> - <!-- | <%= link_to _('Report abuse'), comment_url(comment) %> --> + <!-- | <%= link_to _('Report abuse'), comment_path(comment) %> --> <% end %> </p> </div> diff --git a/app/views/contact_mailer/from_admin_message.rhtml b/app/views/contact_mailer/from_admin_message.rhtml index 43938e0dd..4169d8d3a 100644 --- a/app/views/contact_mailer/from_admin_message.rhtml +++ b/app/views/contact_mailer/from_admin_message.rhtml @@ -1,2 +1,2 @@ -<%= @message %> +<%= raw @message %> diff --git a/app/views/contact_mailer/to_admin_message.rhtml b/app/views/contact_mailer/to_admin_message.rhtml index 9c0a74c02..dc9b1090b 100644 --- a/app/views/contact_mailer/to_admin_message.rhtml +++ b/app/views/contact_mailer/to_admin_message.rhtml @@ -1,11 +1,11 @@ -<%= @message.strip %> +<%= raw @message.strip %> --------------------------------------------------------------------- <%= _('Message sent using {{site_name}} contact form, ', :site_name=>site_name)%> -<%=(@logged_in_user ? ("logged in as user " + main_url(user_url(@logged_in_user))) : "not logged in")%><% if !@last_request.nil? %> +<%=(@logged_in_user ? ("logged in as user " + user_url(@logged_in_user)) : "not logged in")%><% if !@last_request.nil? %> -<%= _('Last request viewed: ')%><%= main_url(request_url(@last_request)) %> +<%= _('Last request viewed: ')%><%= request_url(@last_request) %> <% end %> <% if !@last_body.nil? %> -<%= _('Last authority viewed: ')%><%= main_url(public_body_url(@last_body)) %> +<%= _('Last authority viewed: ')%><%= public_body_url(@last_body) %> <% end %>--------------------------------------------------------------------- diff --git a/app/views/contact_mailer/user_message.rhtml b/app/views/contact_mailer/user_message.rhtml index b1d6e81ae..afa1494db 100644 --- a/app/views/contact_mailer/user_message.rhtml +++ b/app/views/contact_mailer/user_message.rhtml @@ -5,7 +5,7 @@ learn your email address. Only reply if that is okay.', :user_name => @from_user.name) %> --------------------------------------------------------------------- -<%= @message.strip %> +<%= raw @message.strip %> --------------------------------------------------------------------- <%= _('View Freedom of Information requests made by {{user_name}}:', :user_name=>@from_user.name)%> diff --git a/app/views/general/_advanced_search_tips.rhtml b/app/views/general/_advanced_search_tips.rhtml index 914abc1af..08ce04439 100644 --- a/app/views/general/_advanced_search_tips.rhtml +++ b/app/views/general/_advanced_search_tips.rhtml @@ -23,27 +23,27 @@ <p><%= _("All the options below can use <strong>status</strong> or <strong>latest_status</strong> before the colon. For example, <strong>status:not_held</strong> will match requests which have <em>ever</em> been marked as not held; <strong>latest_status:not_held</strong> will match only requests that are <em>currently</em> marked as not held.") %></p> <table class="status_table"> - <tr><td><strong><%=search_link('status:waiting_response', nil, nil, true)%></strong></td><td><%= _('Waiting for the public authority to reply') %></td></tr> - <tr><td><strong><%=search_link('status:not_held', nil, nil, true)%></strong></td><td><%= _('The public authority does not have the information requested') %></td></tr> - <tr><td><strong><%=search_link('status:rejected', nil, nil, true)%></strong></td><td><%= _('The request was refused by the public authority') %></td></tr> - <tr><td><strong><%=search_link('status:partially_successful', nil, nil, true)%></strong></td><td><%= _('Some of the information requested has been received') %></td></tr> - <tr><td><strong><%=search_link('status:successful', nil, nil, true)%></strong></td><td><%= _('All of the information requested has been received') %></td></tr> - <tr><td><strong><%=search_link('status:waiting_clarification', nil, nil, true)%></strong></td><td><%= _('The public authority would like part of the request explained') %></td></tr> - <tr><td><strong><%=search_link('status:gone_postal', nil, nil, true)%></strong></td><td><%= _('The public authority would like to / has responded by post') %></td></tr> - <tr><td><strong><%=search_link('status:internal_review', nil, nil, true)%></strong></td><td><%= _('Waiting for the public authority to complete an internal review of their handling of the request') %></td></tr> - <tr><td><strong><%=search_link('status:error_message', nil, nil, true)%></strong></td><td><%= _('Received an error message, such as delivery failure.') %></td></tr> - <tr><td><strong><%=search_link('status:requires_admin', nil, nil, true)%></strong></td><td><%= _('A strange reponse, required attention by the {{site_name}} team', :site_name=>site_name) %></td></tr> - <tr><td><strong><%=search_link('status:user_withdrawn', nil, nil, true)%></strong></td><td><%= _('The requester has abandoned this request for some reason') %></td></tr> + <tr><td><strong><%=search_link('status:waiting_response')%></strong></td><td><%= _('Waiting for the public authority to reply') %></td></tr> + <tr><td><strong><%=search_link('status:not_held')%></strong></td><td><%= _('The public authority does not have the information requested') %></td></tr> + <tr><td><strong><%=search_link('status:rejected')%></strong></td><td><%= _('The request was refused by the public authority') %></td></tr> + <tr><td><strong><%=search_link('status:partially_successful')%></strong></td><td><%= _('Some of the information requested has been received') %></td></tr> + <tr><td><strong><%=search_link('status:successful')%></strong></td><td><%= _('All of the information requested has been received') %></td></tr> + <tr><td><strong><%=search_link('status:waiting_clarification')%></strong></td><td><%= _('The public authority would like part of the request explained') %></td></tr> + <tr><td><strong><%=search_link('status:gone_postal')%></strong></td><td><%= _('The public authority would like to / has responded by post') %></td></tr> + <tr><td><strong><%=search_link('status:internal_review')%></strong></td><td><%= _('Waiting for the public authority to complete an internal review of their handling of the request') %></td></tr> + <tr><td><strong><%=search_link('status:error_message')%></strong></td><td><%= _('Received an error message, such as delivery failure.') %></td></tr> + <tr><td><strong><%=search_link('status:requires_admin')%></strong></td><td><%= _('A strange reponse, required attention by the {{site_name}} team', :site_name=>site_name) %></td></tr> + <tr><td><strong><%=search_link('status:user_withdrawn')%></strong></td><td><%= _('The requester has abandoned this request for some reason') %></td></tr> </table> <h2 id="varieties"><%= _('Table of varieties') %></h2> <p><%= _("All the options below can use <strong>variety</strong> or <strong>latest_variety</strong> before the colon. For example, <strong>variety:sent</strong> will match requests which have <em>ever</em> been sent; <strong>latest_variety:sent</strong> will match only requests that are <em>currently</em> marked as sent.") %></p> <table class="status_table"> - <tr><td><strong><%=search_link('variety:sent', nil, nil, true)%></strong></td><td><%= _('Original request sent') %></td></tr> - <tr><td><strong><%=search_link('variety:followup_sent', nil, nil, true)%></strong></td><td><%= _('Follow up message sent by requester') %></td></tr> - <tr><td><strong><%=search_link('variety:response', nil, nil, true)%></strong></td><td><%= _('Response from a public authority') %></td></tr> - <tr><td><strong><%=search_link('variety:comment', nil, nil, true)%></strong></td><td><%= _('Annotation added to request') %></td></tr> - <tr><td><strong><%=search_link('variety:authority', nil, nil, true)%></strong></td><td><%= _('A public authority') %></td></tr> - <tr><td><strong><%=search_link('variety:user', nil, nil, true)%></strong></td><td><%= _('A {{site_name}} user', :site_name=>site_name) %></td></tr> + <tr><td><strong><%=search_link('variety:sent')%></strong></td><td><%= _('Original request sent') %></td></tr> + <tr><td><strong><%=search_link('variety:followup_sent')%></strong></td><td><%= _('Follow up message sent by requester') %></td></tr> + <tr><td><strong><%=search_link('variety:response')%></strong></td><td><%= _('Response from a public authority') %></td></tr> + <tr><td><strong><%=search_link('variety:comment')%></strong></td><td><%= _('Annotation added to request') %></td></tr> + <tr><td><strong><%=search_link('variety:authority')%></strong></td><td><%= _('A public authority') %></td></tr> + <tr><td><strong><%=search_link('variety:user')%></strong></td><td><%= _('A {{site_name}} user', :site_name=>site_name) %></td></tr> </table> </div> diff --git a/app/views/general/_footer.rhtml b/app/views/general/_footer.rhtml index ab5ab2c47..36f3919f0 100644 --- a/app/views/general/_footer.rhtml +++ b/app/views/general/_footer.rhtml @@ -1,5 +1,5 @@ <div id="footer"> - <%= link_to _("Contact {{site_name}}", :site_name => site_name), help_contact_url %> + <%= link_to _("Contact {{site_name}}", :site_name => site_name), help_contact_path %> | <img src="/images/twitter-16.png" alt="twitter icon" class="twitter-icon"> <a href="https://twitter.com/<%= Configuration::twitter_username %>"><%= _("Follow us on twitter") %></a> <%= render :partial => 'general/credits' %> </div> diff --git a/app/views/general/_frontpage_bodies_list.rhtml b/app/views/general/_frontpage_bodies_list.rhtml index 503b38953..54400602b 100644 --- a/app/views/general/_frontpage_bodies_list.rhtml +++ b/app/views/general/_frontpage_bodies_list.rhtml @@ -11,7 +11,7 @@ <% end%> </ul> <p><strong> - <%= link_to _('Browse all authorities...'), list_public_bodies_default %> + <%= link_to _('Browse all authorities...'), list_public_bodies_default_path %> </strong></p> </div> <% end %> diff --git a/app/views/general/_frontpage_intro_sentence.rhtml b/app/views/general/_frontpage_intro_sentence.rhtml index 70b47ad06..74b849fc9 100644 --- a/app/views/general/_frontpage_intro_sentence.rhtml +++ b/app/views/general/_frontpage_intro_sentence.rhtml @@ -1,4 +1,4 @@ <h2> Your <strong>Right to Know</strong> </h2> -<p>Every citizen has the right to access information held by public authorities. <strong>By law, they have to respond</strong>. <a href="<%= help_about_url %>">Find out more about freedom of information.</a></p> +<p>Every citizen has the right to access information held by public authorities. <strong>By law, they have to respond</strong>. <a href="<%= help_about_path %>">Find out more about freedom of information.</a></p> diff --git a/app/views/general/_frontpage_requests_list.rhtml b/app/views/general/_frontpage_requests_list.rhtml index 3b0efb65e..fa498dfa7 100644 --- a/app/views/general/_frontpage_requests_list.rhtml +++ b/app/views/general/_frontpage_requests_list.rhtml @@ -19,17 +19,17 @@ :public_body_link => public_body_link(event.info_request.public_body)) %> <% end %> - <%=link_to h(event.info_request.title), request_url(event.info_request)%> + <%=link_to h(event.info_request.title), request_path(event.info_request)%> <%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(event.described_at)) %> - <p class="excerpt" onclick="document.location.href='<%=request_url(event.info_request)%>'"><%= excerpt(event.search_text_main(true), "", 200) %></p> + <p class="excerpt" onclick="document.location.href='<%=request_path(event.info_request)%>'"><%= excerpt(event.search_text_main(true), "", 200) %></p> </li> <% end %> </ul> <p><strong> <% if @request_events_all_successful %> - <%=link_to _('More successful requests...'), request_list_successful_url %> + <%=link_to _('More successful requests...'), request_list_successful_path %> <% else %> - <%=link_to _('More requests...'), request_list_all_url %> + <%=link_to _('More requests...'), request_list_all_path %> <% end %> </strong></p> </div> diff --git a/app/views/general/_orglink.rhtml b/app/views/general/_orglink.rhtml index fbe688d85..66002c021 100644 --- a/app/views/general/_orglink.rhtml +++ b/app/views/general/_orglink.rhtml @@ -1,2 +1,2 @@ <%# Put the link to your organisation here, or leave blank %> -<%= link_to image_tag('logo.png'), frontpage_url, :id=>'logo' %> +<%= link_to image_tag('logo.png'), frontpage_path, :id=>'logo' %> diff --git a/app/views/general/_topnav.rhtml b/app/views/general/_topnav.rhtml index 8ef928bba..c7f2cedea 100644 --- a/app/views/general/_topnav.rhtml +++ b/app/views/general/_topnav.rhtml @@ -1,10 +1,10 @@ <div id="topnav"> <ul id="navigation"> - <li class="<%= 'selected' if params[:controller] == 'general' and params[:action] != 'blog' and params[:action] != 'search' %>"><%= link_to _("Home"), frontpage_url %></li> - <li class="<%= 'selected' if params[:controller] == 'request' and ['new', 'select_authority'].include?(params[:action]) %>"><%= link_to _("Make a request"), select_authority_url, :id => 'make-request-link' %></li> - <li class="<%= 'selected' if params[:controller] == 'request' and !['new', 'select_authority'].include?(params[:action]) %>"><%= link_to _("View requests"), request_list_successful_url %></li> - <li class="<%= 'selected' if params[:controller] == 'public_body' %>"><%= link_to _("View authorities"), list_public_bodies_default %></li> - <li class="<%= 'selected' if params[:controller] == 'general' and params[:action] == 'blog' %>"><%= link_to _("Read blog"), blog_url %></li> - <li class="<%= 'selected' if params[:controller] == 'help' %>"><%= link_to _("Help"), help_about_url %></li> + <li class="<%= 'selected' if params[:controller] == 'general' and params[:action] != 'blog' and params[:action] != 'search' %>"><%= link_to _("Home"), frontpage_path %></li> + <li class="<%= 'selected' if params[:controller] == 'request' and ['new', 'select_authority'].include?(params[:action]) %>"><%= link_to _("Make a request"), select_authority_path, :id => 'make-request-link' %></li> + <li class="<%= 'selected' if params[:controller] == 'request' and !['new', 'select_authority'].include?(params[:action]) %>"><%= link_to _("View requests"), request_list_successful_path %></li> + <li class="<%= 'selected' if params[:controller] == 'public_body' %>"><%= link_to _("View authorities"), list_public_bodies_default_path %></li> + <li class="<%= 'selected' if params[:controller] == 'general' and params[:action] == 'blog' %>"><%= link_to _("Read blog"), blog_path %></li> + <li class="<%= 'selected' if params[:controller] == 'help' %>"><%= link_to _("Help"), help_about_path %></li> </ul> </div> diff --git a/app/views/general/search.rhtml b/app/views/general/search.rhtml index 7d402b9b9..50f9f9286 100644 --- a/app/views/general/search.rhtml +++ b/app/views/general/search.rhtml @@ -43,7 +43,7 @@ <%= hidden_field_tag 'bodies', 1 %> <% end %> <%= submit_tag _("Search") %> - <%= link_to(_("Advanced search"), advanced_search_url) %> + <%= link_to(_("Advanced search"), advanced_search_path) %> </p> <div id="common-subfilters"> @@ -56,7 +56,7 @@ ["all", _("everything")]]%> <% for variety, label in labels %> <% if @variety_postfix != variety %> - <%= link_to label, search_url([params[:query], variety, @sort_postfix]) %> + <%= link_to label, search_path([params[:query], variety, @sort_postfix]) %> <% else %> <%= label %> <% end %> @@ -122,9 +122,9 @@ <% if !@query.nil? %> <p id="search_controls"> - <%=link_to_unless @sortby == 'relevant', _("Show most relevant results first"), search_url([params[:query], @variety_postfix, 'relevant'], params) %> + <%=link_to_unless @sortby == 'relevant', _("Show most relevant results first"), search_path([params[:query], @variety_postfix, 'relevant'], params) %> | - <%=link_to_unless @sortby == 'newest', _("Newest results first"), search_url([params[:query], @variety_postfix, 'newest'], params) %> + <%=link_to_unless @sortby == 'newest', _("Newest results first"), search_path([params[:query], @variety_postfix, 'newest'], params) %> <% if @sortby == 'described' %> | <%= _('Recently described results first') %> <% end %> @@ -162,9 +162,9 @@ <%= will_paginate WillPaginate::Collection.new(@page, @bodies_per_page, @xapian_bodies.matches_estimated) %> <% elsif @bodies && !@query.nil? && @xapian_bodies.results.size == 0 && @page == 1 %> <% if @spelling_correction %> - <p id="did_you_mean"><%= _('Did you mean: {{correction}}', :correction => search_link(@spelling_correction, @postfix)) %></p> + <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, help_requesting_path + '#missing_body']) %></p> + <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> <% end %> </div> diff --git a/app/views/help/api.rhtml b/app/views/help/api.rhtml index da6253f87..3a6c867ee 100644 --- a/app/views/help/api.rhtml +++ b/app/views/help/api.rhtml @@ -19,7 +19,7 @@ <dt>Linking to new requests</dt> <dd> <p>To encourage your users to make links to a particular public authority, use URLs of the form - <%= link_to new_request_to_body_url(:url_name => "liverpool_city_council") , new_request_to_body_url(:url_name => "liverpool_city_council") %>. + <%= link_to new_request_to_body_path(:url_name => "liverpool_city_council") , new_request_to_body_path(:url_name => "liverpool_city_council") %>. These are the parameters you can add to those URLs, either in the URL or from a form. <ul> @@ -67,7 +67,7 @@ <dd> <p> A spreadsheet file listing every body in WhatDoTheyKnow is available: - <%= link_to "all-authorities.csv", all_public_bodies_csv_url() %> + <%= link_to "all-authorities.csv", all_public_bodies_csv_path %> </p> </dd> diff --git a/app/views/help/contact.rhtml b/app/views/help/contact.rhtml index fab5017b8..b1b5d4f24 100644 --- a/app/views/help/contact.rhtml +++ b/app/views/help/contact.rhtml @@ -46,7 +46,7 @@ <p> <label class="form_label" for="contact_name">Your name:</label> <%= f.text_field :name, :size => 20 %> - (or <%= link_to "sign in", signin_url(:r => request.request_uri) %>) + (or <%= link_to "sign in", signin_path(:r => request.request_uri) %>) </p> <p> diff --git a/app/views/help/unhappy.rhtml b/app/views/help/unhappy.rhtml index 2b00341c2..79e3f8273 100644 --- a/app/views/help/unhappy.rhtml +++ b/app/views/help/unhappy.rhtml @@ -29,7 +29,7 @@ to your request '<%=request_link(@info_request) %>'? <p> <% if !@info_request.nil? %> - <%= link_to "Request an internal review", show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil) + "?internal_review=1#followup", :class => 'link_button_green' %> and then write a message asking the authority to review your request. + <%= link_to "Request an internal review", show_response_no_followup_path(:id => @info_request.id, :incoming_message_id => nil) + "?internal_review=1#followup", :class => 'link_button_green' %> and then write a message asking the authority to review your request. <% else %> At the bottom of the relevant request page on <%= site_name %> choose "request an internal review". Then write a message asking for an internal @@ -62,7 +62,7 @@ to the Scottish Information Commissioner</a>. Information Commissioner, either <% if !@info_request.nil? %> include a link to your request - <strong><%=h main_url(request_url(@info_request)) %></strong> + <strong><%=h request_url(@info_request) %></strong> <% else %> include a link to your request on <%= site_name %> <% end %> diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml index 950918f02..1e6a61f58 100644 --- a/app/views/layouts/default.rhtml +++ b/app/views/layouts/default.rhtml @@ -32,7 +32,7 @@ <% end %> <% end %> <% if @has_json %> - <link rel="alternate" type="application/json" title="JSON version of this page" href="<%=h main_url(request.request_uri, '.json') %>"> + <link rel="alternate" type="application/json" title="JSON version of this page" href="<%=h url_for(request.query_parameters.merge(:format => 'json')) %>"> <% end %> <% if @no_crawl %> @@ -92,9 +92,9 @@ <% end %> - <%= link_to _("Sign out"), signout_url(:r => request.request_uri) %> + <%= link_to _("Sign out"), signout_path(:r => request.request_uri) %> <% else %> - <%= link_to _("Sign in or sign up"), signin_url(:r => request.request_uri) %> + <%= link_to _("Sign in or sign up"), signin_path(:r => request.request_uri) %> <% end %> </div> <% end %> diff --git a/app/views/outgoing_mailer/followup.rhtml b/app/views/outgoing_mailer/followup.rhtml index 7050a295b..049ebc881 100644 --- a/app/views/outgoing_mailer/followup.rhtml +++ b/app/views/outgoing_mailer/followup.rhtml @@ -1,6 +1,6 @@ -<%= @outgoing_message.body.strip %> +<%= raw @outgoing_message.body.strip %> -<%= @outgoing_message.quoted_part_to_append_to_email.strip %> +<%= raw @outgoing_message.quoted_part_to_append_to_email.strip %> ------------------------------------------------------------------- <%= _('Please use this email address for all replies to this request:')%> diff --git a/app/views/outgoing_mailer/initial_request.rhtml b/app/views/outgoing_mailer/initial_request.rhtml index d537a20bc..5c418ecc7 100644 --- a/app/views/outgoing_mailer/initial_request.rhtml +++ b/app/views/outgoing_mailer/initial_request.rhtml @@ -1,4 +1,4 @@ -<%= @outgoing_message.body.strip %> +<%= raw @outgoing_message.body.strip %> ------------------------------------------------------------------- diff --git a/app/views/public_body/_alphabet.rhtml b/app/views/public_body/_alphabet.rhtml index 92674b8aa..46b345c2a 100644 --- a/app/views/public_body/_alphabet.rhtml +++ b/app/views/public_body/_alphabet.rhtml @@ -1,3 +1,3 @@ <% "A".upto("Z") do |l| -%> - <%= link_to_unless (@tag == l), l, list_public_bodies_url(:tag => l.downcase) %> + <%= link_to_unless (@tag == l), l, list_public_bodies_path(:tag => l.downcase) %> <% end %> diff --git a/app/views/public_body/_body_listing_single.rhtml b/app/views/public_body/_body_listing_single.rhtml index b01d2ebb2..d0496fbb8 100644 --- a/app/views/public_body/_body_listing_single.rhtml +++ b/app/views/public_body/_body_listing_single.rhtml @@ -4,7 +4,7 @@ <div class="body_listing"> <span class="head"> - <%= link_to highlight_words(public_body.name, @highlight_words), public_body_url(public_body) %> + <%= link_to highlight_words(public_body.name, @highlight_words), public_body_path(public_body) %> </span> <span class="desc"> <% if !public_body.short_name.empty? || !public_body.notes_without_html.empty? %> @@ -20,7 +20,7 @@ <span class="bottomline"> <%= n_('%d request made.', '%d requests made.', public_body.info_requests.size) % public_body.info_requests.size %> <% if !@include_request_link_in_authority_listing.nil? %> - <%= link_to _("Make your own request"), public_body_url(public_body) %>. + <%= link_to _("Make your own request"), public_body_path(public_body) %>. <% end %> <br> <span class="date_added"> diff --git a/app/views/public_body/_list_sidebar_extra.rhtml b/app/views/public_body/_list_sidebar_extra.rhtml index 54f20a736..d3d65fec8 100644 --- a/app/views/public_body/_list_sidebar_extra.rhtml +++ b/app/views/public_body/_list_sidebar_extra.rhtml @@ -2,5 +2,5 @@ <%= raw(_('<a href="%s">Are we missing a public authority?</a>') % [help_requesting_path + '#missing_body']) %> </p> <p> - <%= link_to _('List of all authorities (CSV)'), all_public_bodies_csv_url() %> + <%= link_to _('List of all authorities (CSV)'), all_public_bodies_csv_path %> </p> diff --git a/app/views/public_body/list.rhtml b/app/views/public_body/list.rhtml index dd97b99fd..ea5cd9613 100644 --- a/app/views/public_body/list.rhtml +++ b/app/views/public_body/list.rhtml @@ -10,7 +10,7 @@ <% for row in PublicBodyCategories::get().with_headings() %> <% if row.instance_of?(Array) %> <li> - <%= link_to_unless (@tag == row[0]), row[1], list_public_bodies_url(:tag => row[0]) %> + <%= link_to_unless (@tag == row[0]), row[1], list_public_bodies_path(:tag => row[0]) %> </li> <% else %> <% if not first_row %> diff --git a/app/views/public_body/show.rhtml b/app/views/public_body/show.rhtml index 8fc1eadda..df6346e4f 100644 --- a/app/views/public_body/show.rhtml +++ b/app/views/public_body/show.rhtml @@ -26,7 +26,7 @@ <% end %> <% end %> <% end %> - <%= link_to _('View FOI email address'), view_public_body_email_url(@public_body.url_name) %><br> + <%= link_to _('View FOI email address'), view_public_body_email_path(@public_body.url_name) %><br> </div> <div id="header_left"> @@ -37,7 +37,7 @@ <%=@public_body.type_of_authority(true)%><% if not @public_body.short_name.empty? %>, <%= _('also called {{public_body_short_name}}', :public_body_short_name => h(@public_body.short_name))%><% end %> <% if !@user.nil? && @user.admin_page_links? %> - (<%= link_to _("admin"), public_body_admin_url(@public_body) %>) + (<%= link_to _("admin"), admin_body_show_path(@public_body) %>) <% end %> </p> diff --git a/app/views/public_body/view_email.rhtml b/app/views/public_body/view_email.rhtml index 79d7f7f4c..3799d227b 100644 --- a/app/views/public_body/view_email.rhtml +++ b/app/views/public_body/view_email.rhtml @@ -35,9 +35,9 @@ <div id="stepwise_make_request_view_email"> <strong> <% if @public_body.eir_only? %> - <%= link_to "Make a new EIR request", new_request_to_body_url(:url_name => @public_body.url_name)%> + <%= link_to "Make a new EIR request", new_request_to_body_path(:url_name => @public_body.url_name)%> <% else %> - <%= link_to "Make a new FOI request", new_request_to_body_url(:url_name => @public_body.url_name)%> + <%= link_to "Make a new FOI request", new_request_to_body_path(:url_name => @public_body.url_name)%> <% end %> to <%= h(@public_body.name) %> </strong> diff --git a/app/views/request/_after_actions.rhtml b/app/views/request/_after_actions.rhtml index 3d74cf42d..d3ddb981b 100644 --- a/app/views/request/_after_actions.rhtml +++ b/app/views/request/_after_actions.rhtml @@ -7,7 +7,7 @@ <ul> <% if @info_request.comments_allowed? %> <li> - <%= raw(_('<a href="%s">Add an annotation</a> (to help the requester or others)') % [new_comment_url(:url_title => @info_request.url_title)]) %> + <%= raw(_('<a href="%s">Add an annotation</a> (to help the requester or others)') % [new_comment_path(:url_title => @info_request.url_title)]) %> </li> <% end %> <% if @old_unclassified %> @@ -17,7 +17,7 @@ <% end %> <% if @info_request.all_can_view? %> <li> - <%= link_to _("Download a zip file of all correspondence"), download_entire_request_url(:url_title => @info_request.url_title) %> + <%= link_to _("Download a zip file of all correspondence"), download_entire_request_path(:url_title => @info_request.url_title) %> </li> <% end %> </ul> @@ -29,18 +29,18 @@ <li> <% if @last_response.nil? %> - <%= link_to _("Send a followup"), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil) + "#followup" %> + <%= link_to _("Send a followup"), show_response_no_followup_path(:id => @info_request.id, :incoming_message_id => nil) + "#followup" %> <% else %> - <%= link_to _("Write a reply"), show_response_url(:id => @info_request.id, :incoming_message_id => @last_response.id) + "#followup" %> + <%= link_to _("Write a reply"), show_response_path(:id => @info_request.id, :incoming_message_id => @last_response.id) + "#followup" %> <% end %> </li> <% if !@old_unclassified %> <li> - <%= link_to _("Update the status of this request"), request_url(@info_request, :update_status => 1) %> + <%= link_to _("Update the status of this request"), request_path(@info_request, :update_status => 1) %> </li> <% end %> <li> - <%= link_to _("Request an internal review"), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil) + "?internal_review=1#followup" %> + <%= link_to _("Request an internal review"), show_response_no_followup_path(:id => @info_request.id, :incoming_message_id => nil) + "?internal_review=1#followup" %> </li> </ul> </div> @@ -50,7 +50,7 @@ <strong><%= _('{{public_body_name}} only:',:public_body_name=>h(@info_request.public_body.name) ) %> </strong> <ul> <li> - <%= link_to _("Respond to request"), upload_response_url(:url_title => @info_request.url_title) %> + <%= link_to _("Respond to request"), upload_response_path(:url_title => @info_request.url_title) %> </li> </ul> </div> diff --git a/app/views/request/_bubble.rhtml b/app/views/request/_bubble.rhtml index 747e2aa1f..94498612a 100644 --- a/app/views/request/_bubble.rhtml +++ b/app/views/request/_bubble.rhtml @@ -5,26 +5,26 @@ <% attachments.each do |a| %> <p class="attachment"> <% - attachment_url = get_attachment_url(:id => incoming_message.info_request_id, + attachment_path = get_attachment_path(:id => incoming_message.info_request_id, :incoming_message_id => incoming_message.id, :part => a.url_part_number, :file_name => a.display_filename) - attachment_as_html_url = get_attachment_as_html_url(:id => incoming_message.info_request_id, + attachment_as_html_path = get_attachment_as_html_path(:id => incoming_message.info_request_id, :incoming_message_id => incoming_message.id, :part => a.url_part_number, :file_name => a.display_filename + '.html') %> <% img_filename = "icon_" + a.content_type.sub('/', '_') + "_large.png" full_filename = File.expand_path(File.join(File.dirname(__FILE__), "../../../public/images", img_filename)) if File.exist?(full_filename) %> - <a href="<%=attachment_url%>"><img class="attachment_image" alt="Attachment" src="/images/<%=img_filename%>"></a> + <a href="<%=attachment_path%>"><img class="attachment_image" alt="Attachment" src="/images/<%=img_filename%>"></a> <% else %> - <a href="<%=attachment_url%>"><img class="attachment_image" alt="Attachment" src="/images/icon_unknown.png"></a> + <a href="<%=attachment_path%>"><img class="attachment_image" alt="Attachment" src="/images/icon_unknown.png"></a> <% end %> <strong><%= h a.display_filename %></strong> <br> <%= a.display_size %> - <%= link_to "Download", attachment_url %> + <%= link_to "Download", attachment_path %> <% if a.has_body_as_html? && incoming_message.info_request.all_can_view? %> - <%= link_to "View as HTML", attachment_as_html_url %> + <%= link_to "View as HTML", attachment_as_html_path %> <% end %> <!-- (<%= a.content_type %>) --> <%= a.extra_note %> diff --git a/app/views/request/_correspondence.rhtml b/app/views/request/_correspondence.rhtml index 99c6c7d26..68711b259 100644 --- a/app/views/request/_correspondence.rhtml +++ b/app/views/request/_correspondence.rhtml @@ -21,9 +21,9 @@ if not incoming_message.nil? <p class="event_actions"> <% if !@user.nil? && @user.admin_page_links? %> - <%= link_to "Admin", admin_url("request/show_raw_email/" + incoming_message.raw_email_id.to_s) %> | + <%= link_to "Admin", admin_request_show_raw_email_path(incoming_message.raw_email_id) %> | <% end %> - <%= link_to _("Link to this"), incoming_message_url(incoming_message), :class => "link_to_this" %> + <%= link_to _("Link to this"), incoming_message_path(incoming_message), :class => "link_to_this" %> </p> </div> <% @@ -51,7 +51,7 @@ elsif [ 'sent', 'followup_sent' ].include?(info_request_event.event_type) <% end %> --> - <%= link_to _("Link to this"), outgoing_message_url(outgoing_message), :class => "link_to_this" %> + <%= link_to _("Link to this"), outgoing_message_path(outgoing_message), :class => "link_to_this" %> </p> </div> <% elsif [ 'resent', 'followup_resent' ].include?(info_request_event.event_type) %> diff --git a/app/views/request/_followup.rhtml b/app/views/request/_followup.rhtml index 045bcd9ba..bccfccca7 100644 --- a/app/views/request/_followup.rhtml +++ b/app/views/request/_followup.rhtml @@ -25,18 +25,18 @@ <ul> <% @info_request.who_can_followup_to(incoming_message).each do |name, email, id| %> <% if id.nil? && !incoming_message.nil? && incoming_message.valid_to_reply_to? %> - <li><%= link_to(_("the main FOI contact address for {{public_body}}", :public_body => name), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil)) %></li> + <li><%= link_to(_("the main FOI contact address for {{public_body}}", :public_body => name), show_response_no_followup_path(:id => @info_request.id, :incoming_message_id => nil)) %></li> <% else %> <% if !id.nil? %> <% if @info_request.public_body.request_email == email %> <% if !incoming_message.nil? %> - <li><%= link_to(_("the main FOI contact address for {{public_body}}", :public_body => name), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil)) %></li> + <li><%= link_to(_("the main FOI contact address for {{public_body}}", :public_body => name), show_response_no_followup_path(:id => @info_request.id, :incoming_message_id => nil)) %></li> <% end %> <% else %> - <li><%= link_to name, show_response_url(:id => @info_request.id, :incoming_message_id => id)%></li> + <li><%= link_to name, show_response_path(:id => @info_request.id, :incoming_message_id => id)%></li> <% end %> <% else %> - <li><%= link_to(_("the main FOI contact address for {{public_body}}", :public_body => name), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil)) %></li> + <li><%= link_to(_("the main FOI contact address for {{public_body}}", :public_body => name), show_response_no_followup_path(:id => @info_request.id, :incoming_message_id => nil)) %></li> <% end %> <% end %> diff --git a/app/views/request/_request_listing_short_via_event.rhtml b/app/views/request/_request_listing_short_via_event.rhtml index d93a91070..c2f6474a1 100644 --- a/app/views/request/_request_listing_short_via_event.rhtml +++ b/app/views/request/_request_listing_short_via_event.rhtml @@ -3,11 +3,11 @@ end %> <div class="request_short_listing"> - <h3><%= link_to highlight_words(info_request.title, @highlight_words), request_url(info_request) %></h3> + <h3><%= link_to highlight_words(info_request.title, @highlight_words), request_path(info_request) %></h3> <p> -<%= _('To {{public_body_link_absolute}}',:public_body_link_absolute => public_body_link_absolute(info_request.public_body))%> -<%= _('by {{user_link_absolute}}',:user_link_absolute => request_user_link_absolute(info_request))%> +<%= _('To {{public_body_link_absolute}}',:public_body_link_absolute => public_body_link(info_request.public_body))%> +<%= _('by {{user_link_absolute}}',:user_link_absolute => request_user_link(info_request))%> <%= simple_date(info_request.created_at) %> </p> </div> diff --git a/app/views/request/_request_listing_single.rhtml b/app/views/request/_request_listing_single.rhtml index e8c1a393f..56737fd3e 100644 --- a/app/views/request/_request_listing_single.rhtml +++ b/app/views/request/_request_listing_single.rhtml @@ -1,6 +1,6 @@ <div class="request_listing"> <span class="head"> - <%= link_to h(info_request.title), (@play_urls ? request_path(:url_title => info_request.url_title) : request_url(info_request)) %> + <%= link_to h(info_request.title), (@play_urls ? categorise_request_path(:url_title => info_request.url_title) : request_path(info_request)) %> </span> <span class="desc"> <%= excerpt(info_request.initial_request_text, "", 150) %> diff --git a/app/views/request/_request_listing_via_event.rhtml b/app/views/request/_request_listing_via_event.rhtml index 2ba9613e5..cc8bae8a9 100644 --- a/app/views/request/_request_listing_via_event.rhtml +++ b/app/views/request/_request_listing_via_event.rhtml @@ -6,13 +6,13 @@ end %> <div class="request_left"> <span class="head"> <% if event.is_incoming_message? %> - <%= link_to highlight_words(info_request.title, @highlight_words), incoming_message_url(event.incoming_message_selective_columns("incoming_messages.id")) %> + <%= link_to highlight_words(info_request.title, @highlight_words), incoming_message_path(event.incoming_message_selective_columns("incoming_messages.id")) %> <% elsif event.is_outgoing_message? and event.event_type == 'followup_sent' %> - <%= link_to highlight_words(info_request.title, @highlight_words), outgoing_message_url(event.outgoing_message) %> + <%= link_to highlight_words(info_request.title, @highlight_words), outgoing_message_path(event.outgoing_message) %> <% elsif event.is_comment? %> - <%= link_to highlight_words(info_request.title, @highlight_words), comment_url(event.comment) %> + <%= link_to highlight_words(info_request.title, @highlight_words), comment_path(event.comment) %> <% else %> - <%= link_to highlight_words(info_request.title, @highlight_words), request_url(info_request) %> + <%= link_to highlight_words(info_request.title, @highlight_words), request_path(info_request) %> <% end %> </span> <div class="requester"> diff --git a/app/views/request/_sidebar.rhtml b/app/views/request/_sidebar.rhtml index 884d4b2b1..94588c15b 100644 --- a/app/views/request/_sidebar.rhtml +++ b/app/views/request/_sidebar.rhtml @@ -53,12 +53,12 @@ <%= render :partial => 'request/request_listing_short_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %> <% end %> <% if @xapian_similar_more %> - <p><%= link_to _("More similar requests"), request_similar_url(@info_request) %></p> + <p><%= link_to _("More similar requests"), similar_request_path(@info_request) %></p> <% end %> <!-- Important terms: <%= @xapian_similar.important_terms.join(" ") %> --> <% end %> - <p><%= link_to _('Event history details'), request_details_url(@info_request) %></p> + <p><%= link_to _('Event history details'), request_details_path(@info_request) %></p> <!-- this link with this wording is here for legal reasons, discuss with board and our lawyer before changing or removing it --> diff --git a/app/views/request/_view_html_prefix.rhtml b/app/views/request/_view_html_prefix.rhtml index b29830ac7..3a9946745 100644 --- a/app/views/request/_view_html_prefix.rhtml +++ b/app/views/request/_view_html_prefix.rhtml @@ -7,6 +7,6 @@ <br>(<%=h @attachment.name_of_content_type %>) </div> <%= _('This is an HTML version of an attachment to the Freedom of Information request')%> - '<%=link_to h(@info_request.title), incoming_message_url(@incoming_message)%>'. + '<%=link_to h(@info_request.title), incoming_message_path(@incoming_message)%>'. </div> diff --git a/app/views/request/_wall_listing.rhtml b/app/views/request/_wall_listing.rhtml index 26d34e1a1..4a76b09bf 100644 --- a/app/views/request/_wall_listing.rhtml +++ b/app/views/request/_wall_listing.rhtml @@ -6,11 +6,11 @@ end %> <div class="request_left"> <div class="requester"> <% 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_url(info_request),:request_title=>info_request.title) %> + <%= _('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) %> <% 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_url(event.incoming_message_selective_columns("incoming_messages.id")),:request_title=>info_request.title,:request_status=>info_request.display_status) %> + <%= _('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' %> <%= _('An <a href="{{request_url}}">annotation</a> to <em>{{request_title}}</em> was made by {{event_comment_user}} on {{date}}',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>request_user_link_absolute(info_request),:event_comment_user=>user_link_absolute(event.comment.user),:date=>simple_date(event.created_at),:request_url=>comment_url(event.comment),:request_title=>info_request.title) %> <% else %> diff --git a/app/views/request/details.rhtml b/app/views/request/details.rhtml index d4c63902f..3cb2f5afe 100644 --- a/app/views/request/details.rhtml +++ b/app/views/request/details.rhtml @@ -36,10 +36,10 @@ way authorities use it. Plus you\'ll need to be an elite statistician. Please <% end %> <td> <% if info_request_event.outgoing_message %> - <%= link_to "outgoing", outgoing_message_url(info_request_event.outgoing_message) %> + <%= link_to "outgoing", outgoing_message_path(info_request_event.outgoing_message) %> <% end %> <% if info_request_event.incoming_message %> - <%= link_to "incoming", incoming_message_url(info_request_event.incoming_message) %> + <%= link_to "incoming", incoming_message_path(info_request_event.incoming_message) %> <% end %> </td> </tr> diff --git a/app/views/request/new.rhtml b/app/views/request/new.rhtml index c16105560..d25da8141 100644 --- a/app/views/request/new.rhtml +++ b/app/views/request/new.rhtml @@ -26,7 +26,7 @@ <li> <%= _('{{existing_request_user}} already created the same request on {{date}}. You can either view the <a href="{{existing_request}}">existing request</a>, - or edit the details below to make a new but similar request.',:existing_request_user=>user_or_you_capital_link(@existing_request.user), :date=>simple_date(@existing_request.created_at), :existing_request=>request_url(@existing_request)) %> + or edit the details below to make a new but similar request.',:existing_request_user=>user_or_you_capital_link(@existing_request.user), :date=>simple_date(@existing_request.created_at), :existing_request=>request_path(@existing_request)) %> </li> </ul></div> <% end %> @@ -41,7 +41,7 @@ <span id="to_public_body"><%=h(@info_request.public_body.name)%></span> <div class="form_item_note"> <% if @info_request.public_body.info_requests.size > 0 %> - <%= _("Browse <a href='{{url}}'>other requests</a> to '{{public_body_name}}' for examples of how to word your request.", :public_body_name=>h(@info_request.public_body.name), :url=>public_body_url(@info_request.public_body)) %> + <%= _("Browse <a href='{{url}}'>other requests</a> to '{{public_body_name}}' for examples of how to word your request.", :public_body_name=>h(@info_request.public_body.name), :url=>public_body_path(@info_request.public_body)) %> <% else %> <%= _("Browse <a href='{{url}}'>other requests</a> for examples of how to word your request.", :url=>request_list_url) %> <% end %> diff --git a/app/views/request/select_authority.rhtml b/app/views/request/select_authority.rhtml index df0498d6a..94e690e64 100644 --- a/app/views/request/select_authority.rhtml +++ b/app/views/request/select_authority.rhtml @@ -35,7 +35,7 @@ <p> <%= raw(_('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_url, "whybother_them"]) %> + (<a href="%s#%s">why?</a>).') % [help_about_path, "whybother_them"]) %> </p> <%= text_field_tag 'query', params[:query], { :size => 30, :title => "type your search term here" } %> <%= hidden_field_tag 'bodies', 1 %> diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml index 0cae3a9aa..ef49ef958 100644 --- a/app/views/request/show.rhtml +++ b/app/views/request/show.rhtml @@ -37,9 +37,9 @@ :user => @info_request.is_external? ? (@info_request.user_name || _('An anonymous user')) : user_link(@info_request.user), :law_used_full => h(@info_request.law_used_full), :user_admin_link => user_admin_link_for_request(@info_request, _('external'), _('admin')), - :request_admin_url => request_admin_url(@info_request), + :request_admin_url => admin_request_show_url(@info_request), :public_body_link => public_body_link(@info_request.public_body), - :public_body_admin_url => public_body_admin_url(@info_request.public_body)) %> + :public_body_admin_url => admin_body_show_url(@info_request.public_body)) %> <% else %> <%= _('{{user}} made this {{law_used_full}} request',:user=>@info_request.is_external? ? (@info_request.user_name || _('An anonymous user')) : user_link(@info_request.user), :law_used_full=>h(@info_request.law_used_full)) %> <%= _('to {{public_body}}',:public_body=>public_body_link(@info_request.public_body)) %> @@ -87,7 +87,7 @@ (<%= raw(_('<a href="%s">details</a>') % [help_requesting_path + '#quickly_response']) %>). <% if !@info_request.is_external? %> <%= _('You can <strong>complain</strong> by') %> - <%= link_to _("requesting an internal review"), show_response_no_followup_url(:id => @info_request.id, :incoming_message_id => nil) + "?internal_review=1#followup" %>. + <%= link_to _("requesting an internal review"), show_response_no_followup_path(:id => @info_request.id, :incoming_message_id => nil) + "?internal_review=1#followup" %>. <% end %> <% elsif @status == 'not_held' %> <%= public_body_link(@info_request.public_body) %> <%= _('<strong>did not have</strong> the information requested.') %> @@ -101,12 +101,12 @@ <% if @is_owning_user && !@info_request.is_external? %> <%=h @info_request.public_body.name %> <%= _('is <strong>waiting for your clarification</strong>.') %> <%= _('Please') %> - <%= link_to _("send a follow up message"), respond_to_last_url(@info_request) + '#followup' %>. + <%= link_to _("send a follow up message"), respond_to_last_path(@info_request) + '#followup' %>. <% else %> <%= _('The request is <strong>waiting for clarification</strong>.') %> <% if !@info_request.is_external? %> <%= _('If you are {{user_link}}, please',:user_link=>user_link_for_request(@info_request)) %> - <%= link_to _("sign in"), signin_url(:r => request.request_uri) %> <%= _('to send a follow up message.') %> + <%= link_to _("sign in"), signin_path(:r => request.request_uri) %> <%= _('to send a follow up message.') %> <% end %> <% end %> <% elsif @status == 'gone_postal' %> diff --git a/app/views/request_game/play.rhtml b/app/views/request_game/play.rhtml index 3bd23e306..d5aa0d00e 100644 --- a/app/views/request_game/play.rhtml +++ b/app/views/request_game/play.rhtml @@ -36,8 +36,8 @@ information has been provided. Everyone'll be exceedingly grateful.")%></p> <%= render :partial => 'request/request_listing_single', :locals => { :info_request => info_request } %> <% end %> <p id="game_buttons"> -<%= button_to _('I don\'t like these ones — give me some more!'), play_url %> -<%= button_to _('I don\'t want to do any more tidying now!'), stop_url %> +<%= button_to _('I don\'t like these ones — give me some more!'), categorise_play_url %> +<%= button_to _('I don\'t want to do any more tidying now!'), categorise_stop_url %> </p> <p><%= _('Thanks for helping - your work will make it easier for everyone to find successful responses, and maybe even let us make league tables...')%></p> diff --git a/app/views/request_mailer/external_response.rhtml b/app/views/request_mailer/external_response.rhtml index e9858f03f..896054a43 100644 --- a/app/views/request_mailer/external_response.rhtml +++ b/app/views/request_mailer/external_response.rhtml @@ -1 +1 @@ -<%=@body%> +<%= raw @body %> diff --git a/app/views/request_mailer/fake_response.rhtml b/app/views/request_mailer/fake_response.rhtml index e9858f03f..896054a43 100644 --- a/app/views/request_mailer/fake_response.rhtml +++ b/app/views/request_mailer/fake_response.rhtml @@ -1 +1 @@ -<%=@body%> +<%= raw @body %> diff --git a/app/views/request_mailer/new_response.rhtml b/app/views/request_mailer/new_response.rhtml index 083f873b4..672212f20 100644 --- a/app/views/request_mailer/new_response.rhtml +++ b/app/views/request_mailer/new_response.rhtml @@ -1,6 +1,6 @@ <%= _('You have a new response to the {{law_used_full}} request ',:law_used_full=>@info_request.law_used_full)%> -'<%= @info_request.title %>' <%=_('that you made to')%> -<%= @info_request.public_body.name %>. +'<%= raw @info_request.title %>' <%=_('that you made to')%> +<%= raw @info_request.public_body.name %>. <%= _('To view the response, click on the link below.')%> diff --git a/app/views/request_mailer/new_response_reminder_alert.rhtml b/app/views/request_mailer/new_response_reminder_alert.rhtml index 86fc71de7..c196dafe6 100644 --- a/app/views/request_mailer/new_response_reminder_alert.rhtml +++ b/app/views/request_mailer/new_response_reminder_alert.rhtml @@ -3,7 +3,7 @@ <%=@url%> <%= _('Your request was called {{info_request}}. Letting everyone know whether you got the information will help us keep tabs on',:info_request=>@info_request.title)%> -<%= @info_request.public_body.name %>. +<%= raw @info_request.public_body.name %>. -- <%= _('the {{site_name}} team', :site_name=>site_name) %> diff --git a/app/views/request_mailer/overdue_alert.rhtml b/app/views/request_mailer/overdue_alert.rhtml index b8a9ba525..249bf6bb8 100644 --- a/app/views/request_mailer/overdue_alert.rhtml +++ b/app/views/request_mailer/overdue_alert.rhtml @@ -1,4 +1,4 @@ -<%= @info_request.public_body.name %> <%= _('have delayed.')%> +<%= raw @info_request.public_body.name %> <%= _('have delayed.')%> <%= _('They have not replied to your {{law_used_short}} request {{title}} promptly, as normally required by law',:law_used_short=>@info_request.law_used_short,:title=>@info_request.title)%><% if @info_request.public_body.is_school? %> <%=_('during term time')%> <% end %>. diff --git a/app/views/request_mailer/requires_admin.rhtml b/app/views/request_mailer/requires_admin.rhtml index 06a798792..e7ab53c59 100644 --- a/app/views/request_mailer/requires_admin.rhtml +++ b/app/views/request_mailer/requires_admin.rhtml @@ -1,9 +1,9 @@ --------------------------------------------------------------------- -<%=@reported_by.name%> <%= _('has reported an')%> <%=@info_request.law_used_short%> +<%= raw @reported_by.name %> <%= _('has reported an')%> <%= raw @info_request.law_used_short %> <%= _('response as needing administrator attention. Take a look, and reply to this email to let them know what you are going to do about it.')%> -Request '<%=@info_request.title%>': +Request '<%= raw @info_request.title %>': <%= @url %> <%= _('Administration URL:') %> diff --git a/app/views/request_mailer/very_overdue_alert.rhtml b/app/views/request_mailer/very_overdue_alert.rhtml index 6abd198a0..80597473c 100644 --- a/app/views/request_mailer/very_overdue_alert.rhtml +++ b/app/views/request_mailer/very_overdue_alert.rhtml @@ -1,4 +1,4 @@ -<%= @info_request.public_body.name %> <%= _('are long overdue.')%> +<%= raw @info_request.public_body.name %> <%= _('are long overdue.')%> <%= _('They have not replied to your {{law_used_short}} request {{title}}, as required by law',:law_used_short=>@info_request.law_used_short,:title=>@info_request.title)%><% if @info_request.public_body.is_school? %> <%= _('even during holidays')%><% end %>. diff --git a/app/views/track/_tracking_links.rhtml b/app/views/track/_tracking_links.rhtml index 06e87ac74..d89c0e4a9 100644 --- a/app/views/track/_tracking_links.rhtml +++ b/app/views/track/_tracking_links.rhtml @@ -14,15 +14,15 @@ <% elsif track_thing %> <div class="feed_link feed_link_<%=location%>"> <% if defined? follower_count && follower_count > 0 %> - <%= link_to _("I like this request"), do_track_url(track_thing), :class => "link_button_green" %> + <%= link_to _("I like this request"), do_track_path(track_thing), :class => "link_button_green" %> <% else %> - <%= link_to _("Follow"), do_track_url(track_thing), :class => "link_button_green" %> + <%= link_to _("Follow"), do_track_path(track_thing), :class => "link_button_green" %> <% end %> </div> <div class="feed_link feed_link_<%=location%>"> - <%= link_to '<img src="/images/feed-16.png" alt="">'.html_safe, do_track_url(track_thing, 'feed') %> - <%= link_to (location == 'sidebar' ? _('RSS feed of updates') : _('RSS feed')), do_track_url(track_thing, 'feed') %> + <%= link_to '<img src="/images/feed-16.png" alt="">'.html_safe, do_track_path(track_thing, 'feed') %> + <%= link_to (location == 'sidebar' ? _('RSS feed of updates') : _('RSS feed')), do_track_path(track_thing, 'feed') %> </div> <% end %> diff --git a/app/views/track_mailer/event_digest.rhtml b/app/views/track_mailer/event_digest.rhtml index dc8132b99..8dbc7fe06 100644 --- a/app/views/track_mailer/event_digest.rhtml +++ b/app/views/track_mailer/event_digest.rhtml @@ -17,17 +17,17 @@ # e.g. Julian Burgess sent a request to Royal Mail Group (15 May 2008) if event.event_type == 'response' - url = main_url(incoming_message_url(event.incoming_message)) + url = incoming_message_url(event.incoming_message) main_text += _("{{public_body}} sent a response to {{user_name}}", :public_body => event.info_request.public_body.name, :user_name => event.info_request.user_name) elsif event.event_type == 'followup_sent' - url = main_url(outgoing_message_url(event.outgoing_message)) + url = outgoing_message_url(event.outgoing_message) main_text += _("{{user_name}} sent a follow up message to {{public_body}}", :user_name => event.info_request.user_name, :public_body => event.info_request.public_body.name) elsif event.event_type == 'sent' # this is unlikely to happen in real life, but happens in the test code - url = main_url(outgoing_message_url(event.outgoing_message)) + url = outgoing_message_url(event.outgoing_message) main_text += _("{{user_name}} sent a request to {{public_body}}", :user_name => event.info_request.user_name, :public_body => event.info_request.public_body.name) elsif event.event_type == 'comment' - url = main_url(comment_url(event.comment)) + url = comment_url(event.comment) main_text += _("{{user_name}} added an annotation", :user_name => event.comment.user.name) else raise "unknown type in event_digest " + event.event_type diff --git a/app/views/user/_show_user_info.rhtml b/app/views/user/_show_user_info.rhtml index 3c229e9ce..305300236 100644 --- a/app/views/user/_show_user_info.rhtml +++ b/app/views/user/_show_user_info.rhtml @@ -4,7 +4,7 @@ <img class="comment_quote" src="/images/quote-marks.png" alt=""> <%= @display_user.get_about_me_for_html_display %> <% if @is_you %> - (<%= link_to _("edit text about you"), set_profile_about_me_url() %>) + (<%= link_to _("edit text about you"), set_profile_about_me_path %>) <% end %> </div> <% end %> @@ -12,9 +12,9 @@ <% if @is_you %> <p id="user_change_password_email"> <% if @display_user.profile_photo %> - <%= link_to _('Change profile photo'), set_profile_photo_url() %> | + <%= link_to _('Change profile photo'), set_profile_photo_path %> | <% end %> - <%= link_to _('Change your password'), signchangepassword_url() %> | - <%= link_to _('Change your email'), signchangeemail_url() %> + <%= link_to _('Change your password'), signchangepassword_path %> | + <%= link_to _('Change your email'), signchangeemail_path %> </p> <% end %> diff --git a/app/views/user/_signin.rhtml b/app/views/user/_signin.rhtml index c4d917991..7db07e4b4 100644 --- a/app/views/user/_signin.rhtml +++ b/app/views/user/_signin.rhtml @@ -18,7 +18,7 @@ </p> <p class="form_note"> - <%= link_to _('Forgotten your password?'), signchangepassword_url + "?pretoken=" + h(params[:token]), :tabindex => 30 %> + <%= link_to _('Forgotten your password?'), signchangepassword_path + "?pretoken=" + h(params[:token]), :tabindex => 30 %> </p> <p class="form_checkbox"> diff --git a/app/views/user/_user_listing_single.rhtml b/app/views/user/_user_listing_single.rhtml index 53df3a7e8..ed1b95718 100644 --- a/app/views/user/_user_listing_single.rhtml +++ b/app/views/user/_user_listing_single.rhtml @@ -5,14 +5,14 @@ end %> <div class="user_listing"> <% if display_user.profile_photo %> <div class="user_photo_on_search"> - <a href="<%=user_url(display_user)%>"> + <a href="<%=user_path(display_user)%>"> <img src="<%= get_profile_photo_url(:url_name => display_user.url_name) %>" alt=""> </a> </div> <% end %> <span class="head <% if display_user.profile_photo %>no_icon<% end %>"> - <%= link_to highlight_words(display_user.name, @highlight_words), user_url(display_user) %> + <%= link_to highlight_words(display_user.name, @highlight_words), user_path(display_user) %> </span> <span class="bottomline"> diff --git a/app/views/user/set_draft_profile_photo.rhtml b/app/views/user/set_draft_profile_photo.rhtml index b3faba7fc..757498249 100644 --- a/app/views/user/set_draft_profile_photo.rhtml +++ b/app/views/user/set_draft_profile_photo.rhtml @@ -52,7 +52,7 @@ <% end %> <p> - <%= link_to _("Cancel, return to your profile page"), user_url(@user) %> + <%= link_to _("Cancel, return to your profile page"), user_path(@user) %> </p> </div> diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml index 9d8bf6f2f..a3dea619d 100644 --- a/app/views/user/show.rhtml +++ b/app/views/user/show.rhtml @@ -55,7 +55,7 @@ <% else %> <% if @is_you %> <span id="set_photo"> - <%= link_to _('Set your profile photo'), set_profile_photo_url() %> + <%= link_to _('Set your profile photo'), set_profile_photo_path %> </span> <% end %> <% end %> @@ -66,12 +66,12 @@ <p class="subtitle"> <%= _('Joined {{site_name}} in', :site_name=>site_name) %> <%= year_from_date(@display_user.created_at) %> <% if !@user.nil? && @user.admin_page_links? %> - (<%= link_to "admin", user_admin_url(@display_user) %>) + (<%= link_to "admin", admin_user_show_path(@display_user) %>) <% end %> </p> <p> - <%= link_to _('Send message to ') + h(@display_user.name), contact_user_url(:id => @display_user.id) %> + <%= link_to _('Send message to ') + h(@display_user.name), contact_user_path(:id => @display_user.id) %> <% if @is_you %> (<%= _('just to see how it works')%>) <% end %> diff --git a/app/views/user_mailer/already_registered.rhtml b/app/views/user_mailer/already_registered.rhtml index 59ffcbf94..32c2c7e63 100644 --- a/app/views/user_mailer/already_registered.rhtml +++ b/app/views/user_mailer/already_registered.rhtml @@ -1,10 +1,10 @@ -<%= @name %>, +<%= raw @name %>, <%= _('You just tried to sign up to {{site_name}}, when you already have an account. Your name and password have been left as they previously were. -Please click on the link below.', :site_name=>site_name)%> <%=@reasons[:email]%> +Please click on the link below.', :site_name=>site_name)%> <%=raw @reasons[:email] %> <%=@url%> diff --git a/app/views/user_mailer/changeemail_confirm.rhtml b/app/views/user_mailer/changeemail_confirm.rhtml index ffb9737f7..c73e9486b 100644 --- a/app/views/user_mailer/changeemail_confirm.rhtml +++ b/app/views/user_mailer/changeemail_confirm.rhtml @@ -1,4 +1,4 @@ -<%= @name %>, +<%= raw @name %>, <%= _('Please click on the link below to confirm that you want to change the email address that you use for {{site_name}} diff --git a/app/views/user_mailer/confirm_login.rhtml b/app/views/user_mailer/confirm_login.rhtml index 6f4feff00..fa86dc2b1 100644 --- a/app/views/user_mailer/confirm_login.rhtml +++ b/app/views/user_mailer/confirm_login.rhtml @@ -1,7 +1,7 @@ -<%= @name %>, +<%= raw @name %>, <%= _('Please click on the link below to confirm your email address.')%> -<%=@reasons[:email]%> +<%= raw @reasons[:email] %> <%=@url%> diff --git a/config/environment.rb b/config/environment.rb index 7ffbe8701..268a44e65 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -117,17 +117,6 @@ end # Domain for URLs (so can work for scripts, not just web pages) ActionMailer::Base.default_url_options[:host] = Configuration::domain -# So that javascript assets use full URL, so proxied admin URLs read javascript OK -if (Configuration::domain != "") - ActionController::Base.asset_host = Proc.new { |source, request| - if ENV["RAILS_ENV"] != "test" && request.fullpath.match(/^\/admin\//) - Configuration::admin_public_url - else - Configuration::domain - end - } -end - # fallback locale and available locales available_locales = Configuration::available_locales.split(/ /) default_locale = Configuration::default_locale diff --git a/config/general.yml-example b/config/general.yml-example index 406fe69fa..6bf54f400 100644 --- a/config/general.yml-example +++ b/config/general.yml-example @@ -99,19 +99,6 @@ TRACK_SENDER_NAME: 'Alaveteli Webmaster' # this up! RAW_EMAILS_LOCATION: 'files/raw_emails' -# The base URL for admin pages, must always end with a '/' -# e.g. https://www.example.com/secure/alaveteli-admin/ -# If not specified, it will default to the path to the admin controller, -# which is usually what you want. It is useful in situations where admin -# requests are proxied via a secure server, for example. -ADMIN_BASE_URL: '' - -# Where /stylesheets sits under for admin pages. See asset_host in -# config/environment.rb. Can be full domain or relative path (not an -# absolute path beginning with /). Again, unlikely to want to change -# this. -ADMIN_PUBLIC_URL: '' - # Secret key for signing cookie_store sessions COOKIE_STORE_SESSION_SECRET: 'your secret key here, make it long and random' diff --git a/config/routes.rb b/config/routes.rb index c0e79f2cd..adc8663c5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,7 +10,7 @@ $alaveteli_route_extensions.each do |f| end ActionController::Routing::Routes.draw do |map| - + # The priority is based upon order of creation: first created -> highest priority. # Sample of regular route: @@ -43,7 +43,7 @@ ActionController::Routing::Routes.draw do |map| request.request_list '/list', :action => 'list' request.select_authority '/select_authority', :action => 'select_authority' - + request.new_request '/new', :action => 'new' request.new_request_to_body '/new/:url_name', :action => 'new' @@ -64,7 +64,7 @@ ActionController::Routing::Routes.draw do |map| request.upload_response "/upload/request/:url_title", :action => 'upload_response' request.download_entire_request '/request/:url_title/download', :action => 'download_entire_request' - + # It would be nice to add :conditions => { :method => :post } to this next one, # because it ought not really to be available as a GET request since it changes # the server state. Unfortunately this doesn’t play well with the PostRedirect @@ -161,9 +161,9 @@ ActionController::Routing::Routes.draw do |map| end map.with_options :controller => 'request_game' do |game| - game.play '/categorise/play', :action => 'play' - game.request '/categorise/request/:url_title', :action => 'show' - game.stop '/categorise/stop', :action => 'stop' + game.categorise_play '/categorise/play', :action => 'play' + game.categorise_request '/categorise/request/:url_title', :action => 'show' + game.categorise_stop '/categorise/stop', :action => 'stop' end map.with_options :controller => 'admin_public_body' do |body| @@ -218,7 +218,7 @@ ActionController::Routing::Routes.draw do |map| user.admin_user_list_banned '/admin/user/banned', :action => 'list_banned' user.admin_user_show '/admin/user/show/:id', :action => 'show' user.admin_user_edit '/admin/user/edit/:id', :action => 'edit' - user.admin_user_show '/admin/user/show_bounce_message/:id', :action => 'show_bounce_message' + user.admin_user_show_bounce '/admin/user/show_bounce_message/:id', :action => 'show_bounce_message' user.admin_user_update '/admin/user/update/:id', :action => 'update' user.admin_user_clear_bounce '/admin/user/clear_bounce/:id', :action => 'clear_bounce' user.admin_user_destroy_track '/admin/user/destroy_track', :action => 'destroy_track' @@ -237,16 +237,16 @@ ActionController::Routing::Routes.draw do |map| rule.admin_rule_update '/admin/censor/update/:id', :action => 'update' rule.admin_rule_destroy '/admin/censor/destroy/:censor_rule_id', :action => 'destroy' end - + map.with_options :controller => 'api' do |api| api.api_create_request '/api/v2/request.json', :action => 'create_request', :conditions => { :method => :post } - + api.api_show_request '/api/v2/request/:id.json', :action => 'show_request', :conditions => { :method => :get } api.api_add_correspondence '/api/v2/request/:id.json', :action => 'add_correspondence', :conditions => { :method => :post } - + api.api_body_request_events '/api/v2/body/:id/request_events.:feed_type', :action => 'body_request_events', :feed_type => '^(json|atom)$' end - + map.filter('conditionallyprependlocale') # Allow downloading Web Service WSDL as a file with an extension diff --git a/config/test.yml b/config/test.yml index ef270dcf2..f40b11764 100644 --- a/config/test.yml +++ b/config/test.yml @@ -71,15 +71,6 @@ CONTACT_NAME: 'Alaveteli Webmaster' # this up! RAW_EMAILS_LOCATION: 'files/raw_emails' -# The base URL for admin pages. You probably don't want to change this. -ADMIN_BASE_URL: '' - -# Where /stylesheets sits under for admin pages. See asset_host in -# config/environment.rb. Can be full domain or relative path (not an -# absolute path beginning with /). Again, unlikely to want to change -# this. -ADMIN_PUBLIC_URL: '' - # Secret key for signing cookie_store sessions COOKIE_STORE_SESSION_SECRET: 'your secret key here, make it long and random' diff --git a/db/.gitignore b/db/.gitignore index f3aee50a1..846a7b9b3 100644 --- a/db/.gitignore +++ b/db/.gitignore @@ -1,2 +1 @@ schema.rb -development_structure.sql diff --git a/db/development_structure.sql b/db/development_structure.sql new file mode 100644 index 000000000..bd4870948 --- /dev/null +++ b/db/development_structure.sql @@ -0,0 +1,2095 @@ +-- +-- PostgreSQL database dump +-- + +SET statement_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SET check_function_bodies = false; +SET client_min_messages = warning; + +-- +-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; + + +-- +-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: - +-- + +COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; + + +SET search_path = public, pg_catalog; + +SET default_tablespace = ''; + +SET default_with_oids = false; + +-- +-- Name: acts_as_xapian_jobs; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE acts_as_xapian_jobs ( + id integer NOT NULL, + model character varying(255) NOT NULL, + model_id integer NOT NULL, + action character varying(255) NOT NULL +); + + +-- +-- Name: acts_as_xapian_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE acts_as_xapian_jobs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: acts_as_xapian_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE acts_as_xapian_jobs_id_seq OWNED BY acts_as_xapian_jobs.id; + + +-- +-- Name: censor_rules; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE censor_rules ( + id integer NOT NULL, + info_request_id integer, + user_id integer, + public_body_id integer, + text text NOT NULL, + replacement text NOT NULL, + last_edit_editor character varying(255) NOT NULL, + last_edit_comment text NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + regexp boolean +); + + +-- +-- Name: censor_rules_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE censor_rules_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: censor_rules_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE censor_rules_id_seq OWNED BY censor_rules.id; + + +-- +-- Name: comments; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE comments ( + id integer NOT NULL, + user_id integer NOT NULL, + comment_type character varying(255) DEFAULT 'internal_error'::character varying NOT NULL, + info_request_id integer, + body text NOT NULL, + visible boolean DEFAULT true NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + locale text DEFAULT ''::text NOT NULL +); + + +-- +-- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE comments_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE comments_id_seq OWNED BY comments.id; + + +-- +-- Name: mail_server_log_dones; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE mail_server_log_dones ( + id integer NOT NULL, + filename text NOT NULL, + last_stat timestamp without time zone NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: exim_log_dones_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE exim_log_dones_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: exim_log_dones_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE exim_log_dones_id_seq OWNED BY mail_server_log_dones.id; + + +-- +-- Name: mail_server_logs; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE mail_server_logs ( + id integer NOT NULL, + mail_server_log_done_id integer, + info_request_id integer, + "order" integer NOT NULL, + line text NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: exim_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE exim_logs_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: exim_logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE exim_logs_id_seq OWNED BY mail_server_logs.id; + + +-- +-- Name: foi_attachments; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE foi_attachments ( + id integer NOT NULL, + content_type text, + filename text, + charset text, + display_size text, + url_part_number integer, + within_rfc822_subject text, + incoming_message_id integer, + hexdigest character varying(32) +); + + +-- +-- Name: foi_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE foi_attachments_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: foi_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE foi_attachments_id_seq OWNED BY foi_attachments.id; + + +-- +-- Name: has_tag_string_tags; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE has_tag_string_tags ( + id integer NOT NULL, + model_id integer NOT NULL, + name text NOT NULL, + created_at timestamp without time zone NOT NULL, + value text, + model character varying(255) NOT NULL +); + + +-- +-- Name: holidays; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE holidays ( + id integer NOT NULL, + day date, + description text +); + + +-- +-- Name: holidays_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE holidays_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: holidays_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE holidays_id_seq OWNED BY holidays.id; + + +-- +-- Name: incoming_messages; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE incoming_messages ( + id integer NOT NULL, + info_request_id integer NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + raw_email_id integer NOT NULL, + cached_attachment_text_clipped text, + cached_main_body_text_folded text, + cached_main_body_text_unfolded text, + subject text, + mail_from_domain text, + valid_to_reply_to boolean, + last_parsed timestamp without time zone, + mail_from text, + sent_at timestamp without time zone +); + + +-- +-- Name: incoming_messages_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE incoming_messages_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: incoming_messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE incoming_messages_id_seq OWNED BY incoming_messages.id; + + +-- +-- Name: info_request_events; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE info_request_events ( + id integer NOT NULL, + info_request_id integer NOT NULL, + event_type text NOT NULL, + params_yaml text NOT NULL, + created_at timestamp without time zone NOT NULL, + described_state character varying(255), + calculated_state character varying(255) DEFAULT NULL::character varying, + last_described_at timestamp without time zone, + incoming_message_id integer, + outgoing_message_id integer, + comment_id integer, + prominence character varying(255) DEFAULT 'normal'::character varying NOT NULL +); + + +-- +-- Name: info_request_events_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE info_request_events_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: info_request_events_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE info_request_events_id_seq OWNED BY info_request_events.id; + + +-- +-- Name: info_requests; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE info_requests ( + id integer NOT NULL, + title text NOT NULL, + user_id integer, + public_body_id integer NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + described_state character varying(255) NOT NULL, + awaiting_description boolean DEFAULT false NOT NULL, + prominence character varying(255) DEFAULT 'normal'::character varying NOT NULL, + url_title text NOT NULL, + law_used character varying(255) DEFAULT 'foi'::character varying NOT NULL, + allow_new_responses_from character varying(255) DEFAULT 'anybody'::character varying NOT NULL, + handle_rejected_responses character varying(255) DEFAULT 'bounce'::character varying NOT NULL, + idhash character varying(255) NOT NULL, + external_user_name character varying(255), + external_url character varying(255), + attention_requested boolean DEFAULT false, + comments_allowed boolean DEFAULT true NOT NULL, + CONSTRAINT info_requests_external_ck CHECK ((((user_id IS NULL) = (external_url IS NOT NULL)) AND ((external_url IS NOT NULL) OR (external_user_name IS NULL)))) +); + + +-- +-- Name: info_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE info_requests_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: info_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE info_requests_id_seq OWNED BY info_requests.id; + + +-- +-- Name: outgoing_messages; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE outgoing_messages ( + id integer NOT NULL, + info_request_id integer NOT NULL, + body text NOT NULL, + status character varying(255) NOT NULL, + message_type character varying(255) NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + last_sent_at timestamp without time zone, + incoming_message_followup_id integer, + what_doing character varying(255) NOT NULL +); + + +-- +-- Name: outgoing_messages_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE outgoing_messages_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: outgoing_messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE outgoing_messages_id_seq OWNED BY outgoing_messages.id; + + +-- +-- Name: post_redirects; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE post_redirects ( + id integer NOT NULL, + token text NOT NULL, + uri text NOT NULL, + post_params_yaml text, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + email_token text NOT NULL, + reason_params_yaml text, + user_id integer, + circumstance text DEFAULT 'normal'::text NOT NULL +); + + +-- +-- Name: post_redirects_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE post_redirects_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: post_redirects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE post_redirects_id_seq OWNED BY post_redirects.id; + + +-- +-- Name: profile_photos; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE profile_photos ( + id integer NOT NULL, + data bytea NOT NULL, + user_id integer, + draft boolean DEFAULT false NOT NULL +); + + +-- +-- Name: profile_photos_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE profile_photos_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: profile_photos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE profile_photos_id_seq OWNED BY profile_photos.id; + + +-- +-- Name: public_bodies; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE public_bodies ( + id integer NOT NULL, + name text NOT NULL, + short_name text NOT NULL, + request_email text NOT NULL, + version integer NOT NULL, + last_edit_editor character varying(255) NOT NULL, + last_edit_comment text NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + url_name text NOT NULL, + home_page text DEFAULT ''::text NOT NULL, + notes text DEFAULT ''::text NOT NULL, + first_letter character varying(255) NOT NULL, + publication_scheme text DEFAULT ''::text NOT NULL, + api_key character varying(255) NOT NULL, + info_requests_count integer DEFAULT 0 NOT NULL, + disclosure_log text DEFAULT ''::text NOT NULL +); + + +-- +-- Name: public_bodies_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public_bodies_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: public_bodies_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public_bodies_id_seq OWNED BY public_bodies.id; + + +-- +-- Name: public_body_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public_body_tags_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: public_body_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public_body_tags_id_seq OWNED BY has_tag_string_tags.id; + + +-- +-- Name: public_body_translations; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE public_body_translations ( + id integer NOT NULL, + public_body_id integer, + locale character varying(255), + short_name text, + publication_scheme text, + url_name text, + first_letter character varying(255), + notes text, + name text, + request_email text, + created_at timestamp without time zone, + updated_at timestamp without time zone, + disclosure_log text +); + + +-- +-- Name: public_body_translations_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public_body_translations_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: public_body_translations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public_body_translations_id_seq OWNED BY public_body_translations.id; + + +-- +-- Name: public_body_versions; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE public_body_versions ( + id integer NOT NULL, + public_body_id integer, + version integer, + name text, + short_name text, + request_email text, + updated_at timestamp without time zone, + last_edit_editor character varying(255), + last_edit_comment text, + url_name text, + home_page text, + notes text, + publication_scheme text DEFAULT ''::text NOT NULL, + charity_number text DEFAULT ''::text NOT NULL, + disclosure_log text DEFAULT ''::text NOT NULL +); + + +-- +-- Name: public_body_versions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public_body_versions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: public_body_versions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public_body_versions_id_seq OWNED BY public_body_versions.id; + + +-- +-- Name: purge_requests; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE purge_requests ( + id integer NOT NULL, + url character varying(255), + created_at timestamp without time zone NOT NULL, + model character varying(255) NOT NULL, + model_id integer NOT NULL +); + + +-- +-- Name: purge_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE purge_requests_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: purge_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE purge_requests_id_seq OWNED BY purge_requests.id; + + +-- +-- Name: raw_emails; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE raw_emails ( + id integer NOT NULL +); + + +-- +-- Name: raw_emails_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE raw_emails_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: raw_emails_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE raw_emails_id_seq OWNED BY raw_emails.id; + + +-- +-- Name: request_classifications; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE request_classifications ( + id integer NOT NULL, + user_id integer, + info_request_event_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: request_classifications_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE request_classifications_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: request_classifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE request_classifications_id_seq OWNED BY request_classifications.id; + + +-- +-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE schema_migrations ( + version character varying(255) NOT NULL +); + + +-- +-- Name: track_things; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE track_things ( + id integer NOT NULL, + tracking_user_id integer NOT NULL, + track_query character varying(255) NOT NULL, + info_request_id integer, + tracked_user_id integer, + public_body_id integer, + track_medium character varying(255) NOT NULL, + track_type character varying(255) DEFAULT 'internal_error'::character varying NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: track_things_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE track_things_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: track_things_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE track_things_id_seq OWNED BY track_things.id; + + +-- +-- Name: track_things_sent_emails; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE track_things_sent_emails ( + id integer NOT NULL, + track_thing_id integer NOT NULL, + info_request_event_id integer, + user_id integer, + public_body_id integer, + created_at timestamp without time zone, + updated_at timestamp without time zone +); + + +-- +-- Name: track_things_sent_emails_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE track_things_sent_emails_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: track_things_sent_emails_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE track_things_sent_emails_id_seq OWNED BY track_things_sent_emails.id; + + +-- +-- Name: user_info_request_sent_alerts; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE user_info_request_sent_alerts ( + id integer NOT NULL, + user_id integer NOT NULL, + info_request_id integer NOT NULL, + alert_type character varying(255) NOT NULL, + info_request_event_id integer +); + + +-- +-- Name: user_info_request_sent_alerts_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE user_info_request_sent_alerts_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: user_info_request_sent_alerts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE user_info_request_sent_alerts_id_seq OWNED BY user_info_request_sent_alerts.id; + + +-- +-- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE users ( + id integer NOT NULL, + email character varying(255) NOT NULL, + name character varying(255) NOT NULL, + hashed_password character varying(255) NOT NULL, + salt character varying(255) NOT NULL, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL, + email_confirmed boolean DEFAULT false NOT NULL, + url_name text NOT NULL, + last_daily_track_email timestamp without time zone DEFAULT '2000-01-01 00:00:00'::timestamp without time zone, + admin_level character varying(255) DEFAULT 'none'::character varying NOT NULL, + ban_text text DEFAULT ''::text NOT NULL, + about_me text DEFAULT ''::text NOT NULL, + locale character varying(255), + email_bounced_at timestamp without time zone, + email_bounce_message text DEFAULT ''::text NOT NULL, + no_limit boolean DEFAULT false NOT NULL, + receive_email_alerts boolean DEFAULT true NOT NULL +); + + +-- +-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE users_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE users_id_seq OWNED BY users.id; + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY acts_as_xapian_jobs ALTER COLUMN id SET DEFAULT nextval('acts_as_xapian_jobs_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY censor_rules ALTER COLUMN id SET DEFAULT nextval('censor_rules_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY comments ALTER COLUMN id SET DEFAULT nextval('comments_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY foi_attachments ALTER COLUMN id SET DEFAULT nextval('foi_attachments_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY has_tag_string_tags ALTER COLUMN id SET DEFAULT nextval('public_body_tags_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY holidays ALTER COLUMN id SET DEFAULT nextval('holidays_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY incoming_messages ALTER COLUMN id SET DEFAULT nextval('incoming_messages_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY info_request_events ALTER COLUMN id SET DEFAULT nextval('info_request_events_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY info_requests ALTER COLUMN id SET DEFAULT nextval('info_requests_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY mail_server_log_dones ALTER COLUMN id SET DEFAULT nextval('exim_log_dones_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY mail_server_logs ALTER COLUMN id SET DEFAULT nextval('exim_logs_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY outgoing_messages ALTER COLUMN id SET DEFAULT nextval('outgoing_messages_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY post_redirects ALTER COLUMN id SET DEFAULT nextval('post_redirects_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY profile_photos ALTER COLUMN id SET DEFAULT nextval('profile_photos_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public_bodies ALTER COLUMN id SET DEFAULT nextval('public_bodies_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public_body_translations ALTER COLUMN id SET DEFAULT nextval('public_body_translations_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public_body_versions ALTER COLUMN id SET DEFAULT nextval('public_body_versions_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY purge_requests ALTER COLUMN id SET DEFAULT nextval('purge_requests_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY raw_emails ALTER COLUMN id SET DEFAULT nextval('raw_emails_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY request_classifications ALTER COLUMN id SET DEFAULT nextval('request_classifications_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY track_things ALTER COLUMN id SET DEFAULT nextval('track_things_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY track_things_sent_emails ALTER COLUMN id SET DEFAULT nextval('track_things_sent_emails_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY user_info_request_sent_alerts ALTER COLUMN id SET DEFAULT nextval('user_info_request_sent_alerts_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass); + + +-- +-- Name: acts_as_xapian_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY acts_as_xapian_jobs + ADD CONSTRAINT acts_as_xapian_jobs_pkey PRIMARY KEY (id); + + +-- +-- Name: censor_rules_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY censor_rules + ADD CONSTRAINT censor_rules_pkey PRIMARY KEY (id); + + +-- +-- Name: comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY comments + ADD CONSTRAINT comments_pkey PRIMARY KEY (id); + + +-- +-- Name: exim_log_dones_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY mail_server_log_dones + ADD CONSTRAINT exim_log_dones_pkey PRIMARY KEY (id); + + +-- +-- Name: exim_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY mail_server_logs + ADD CONSTRAINT exim_logs_pkey PRIMARY KEY (id); + + +-- +-- Name: foi_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY foi_attachments + ADD CONSTRAINT foi_attachments_pkey PRIMARY KEY (id); + + +-- +-- Name: holidays_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY holidays + ADD CONSTRAINT holidays_pkey PRIMARY KEY (id); + + +-- +-- Name: incoming_messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY incoming_messages + ADD CONSTRAINT incoming_messages_pkey PRIMARY KEY (id); + + +-- +-- Name: info_request_events_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY info_request_events + ADD CONSTRAINT info_request_events_pkey PRIMARY KEY (id); + + +-- +-- Name: info_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY info_requests + ADD CONSTRAINT info_requests_pkey PRIMARY KEY (id); + + +-- +-- Name: outgoing_messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY outgoing_messages + ADD CONSTRAINT outgoing_messages_pkey PRIMARY KEY (id); + + +-- +-- Name: post_redirects_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY post_redirects + ADD CONSTRAINT post_redirects_pkey PRIMARY KEY (id); + + +-- +-- Name: profile_photos_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY profile_photos + ADD CONSTRAINT profile_photos_pkey PRIMARY KEY (id); + + +-- +-- Name: public_bodies_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY public_bodies + ADD CONSTRAINT public_bodies_pkey PRIMARY KEY (id); + + +-- +-- Name: public_body_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY has_tag_string_tags + ADD CONSTRAINT public_body_tags_pkey PRIMARY KEY (id); + + +-- +-- Name: public_body_translations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY public_body_translations + ADD CONSTRAINT public_body_translations_pkey PRIMARY KEY (id); + + +-- +-- Name: public_body_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY public_body_versions + ADD CONSTRAINT public_body_versions_pkey PRIMARY KEY (id); + + +-- +-- Name: purge_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY purge_requests + ADD CONSTRAINT purge_requests_pkey PRIMARY KEY (id); + + +-- +-- Name: raw_emails_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY raw_emails + ADD CONSTRAINT raw_emails_pkey PRIMARY KEY (id); + + +-- +-- Name: request_classifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY request_classifications + ADD CONSTRAINT request_classifications_pkey PRIMARY KEY (id); + + +-- +-- Name: track_things_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY track_things + ADD CONSTRAINT track_things_pkey PRIMARY KEY (id); + + +-- +-- Name: track_things_sent_emails_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY track_things_sent_emails + ADD CONSTRAINT track_things_sent_emails_pkey PRIMARY KEY (id); + + +-- +-- Name: user_info_request_sent_alerts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY user_info_request_sent_alerts + ADD CONSTRAINT user_info_request_sent_alerts_pkey PRIMARY KEY (id); + + +-- +-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY users + ADD CONSTRAINT users_pkey PRIMARY KEY (id); + + +-- +-- Name: by_model_and_model_id_and_name_and_value; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX by_model_and_model_id_and_name_and_value ON has_tag_string_tags USING btree (model, model_id, name, value); + + +-- +-- Name: index_acts_as_xapian_jobs_on_model_and_model_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_acts_as_xapian_jobs_on_model_and_model_id ON acts_as_xapian_jobs USING btree (model, model_id); + + +-- +-- Name: index_censor_rules_on_info_request_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_censor_rules_on_info_request_id ON censor_rules USING btree (info_request_id); + + +-- +-- Name: index_censor_rules_on_public_body_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_censor_rules_on_public_body_id ON censor_rules USING btree (public_body_id); + + +-- +-- Name: index_censor_rules_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_censor_rules_on_user_id ON censor_rules USING btree (user_id); + + +-- +-- Name: index_exim_log_dones_on_last_stat; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_exim_log_dones_on_last_stat ON mail_server_log_dones USING btree (last_stat); + + +-- +-- Name: index_exim_logs_on_exim_log_done_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_exim_logs_on_exim_log_done_id ON mail_server_logs USING btree (mail_server_log_done_id); + + +-- +-- Name: index_exim_logs_on_info_request_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_exim_logs_on_info_request_id ON mail_server_logs USING btree (info_request_id); + + +-- +-- Name: index_foi_attachments_on_incoming_message_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_foi_attachments_on_incoming_message_id ON foi_attachments USING btree (incoming_message_id); + + +-- +-- Name: index_has_tag_string_tags_on_model_and_model_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_has_tag_string_tags_on_model_and_model_id ON has_tag_string_tags USING btree (model, model_id); + + +-- +-- Name: index_has_tag_string_tags_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_has_tag_string_tags_on_name ON has_tag_string_tags USING btree (name); + + +-- +-- Name: index_holidays_on_day; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_holidays_on_day ON holidays USING btree (day); + + +-- +-- Name: index_incoming_messages_on_info_request_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_incoming_messages_on_info_request_id ON incoming_messages USING btree (info_request_id); + + +-- +-- Name: index_incoming_messages_on_raw_email_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_incoming_messages_on_raw_email_id ON incoming_messages USING btree (raw_email_id); + + +-- +-- Name: index_info_request_events_on_comment_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_info_request_events_on_comment_id ON info_request_events USING btree (comment_id); + + +-- +-- Name: index_info_request_events_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_info_request_events_on_created_at ON info_request_events USING btree (created_at); + + +-- +-- Name: index_info_request_events_on_incoming_message_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_info_request_events_on_incoming_message_id ON info_request_events USING btree (incoming_message_id); + + +-- +-- Name: index_info_request_events_on_info_request_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_info_request_events_on_info_request_id ON info_request_events USING btree (info_request_id); + + +-- +-- Name: index_info_request_events_on_outgoing_message_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_info_request_events_on_outgoing_message_id ON info_request_events USING btree (outgoing_message_id); + + +-- +-- Name: index_info_requests_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_info_requests_on_created_at ON info_requests USING btree (created_at); + + +-- +-- Name: index_info_requests_on_public_body_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_info_requests_on_public_body_id ON info_requests USING btree (public_body_id); + + +-- +-- Name: index_info_requests_on_title; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_info_requests_on_title ON info_requests USING btree (title); + + +-- +-- Name: index_info_requests_on_url_title; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_info_requests_on_url_title ON info_requests USING btree (url_title); + + +-- +-- Name: index_info_requests_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_info_requests_on_user_id ON info_requests USING btree (user_id); + + +-- +-- Name: index_outgoing_messages_on_incoming_message_followup_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_outgoing_messages_on_incoming_message_followup_id ON outgoing_messages USING btree (incoming_message_followup_id); + + +-- +-- Name: index_outgoing_messages_on_info_request_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_outgoing_messages_on_info_request_id ON outgoing_messages USING btree (info_request_id); + + +-- +-- Name: index_outgoing_messages_on_what_doing; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_outgoing_messages_on_what_doing ON outgoing_messages USING btree (what_doing); + + +-- +-- Name: index_post_redirects_on_email_token; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_post_redirects_on_email_token ON post_redirects USING btree (email_token); + + +-- +-- Name: index_post_redirects_on_token; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_post_redirects_on_token ON post_redirects USING btree (token); + + +-- +-- Name: index_post_redirects_on_updated_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_post_redirects_on_updated_at ON post_redirects USING btree (updated_at); + + +-- +-- Name: index_post_redirects_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_post_redirects_on_user_id ON post_redirects USING btree (user_id); + + +-- +-- Name: index_public_bodies_on_first_letter; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_public_bodies_on_first_letter ON public_bodies USING btree (first_letter); + + +-- +-- Name: index_public_bodies_on_url_name; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_public_bodies_on_url_name ON public_bodies USING btree (url_name); + + +-- +-- Name: index_public_body_translations_on_public_body_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_public_body_translations_on_public_body_id ON public_body_translations USING btree (public_body_id); + + +-- +-- Name: index_public_body_versions_on_updated_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_public_body_versions_on_updated_at ON public_body_versions USING btree (updated_at); + + +-- +-- Name: index_request_classifications_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_request_classifications_on_user_id ON request_classifications USING btree (user_id); + + +-- +-- Name: index_track_things_on_tracking_user_id_and_track_query; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_track_things_on_tracking_user_id_and_track_query ON track_things USING btree (tracking_user_id, track_query); + + +-- +-- Name: index_track_things_sent_emails_on_created_at; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_track_things_sent_emails_on_created_at ON track_things_sent_emails USING btree (created_at); + + +-- +-- Name: index_track_things_sent_emails_on_info_request_event_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_track_things_sent_emails_on_info_request_event_id ON track_things_sent_emails USING btree (info_request_event_id); + + +-- +-- Name: index_track_things_sent_emails_on_track_thing_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_track_things_sent_emails_on_track_thing_id ON track_things_sent_emails USING btree (track_thing_id); + + +-- +-- Name: index_user_info_request_sent_alerts_on_info_request_event_id; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX index_user_info_request_sent_alerts_on_info_request_event_id ON user_info_request_sent_alerts USING btree (info_request_event_id); + + +-- +-- Name: index_users_on_url_name; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX index_users_on_url_name ON users USING btree (url_name); + + +-- +-- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version); + + +-- +-- Name: user_info_request_sent_alerts_unique_index; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX user_info_request_sent_alerts_unique_index ON user_info_request_sent_alerts USING btree (user_id, info_request_id, alert_type, (COALESCE(info_request_event_id, (-1)))); + + +-- +-- Name: users_email_index; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE UNIQUE INDEX users_email_index ON users USING btree (lower((email)::text)); + + +-- +-- Name: users_lower_email_index; Type: INDEX; Schema: public; Owner: -; Tablespace: +-- + +CREATE INDEX users_lower_email_index ON users USING btree (lower((email)::text)); + + +-- +-- Name: fk_censor_rules_info_request; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY censor_rules + ADD CONSTRAINT fk_censor_rules_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id); + + +-- +-- Name: fk_censor_rules_public_body; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY censor_rules + ADD CONSTRAINT fk_censor_rules_public_body FOREIGN KEY (public_body_id) REFERENCES public_bodies(id); + + +-- +-- Name: fk_censor_rules_user; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY censor_rules + ADD CONSTRAINT fk_censor_rules_user FOREIGN KEY (user_id) REFERENCES users(id); + + +-- +-- Name: fk_comments_info_request; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY comments + ADD CONSTRAINT fk_comments_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id); + + +-- +-- Name: fk_comments_user; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY comments + ADD CONSTRAINT fk_comments_user FOREIGN KEY (user_id) REFERENCES users(id); + + +-- +-- Name: fk_exim_log_done; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY mail_server_logs + ADD CONSTRAINT fk_exim_log_done FOREIGN KEY (mail_server_log_done_id) REFERENCES mail_server_log_dones(id); + + +-- +-- Name: fk_exim_log_info_request; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY mail_server_logs + ADD CONSTRAINT fk_exim_log_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id); + + +-- +-- Name: fk_incoming_message_followup_info_request; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY outgoing_messages + ADD CONSTRAINT fk_incoming_message_followup_info_request FOREIGN KEY (incoming_message_followup_id) REFERENCES incoming_messages(id); + + +-- +-- Name: fk_incoming_messages_info_request; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY incoming_messages + ADD CONSTRAINT fk_incoming_messages_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id); + + +-- +-- Name: fk_incoming_messages_raw_email; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY incoming_messages + ADD CONSTRAINT fk_incoming_messages_raw_email FOREIGN KEY (raw_email_id) REFERENCES raw_emails(id); + + +-- +-- Name: fk_info_request_events_comment_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY info_request_events + ADD CONSTRAINT fk_info_request_events_comment_id FOREIGN KEY (comment_id) REFERENCES comments(id); + + +-- +-- Name: fk_info_request_events_incoming_message_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY info_request_events + ADD CONSTRAINT fk_info_request_events_incoming_message_id FOREIGN KEY (incoming_message_id) REFERENCES incoming_messages(id); + + +-- +-- Name: fk_info_request_events_info_request; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY info_request_events + ADD CONSTRAINT fk_info_request_events_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id); + + +-- +-- Name: fk_info_request_events_outgoing_message_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY info_request_events + ADD CONSTRAINT fk_info_request_events_outgoing_message_id FOREIGN KEY (outgoing_message_id) REFERENCES outgoing_messages(id); + + +-- +-- Name: fk_info_request_sent_alerts_info_request; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY user_info_request_sent_alerts + ADD CONSTRAINT fk_info_request_sent_alerts_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id); + + +-- +-- Name: fk_info_request_sent_alerts_user; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY user_info_request_sent_alerts + ADD CONSTRAINT fk_info_request_sent_alerts_user FOREIGN KEY (user_id) REFERENCES users(id); + + +-- +-- Name: fk_info_requests_public_body; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY info_requests + ADD CONSTRAINT fk_info_requests_public_body FOREIGN KEY (public_body_id) REFERENCES public_bodies(id); + + +-- +-- Name: fk_info_requests_user; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY info_requests + ADD CONSTRAINT fk_info_requests_user FOREIGN KEY (user_id) REFERENCES users(id); + + +-- +-- Name: fk_outgoing_messages_info_request; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY outgoing_messages + ADD CONSTRAINT fk_outgoing_messages_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id); + + +-- +-- Name: fk_post_redirects_user; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY post_redirects + ADD CONSTRAINT fk_post_redirects_user FOREIGN KEY (user_id) REFERENCES users(id); + + +-- +-- Name: fk_profile_photos_user; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY profile_photos + ADD CONSTRAINT fk_profile_photos_user FOREIGN KEY (user_id) REFERENCES users(id); + + +-- +-- Name: fk_public_body_versions_public_body; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public_body_versions + ADD CONSTRAINT fk_public_body_versions_public_body FOREIGN KEY (public_body_id) REFERENCES public_bodies(id); + + +-- +-- Name: fk_track_request_info_request; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY track_things + ADD CONSTRAINT fk_track_request_info_request FOREIGN KEY (info_request_id) REFERENCES info_requests(id); + + +-- +-- Name: fk_track_request_info_request_event; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY track_things_sent_emails + ADD CONSTRAINT fk_track_request_info_request_event FOREIGN KEY (info_request_event_id) REFERENCES info_request_events(id); + + +-- +-- Name: fk_track_request_public_body; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY track_things + ADD CONSTRAINT fk_track_request_public_body FOREIGN KEY (public_body_id) REFERENCES public_bodies(id); + + +-- +-- Name: fk_track_request_public_body; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY track_things_sent_emails + ADD CONSTRAINT fk_track_request_public_body FOREIGN KEY (user_id) REFERENCES users(id); + + +-- +-- Name: fk_track_request_tracked_user; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY track_things + ADD CONSTRAINT fk_track_request_tracked_user FOREIGN KEY (tracked_user_id) REFERENCES users(id); + + +-- +-- Name: fk_track_request_tracking_user; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY track_things + ADD CONSTRAINT fk_track_request_tracking_user FOREIGN KEY (tracking_user_id) REFERENCES users(id); + + +-- +-- Name: fk_track_request_user; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY track_things_sent_emails + ADD CONSTRAINT fk_track_request_user FOREIGN KEY (user_id) REFERENCES users(id); + + +-- +-- Name: fk_user_info_request_sent_alert_info_request_event; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY user_info_request_sent_alerts + ADD CONSTRAINT fk_user_info_request_sent_alert_info_request_event FOREIGN KEY (info_request_event_id) REFERENCES info_request_events(id); + + +-- +-- PostgreSQL database dump complete +-- + +INSERT INTO schema_migrations (version) VALUES ('1'); + +INSERT INTO schema_migrations (version) VALUES ('2'); + +INSERT INTO schema_migrations (version) VALUES ('4'); + +INSERT INTO schema_migrations (version) VALUES ('5'); + +INSERT INTO schema_migrations (version) VALUES ('6'); + +INSERT INTO schema_migrations (version) VALUES ('7'); + +INSERT INTO schema_migrations (version) VALUES ('8'); + +INSERT INTO schema_migrations (version) VALUES ('9'); + +INSERT INTO schema_migrations (version) VALUES ('10'); + +INSERT INTO schema_migrations (version) VALUES ('11'); + +INSERT INTO schema_migrations (version) VALUES ('12'); + +INSERT INTO schema_migrations (version) VALUES ('13'); + +INSERT INTO schema_migrations (version) VALUES ('14'); + +INSERT INTO schema_migrations (version) VALUES ('15'); + +INSERT INTO schema_migrations (version) VALUES ('16'); + +INSERT INTO schema_migrations (version) VALUES ('17'); + +INSERT INTO schema_migrations (version) VALUES ('18'); + +INSERT INTO schema_migrations (version) VALUES ('21'); + +INSERT INTO schema_migrations (version) VALUES ('22'); + +INSERT INTO schema_migrations (version) VALUES ('23'); + +INSERT INTO schema_migrations (version) VALUES ('24'); + +INSERT INTO schema_migrations (version) VALUES ('25'); + +INSERT INTO schema_migrations (version) VALUES ('26'); + +INSERT INTO schema_migrations (version) VALUES ('27'); + +INSERT INTO schema_migrations (version) VALUES ('28'); + +INSERT INTO schema_migrations (version) VALUES ('29'); + +INSERT INTO schema_migrations (version) VALUES ('30'); + +INSERT INTO schema_migrations (version) VALUES ('31'); + +INSERT INTO schema_migrations (version) VALUES ('32'); + +INSERT INTO schema_migrations (version) VALUES ('33'); + +INSERT INTO schema_migrations (version) VALUES ('34'); + +INSERT INTO schema_migrations (version) VALUES ('35'); + +INSERT INTO schema_migrations (version) VALUES ('36'); + +INSERT INTO schema_migrations (version) VALUES ('37'); + +INSERT INTO schema_migrations (version) VALUES ('38'); + +INSERT INTO schema_migrations (version) VALUES ('39'); + +INSERT INTO schema_migrations (version) VALUES ('40'); + +INSERT INTO schema_migrations (version) VALUES ('41'); + +INSERT INTO schema_migrations (version) VALUES ('42'); + +INSERT INTO schema_migrations (version) VALUES ('43'); + +INSERT INTO schema_migrations (version) VALUES ('44'); + +INSERT INTO schema_migrations (version) VALUES ('45'); + +INSERT INTO schema_migrations (version) VALUES ('46'); + +INSERT INTO schema_migrations (version) VALUES ('47'); + +INSERT INTO schema_migrations (version) VALUES ('48'); + +INSERT INTO schema_migrations (version) VALUES ('49'); + +INSERT INTO schema_migrations (version) VALUES ('50'); + +INSERT INTO schema_migrations (version) VALUES ('51'); + +INSERT INTO schema_migrations (version) VALUES ('52'); + +INSERT INTO schema_migrations (version) VALUES ('53'); + +INSERT INTO schema_migrations (version) VALUES ('54'); + +INSERT INTO schema_migrations (version) VALUES ('55'); + +INSERT INTO schema_migrations (version) VALUES ('56'); + +INSERT INTO schema_migrations (version) VALUES ('57'); + +INSERT INTO schema_migrations (version) VALUES ('58'); + +INSERT INTO schema_migrations (version) VALUES ('59'); + +INSERT INTO schema_migrations (version) VALUES ('60'); + +INSERT INTO schema_migrations (version) VALUES ('61'); + +INSERT INTO schema_migrations (version) VALUES ('62'); + +INSERT INTO schema_migrations (version) VALUES ('63'); + +INSERT INTO schema_migrations (version) VALUES ('64'); + +INSERT INTO schema_migrations (version) VALUES ('65'); + +INSERT INTO schema_migrations (version) VALUES ('66'); + +INSERT INTO schema_migrations (version) VALUES ('67'); + +INSERT INTO schema_migrations (version) VALUES ('68'); + +INSERT INTO schema_migrations (version) VALUES ('69'); + +INSERT INTO schema_migrations (version) VALUES ('70'); + +INSERT INTO schema_migrations (version) VALUES ('71'); + +INSERT INTO schema_migrations (version) VALUES ('72'); + +INSERT INTO schema_migrations (version) VALUES ('73'); + +INSERT INTO schema_migrations (version) VALUES ('74'); + +INSERT INTO schema_migrations (version) VALUES ('75'); + +INSERT INTO schema_migrations (version) VALUES ('76'); + +INSERT INTO schema_migrations (version) VALUES ('77'); + +INSERT INTO schema_migrations (version) VALUES ('78'); + +INSERT INTO schema_migrations (version) VALUES ('79'); + +INSERT INTO schema_migrations (version) VALUES ('80'); + +INSERT INTO schema_migrations (version) VALUES ('81'); + +INSERT INTO schema_migrations (version) VALUES ('82'); + +INSERT INTO schema_migrations (version) VALUES ('83'); + +INSERT INTO schema_migrations (version) VALUES ('84'); + +INSERT INTO schema_migrations (version) VALUES ('85'); + +INSERT INTO schema_migrations (version) VALUES ('86'); + +INSERT INTO schema_migrations (version) VALUES ('87'); + +INSERT INTO schema_migrations (version) VALUES ('88'); + +INSERT INTO schema_migrations (version) VALUES ('89'); + +INSERT INTO schema_migrations (version) VALUES ('90'); + +INSERT INTO schema_migrations (version) VALUES ('91'); + +INSERT INTO schema_migrations (version) VALUES ('92'); + +INSERT INTO schema_migrations (version) VALUES ('93'); + +INSERT INTO schema_migrations (version) VALUES ('94'); + +INSERT INTO schema_migrations (version) VALUES ('95'); + +INSERT INTO schema_migrations (version) VALUES ('96'); + +INSERT INTO schema_migrations (version) VALUES ('97'); + +INSERT INTO schema_migrations (version) VALUES ('98'); + +INSERT INTO schema_migrations (version) VALUES ('99'); + +INSERT INTO schema_migrations (version) VALUES ('100'); + +INSERT INTO schema_migrations (version) VALUES ('101'); + +INSERT INTO schema_migrations (version) VALUES ('102'); + +INSERT INTO schema_migrations (version) VALUES ('103'); + +INSERT INTO schema_migrations (version) VALUES ('104'); + +INSERT INTO schema_migrations (version) VALUES ('105'); + +INSERT INTO schema_migrations (version) VALUES ('106'); + +INSERT INTO schema_migrations (version) VALUES ('107'); + +INSERT INTO schema_migrations (version) VALUES ('108'); + +INSERT INTO schema_migrations (version) VALUES ('109'); + +INSERT INTO schema_migrations (version) VALUES ('110'); + +INSERT INTO schema_migrations (version) VALUES ('111'); + +INSERT INTO schema_migrations (version) VALUES ('112'); + +INSERT INTO schema_migrations (version) VALUES ('113'); + +INSERT INTO schema_migrations (version) VALUES ('114'); + +INSERT INTO schema_migrations (version) VALUES ('115'); + +INSERT INTO schema_migrations (version) VALUES ('116'); + +INSERT INTO schema_migrations (version) VALUES ('117'); + +INSERT INTO schema_migrations (version) VALUES ('118'); + +INSERT INTO schema_migrations (version) VALUES ('20120822145640'); + +INSERT INTO schema_migrations (version) VALUES ('20120910153022'); + +INSERT INTO schema_migrations (version) VALUES ('20120912111713'); + +INSERT INTO schema_migrations (version) VALUES ('20120912112036'); + +INSERT INTO schema_migrations (version) VALUES ('20120912112312'); + +INSERT INTO schema_migrations (version) VALUES ('20120912112655'); + +INSERT INTO schema_migrations (version) VALUES ('20120912113004'); + +INSERT INTO schema_migrations (version) VALUES ('20120912113720'); + +INSERT INTO schema_migrations (version) VALUES ('20120912114022'); + +INSERT INTO schema_migrations (version) VALUES ('20120912170035'); + +INSERT INTO schema_migrations (version) VALUES ('20120913074940'); + +INSERT INTO schema_migrations (version) VALUES ('20120913080807'); + +INSERT INTO schema_migrations (version) VALUES ('20120913081136'); + +INSERT INTO schema_migrations (version) VALUES ('20120913135745'); + +INSERT INTO schema_migrations (version) VALUES ('20120919140404'); + +INSERT INTO schema_migrations (version) VALUES ('20121010214348'); + +INSERT INTO schema_migrations (version) VALUES ('20121022031914');
\ No newline at end of file diff --git a/lib/configuration.rb b/lib/configuration.rb index 11fe1c56e..d1da45fcf 100644 --- a/lib/configuration.rb +++ b/lib/configuration.rb @@ -4,9 +4,7 @@ module Configuration DEFAULTS = { - :ADMIN_BASE_URL => '', :ADMIN_PASSWORD => '', - :ADMIN_PUBLIC_URL => '', :ADMIN_USERNAME => '', :AVAILABLE_LOCALES => '', :BLACKHOLE_PREFIX => 'do-not-reply-to-this-address', diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb index c785960b5..5505afe59 100644 --- a/spec/controllers/track_controller_spec.rb +++ b/spec/controllers/track_controller_spec.rb @@ -57,7 +57,6 @@ end describe TrackController, "when sending alerts for a track" do integrate_views - include LinkToHelper # for main_url before(:each) do load_raw_emails_data @@ -105,7 +104,7 @@ describe TrackController, "when sending alerts for a track" do # Given we can't click the link, check the token is right instead post_redirect = PostRedirect.find_by_email_token(mail_token) - expected_url = main_url("/user/" + users(:silly_name_user).url_name + "#email_subscriptions") # XXX can't call URL making functions here, what is correct way to do this? + expected_url = show_user_url(:url_name => users(:silly_name_user).url_name, :anchor => "email_subscriptions") post_redirect.uri.should == expected_url # Check nothing more is delivered if we try again diff --git a/spec/helpers/link_to_helper_spec.rb b/spec/helpers/link_to_helper_spec.rb index 030fd612d..3e997f9f9 100644 --- a/spec/helpers/link_to_helper_spec.rb +++ b/spec/helpers/link_to_helper_spec.rb @@ -17,27 +17,15 @@ describe LinkToHelper do it 'should return a path like /request/test_title' do - request_url(@mock_request).should == '/request/test_title' + request_path(@mock_request).should == '/request/test_title' end it 'should return a path including any extra parameters passed' do - request_url(@mock_request, {:update_status => 1}).should == '/request/test_title?update_status=1' + request_path(@mock_request, {:update_status => 1}).should == '/request/test_title?update_status=1' end end - describe "when appending something to a URL" do - it 'should append to things without query strings' do - main_url('/a', '.json').should == 'http://test.host/a.json' - end - it 'should append to things with query strings' do - main_url('/a?z=1', '.json').should == 'http://test.host/a.json?z=1' - end - it 'should fail silently with invalid URLs' do - main_url('/a?z=9%', '.json').should == 'http://test.host/a?z=9%' - end - end - describe 'when displaying a user admin link for a request' do it 'should return the text "An anonymous user (external)" in the case where there is no external username' do @@ -48,32 +36,6 @@ describe LinkToHelper do end - describe 'admin_url' do - context 'with no ADMIN_BASE_URL set' do - it 'should prepend the admin general index path to a simple string' do - admin_url('unclassified').should == 'http://test.host/en/admin/unclassified' - end - - it 'should prepend the admin general index path to a deeper URL' do - admin_url('request/show/123').should == 'http://test.host/en/admin/request/show/123' - end - end - - context 'with ADMIN_BASE_URL set' do - before(:each) do - Configuration::should_receive(:admin_base_url).and_return('https://www.example.com/secure/alaveteli-admin/') - end - - it 'should prepend the admin base URL to a simple string' do - admin_url('unclassified').should == 'https://www.example.com/secure/alaveteli-admin/unclassified' - end - - it 'should prepend the admin base URL to a deeper URL' do - admin_url('request/show/123').should == 'https://www.example.com/secure/alaveteli-admin/request/show/123' - end - end - end - describe 'simple_date' do it 'should respect time zones' do Time.use_zone('Australia/Sydney') do diff --git a/spec/models/request_mailer_spec.rb b/spec/models/request_mailer_spec.rb index 000a0c12e..dd5a322fb 100644 --- a/spec/models/request_mailer_spec.rb +++ b/spec/models/request_mailer_spec.rb @@ -366,16 +366,4 @@ describe RequestMailer, 'requires_admin' do mail.body.should include('http://test.host/en/admin/request/show/123') end - - context 'has an ADMIN_BASE_URL set' do - before(:each) do - Configuration::should_receive(:admin_base_url).and_return('http://our.proxy.server/admin/alaveteli/') - end - - it 'body should contain the full admin URL' do - mail = RequestMailer.deliver_requires_admin(@info_request) - - mail.body.should include('http://our.proxy.server/admin/alaveteli/request/show/123') - end - end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b760c6385..b04ed4b54 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,16 @@ +require 'simplecov' +require 'coveralls' + +# Generate coverage locally in html as well as in coveralls.io +SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ + SimpleCov::Formatter::HTMLFormatter, + Coveralls::SimpleCov::Formatter +] +SimpleCov.start('rails') do + add_filter 'commonlib' + add_filter 'vendor/plugins' +end + # This file is copied to ~/spec when you run 'ruby script/generate rspec' # from the project root directory. ENV["RAILS_ENV"] = 'test' diff --git a/spec/views/request/show.rhtml_spec.rb b/spec/views/request/show.rhtml_spec.rb index 4429e9e58..a22f29951 100644 --- a/spec/views/request/show.rhtml_spec.rb +++ b/spec/views/request/show.rhtml_spec.rb @@ -98,7 +98,7 @@ describe 'when viewing an information request' do it 'should show a link to follow up the last response with clarification' do request_page - expected_url = "http://test.host/request/#{@mock_request.id}/response/#{@mock_response.id}#followup" + expected_url = "/request/#{@mock_request.id}/response/#{@mock_response.id}#followup" response.should have_tag("a[href=#{expected_url}]", :text => 'send a follow up message') end @@ -118,7 +118,7 @@ describe 'when viewing an information request' do it 'should show a link to follow up the request without reference to a specific response' do request_page - expected_url = "http://test.host/request/#{@mock_request.id}/response#followup" + expected_url = "/request/#{@mock_request.id}/response#followup" response.should have_tag("a[href=#{expected_url}]", :text => 'send a follow up message') end end |