aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin_public_body_controller.rb2
-rw-r--r--app/controllers/application_controller.rb14
-rw-r--r--app/controllers/help_controller.rb8
-rw-r--r--app/controllers/public_body_controller.rb4
-rw-r--r--app/controllers/request_controller.rb3
-rw-r--r--app/models/about_me_validator.rb2
-rw-r--r--app/models/censor_rule.rb8
-rw-r--r--app/models/change_email_validator.rb9
-rw-r--r--app/models/comment.rb7
-rw-r--r--app/models/exim_log.rb6
-rw-r--r--app/models/foi_attachment.rb28
-rw-r--r--app/models/holiday.rb6
-rw-r--r--app/models/incoming_message.rb18
-rw-r--r--app/models/info_request.rb14
-rw-r--r--app/models/info_request_event.rb15
-rw-r--r--app/models/outgoing_message.rb6
-rw-r--r--app/models/post_redirect.rb8
-rw-r--r--app/models/profile_photo.rb6
-rw-r--r--app/models/raw_email.rb7
-rw-r--r--app/models/track_thing.rb12
-rw-r--r--app/models/track_things_sent_email.rb12
-rw-r--r--app/models/user.rb7
-rw-r--r--app/models/user_info_request_sent_alert.rb4
-rw-r--r--app/views/admin_general/timeline.rhtml10
-rw-r--r--app/views/general/_topnav.rhtml4
-rw-r--r--app/views/general/frontpage.rhtml2
-rw-r--r--app/views/general/search.rhtml2
-rw-r--r--app/views/public_body/_search_ahead.rhtml1
-rw-r--r--app/views/request/_request_listing_via_event.rhtml23
-rw-r--r--app/views/request/select_authority.rhtml11
-rw-r--r--app/views/user/show.rhtml2
31 files changed, 149 insertions, 112 deletions
diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb
index e249cef11..0c24d47c1 100644
--- a/app/controllers/admin_public_body_controller.rb
+++ b/app/controllers/admin_public_body_controller.rb
@@ -31,8 +31,8 @@ class AdminPublicBodyController < AdminController
lower(public_body_translations.short_name) like lower('%'||?||'%') or
lower(public_body_translations.request_email) like lower('%'||?||'%' )) AND (public_body_translations.locale = '#{@locale}')", @query, @query, @query],
:joins => :translations
- @public_bodies_by_tag = PublicBody::Translation.find_by_tag(@query)
end
+ @public_bodies_by_tag = PublicBody.find_by_tag(@query)
end
def list
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index b7457c48e..b0351f7d1 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -14,7 +14,10 @@ class ApplicationController < ActionController::Base
# Standard headers, footers and navigation for whole site
layout "default"
include FastGettext::Translation # make functions like _, n_, N_ etc available)
-
+
+ # Send notification email on exceptions
+ include ExceptionNotification::Notifiable
+
# Note: a filter stops the chain if it redirects or renders something
before_filter :authentication_check
before_filter :set_gettext_locale
@@ -119,6 +122,7 @@ class ApplicationController < ActionController::Base
@status = 404
else
@status = 500
+ notify_about_exception exception
end
# Display user appropriate error message
@exception_backtrace = exception.backtrace.join("\n")
@@ -361,14 +365,14 @@ class ApplicationController < ActionController::Base
# Store last visited pages, for contact form; but only for logged in users, as otherwise this breaks caching
def set_last_request(info_request)
if !session[:user_id].nil?
- session[:last_request_id] = info_request.id
- session[:last_body_id] = nil
+ cookies["last_request_id"] = info_request.id
+ cookies["last_body_id"] = nil
end
end
def set_last_body(public_body)
if !session[:user_id].nil?
- session[:last_request_id] = nil
- session[:last_body_id] = public_body.id
+ cookies["last_request_id"] = nil
+ cookies["last_body_id"] = public_body.id
end
end
diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb
index c6d246b4c..9b00846ee 100644
--- a/app/controllers/help_controller.rb
+++ b/app/controllers/help_controller.rb
@@ -26,18 +26,18 @@ class HelpController < ApplicationController
# if they clicked remove for link to request/body, remove it
if params[:remove]
@last_request = nil
- session[:last_request_id] = nil
- session[:last_body_id] = nil
+ cookies["last_request_id"] = nil
+ cookies["last_body_id"] = nil
end
# look up link to request/body
- @last_request_id = session[:last_request_id].to_i
+ @last_request_id = cookies["last_request_id"].to_i
if @last_request_id > 0
@last_request = InfoRequest.find(@last_request_id)
else
@last_request = nil
end
- @last_body_id = session[:last_body_id].to_i
+ @last_body_id = cookies["last_body_id"].to_i
if @last_body_id > 0
@last_body = PublicBody.find(@last_body_id)
else
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb
index 62229a441..94d1351db 100644
--- a/app/controllers/public_body_controller.rb
+++ b/app/controllers/public_body_controller.rb
@@ -129,7 +129,7 @@ class PublicBodyController < ApplicationController
end
PublicBody.with_locale(@locale) do
@public_bodies = PublicBody.paginate(
- :order => "public_body_translations.name", :page => params[:page], :per_page => 1000, # fit all councils on one page
+ :order => "public_body_translations.name", :page => params[:page], :per_page => 100,
:conditions => conditions,
:joins => :translations
)
@@ -185,7 +185,7 @@ class PublicBodyController < ApplicationController
def search_typeahead
# Since acts_as_xapian doesn't support the Partial match flag, we work around it
# by making the last work a wildcard, which is quite the same
- query = params[:q]
+ query = params[:query]
query = query.split(' ')
if query.last.nil? || query.last.strip.length < 3
@xapian_requests = nil
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 8672fdf75..f3bbd6708 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -814,7 +814,8 @@ class RequestController < ApplicationController
for message in info_request.incoming_messages
attachments = message.get_attachments_for_display
for attachment in attachments
- zipfile.get_output_stream(attachment.display_filename) { |f|
+ filename = "#{attachment.url_part_number}_#{attachment.display_filename}"
+ zipfile.get_output_stream(filename) { |f|
f.puts(attachment.body)
}
end
diff --git a/app/models/about_me_validator.rb b/app/models/about_me_validator.rb
index ec2b03201..e24c5512c 100644
--- a/app/models/about_me_validator.rb
+++ b/app/models/about_me_validator.rb
@@ -21,7 +21,7 @@ class AboutMeValidator < ActiveRecord::BaseWithoutTable
def validate
if !self.about_me.blank? && self.about_me.size > 500
- errors.add(_("Please keep it shorter than 500 characters"))
+ errors.add(:about_me, _("Please keep it shorter than 500 characters"))
end
end
diff --git a/app/models/censor_rule.rb b/app/models/censor_rule.rb
index e2dc12d6f..201e60746 100644
--- a/app/models/censor_rule.rb
+++ b/app/models/censor_rule.rb
@@ -1,12 +1,12 @@
# == Schema Information
-# Schema version: 95
+# Schema version: 108
#
# Table name: censor_rules
#
# id :integer not null, primary key
-# info_request_id :integer
-# user_id :integer
-# public_body_id :integer
+# info_request_id :integer
+# user_id :integer
+# public_body_id :integer
# text :text not null
# replacement :text not null
# last_edit_editor :string(255) not null
diff --git a/app/models/change_email_validator.rb b/app/models/change_email_validator.rb
index f7ec6d17e..e3f8fa892 100644
--- a/app/models/change_email_validator.rb
+++ b/app/models/change_email_validator.rb
@@ -1,11 +1,12 @@
# == Schema Information
-# Schema version: 95
+# Schema version: 108
#
# Table name: change_email_validators
#
-# old_email :string
-# new_email :string
-# password :string
+# old_email :string
+# new_email :string
+# password :string
+# user_circumstance :string
#
# models/changeemail_validator.rb:
diff --git a/app/models/comment.rb b/app/models/comment.rb
index b7ece9ba9..44a1079cd 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -1,16 +1,17 @@
# == Schema Information
-# Schema version: 95
+# Schema version: 108
#
# Table name: comments
#
# id :integer not null, primary key
# user_id :integer not null
# comment_type :string(255) default("internal_error"), not null
-# info_request_id :integer
+# info_request_id :integer
# body :text not null
-# visible :boolean default(true), not null
+# visible :boolean default(TRUE), not null
# created_at :datetime not null
# updated_at :datetime not null
+# locale :text default(""), not null
#
# models/comments.rb:
diff --git a/app/models/exim_log.rb b/app/models/exim_log.rb
index 83f031a92..77e5e2d21 100644
--- a/app/models/exim_log.rb
+++ b/app/models/exim_log.rb
@@ -1,11 +1,11 @@
# == Schema Information
-# Schema version: 95
+# Schema version: 108
#
# Table name: exim_logs
#
# id :integer not null, primary key
-# exim_log_done_id :integer
-# info_request_id :integer
+# exim_log_done_id :integer
+# info_request_id :integer
# order :integer not null
# line :text not null
# created_at :datetime not null
diff --git a/app/models/foi_attachment.rb b/app/models/foi_attachment.rb
index 057dcdb69..a14e0b553 100644
--- a/app/models/foi_attachment.rb
+++ b/app/models/foi_attachment.rb
@@ -1,3 +1,19 @@
+# == Schema Information
+# Schema version: 108
+#
+# Table name: foi_attachments
+#
+# id :integer not null, primary key
+# content_type :text
+# filename :text
+# charset :text
+# display_size :text
+# url_part_number :integer
+# within_rfc822_subject :text
+# incoming_message_id :integer
+# hexdigest :string(32)
+#
+
# encoding: UTF-8
# models/foi_attachment.rb:
@@ -19,7 +35,7 @@ class FoiAttachment < ActiveRecord::Base
before_destroy :delete_cached_file!
def directory
- base_dir = File.join("cache", "attachments_#{ENV['RAILS_ENV']}")
+ base_dir = File.join(File.dirname(__FILE__), "../../cache", "attachments_#{ENV['RAILS_ENV']}")
return File.join(base_dir, self.hexdigest[0..2])
end
@@ -47,7 +63,13 @@ class FoiAttachment < ActiveRecord::Base
def body
if @cached_body.nil?
- @cached_body = File.open(self.filepath, "rb" ).read
+ begin
+ @cached_body = File.open(self.filepath, "rb" ).read
+ rescue Errno::ENOENT
+ # we've lost our cached attachments for some reason. Reparse them.
+ force = true
+ self.incoming_message.parse_raw_email!(force)
+ end
end
return @cached_body
end
@@ -302,7 +324,7 @@ class FoiAttachment < ActiveRecord::Base
body = $1.to_s
body_without_tags = body.gsub(/\s+/,"").gsub(/\<[^\>]*\>/, "")
contains_images = html.match(/<img/mi) ? true : false
- if !$?.success? || html.size == 0 || (body_without_tags.size == 0 && !contains_images)
+ if html.size == 0 || !$?.success? || (body_without_tags.size == 0 && !contains_images)
ret = "<html><head></head><body>";
if self.has_google_docs_viewer?
wrapper_id = "wrapper_google_embed"
diff --git a/app/models/holiday.rb b/app/models/holiday.rb
index 4674d58f1..60b5ff443 100644
--- a/app/models/holiday.rb
+++ b/app/models/holiday.rb
@@ -1,11 +1,11 @@
# == Schema Information
-# Schema version: 95
+# Schema version: 108
#
# Table name: holidays
#
# id :integer not null, primary key
-# day :date
-# description :text
+# day :date
+# description :text
#
# models/holiday.rb:
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 20989d641..f0f1680eb 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -1,7 +1,5 @@
-# encoding: UTF-8
-
# == Schema Information
-# Schema version: 95
+# Schema version: 108
#
# Table name: incoming_messages
#
@@ -10,11 +8,19 @@
# created_at :datetime not null
# updated_at :datetime 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
+# cached_attachment_text_clipped :text
+# cached_main_body_text_folded :text
+# cached_main_body_text_unfolded :text
+# sent_at :time
+# subject :text
+# mail_from_domain :text
+# valid_to_reply_to :boolean
+# last_parsed :datetime
+# mail_from :text
#
+# encoding: UTF-8
+
# models/incoming_message.rb:
# An (email) message from really anybody to be logged with a request. e.g. A
# response from the public body.
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index cfef6ebd8..a0652ecd8 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -1,6 +1,5 @@
-
# == Schema Information
-# Schema version: 95
+# Schema version: 108
#
# Table name: info_requests
#
@@ -11,20 +10,15 @@
# created_at :datetime not null
# updated_at :datetime not null
# described_state :string(255) not null
-# awaiting_description :boolean default(false), not null
+# awaiting_description :boolean default(FALSE), not null
# prominence :string(255) default("normal"), not null
# url_title :text not null
# law_used :string(255) default("foi"), not null
# allow_new_responses_from :string(255) default("anybody"), not null
# handle_rejected_responses :string(255) default("bounce"), not null
+# idhash :string(255) not null
#
-# models/info_request.rb:
-# A Freedom of Information request.
-#
-# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
-#
-# $Id: info_request.rb,v 1.217 2009-10-26 17:52:39 francis Exp $
+
require 'digest/sha1'
require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian')
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 4ea89bf81..8b7b9ebe4 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 95
+# Schema version: 108
#
# Table name: info_request_events
#
@@ -8,12 +8,12 @@
# event_type :text not null
# params_yaml :text not null
# created_at :datetime not null
-# described_state :string(255)
-# calculated_state :string(255)
-# last_described_at :datetime
-# incoming_message_id :integer
-# outgoing_message_id :integer
-# comment_id :integer
+# described_state :string(255)
+# calculated_state :string(255)
+# last_described_at :datetime
+# incoming_message_id :integer
+# outgoing_message_id :integer
+# comment_id :integer
# prominence :string(255) default("normal"), not null
#
@@ -147,6 +147,7 @@ class InfoRequestEvent < ActiveRecord::Base
return event.calculated_state
end
end
+ return
end
def waiting_classification
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb
index b7e310b1e..cc561b21d 100644
--- a/app/models/outgoing_message.rb
+++ b/app/models/outgoing_message.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 95
+# Schema version: 108
#
# Table name: outgoing_messages
#
@@ -10,8 +10,8 @@
# message_type :string(255) not null
# created_at :datetime not null
# updated_at :datetime not null
-# last_sent_at :datetime
-# incoming_message_followup_id :integer
+# last_sent_at :datetime
+# incoming_message_followup_id :integer
# what_doing :string(255) not null
#
diff --git a/app/models/post_redirect.rb b/app/models/post_redirect.rb
index b111d019d..59cc86799 100644
--- a/app/models/post_redirect.rb
+++ b/app/models/post_redirect.rb
@@ -1,17 +1,17 @@
# == Schema Information
-# Schema version: 95
+# Schema version: 108
#
# Table name: post_redirects
#
# id :integer not null, primary key
# token :text not null
# uri :text not null
-# post_params_yaml :text
+# post_params_yaml :text
# created_at :datetime not null
# updated_at :datetime not null
# email_token :text not null
-# reason_params_yaml :text
-# user_id :integer
+# reason_params_yaml :text
+# user_id :integer
# circumstance :text default("normal"), not null
#
diff --git a/app/models/profile_photo.rb b/app/models/profile_photo.rb
index b15e3e4f4..43dbbbf0a 100644
--- a/app/models/profile_photo.rb
+++ b/app/models/profile_photo.rb
@@ -1,12 +1,12 @@
# == Schema Information
-# Schema version: 95
+# Schema version: 108
#
# Table name: profile_photos
#
# id :integer not null, primary key
# data :binary not null
-# user_id :integer
-# draft :boolean default(false), not null
+# user_id :integer
+# draft :boolean default(FALSE), not null
#
# models/profile_photo.rb:
diff --git a/app/models/raw_email.rb b/app/models/raw_email.rb
index c6066cbf4..c6f84318b 100644
--- a/app/models/raw_email.rb
+++ b/app/models/raw_email.rb
@@ -1,11 +1,10 @@
# == Schema Information
-# Schema version: 95
+# Schema version: 108
#
# Table name: raw_emails
#
-# id :integer not null, primary key
-# data_text :text
-# data_binary :binary
+# id :integer not null, primary key
+#
# models/raw_email.rb:
# The fat part of models/incoming_message.rb
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb
index b74f7dad5..6938fade9 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -1,18 +1,18 @@
# == Schema Information
-# Schema version: 95
+# Schema version: 108
#
# Table name: track_things
#
# id :integer not null, primary key
# tracking_user_id :integer not null
# track_query :string(255) not null
-# info_request_id :integer
-# tracked_user_id :integer
-# public_body_id :integer
+# info_request_id :integer
+# tracked_user_id :integer
+# public_body_id :integer
# track_medium :string(255) not null
# track_type :string(255) default("internal_error"), not null
-# created_at :datetime
-# updated_at :datetime
+# created_at :datetime
+# updated_at :datetime
#
# models/track_thing.rb:
diff --git a/app/models/track_things_sent_email.rb b/app/models/track_things_sent_email.rb
index d83bf05ff..777339d75 100644
--- a/app/models/track_things_sent_email.rb
+++ b/app/models/track_things_sent_email.rb
@@ -1,15 +1,15 @@
# == Schema Information
-# Schema version: 95
+# Schema version: 108
#
# Table name: track_things_sent_emails
#
# id :integer not null, primary key
# track_thing_id :integer not null
-# info_request_event_id :integer
-# user_id :integer
-# public_body_id :integer
-# created_at :datetime
-# updated_at :datetime
+# info_request_event_id :integer
+# user_id :integer
+# public_body_id :integer
+# created_at :datetime
+# updated_at :datetime
#
# models/track_things_sent_email.rb:
diff --git a/app/models/user.rb b/app/models/user.rb
index e98d777b1..b6839aa31 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 95
+# Schema version: 108
#
# Table name: users
#
@@ -10,13 +10,14 @@
# salt :string(255) not null
# created_at :datetime not null
# updated_at :datetime not null
-# email_confirmed :boolean default(false), not null
+# email_confirmed :boolean default(FALSE), not null
# url_name :text not null
# last_daily_track_email :datetime default(Sat Jan 01 00:00:00 UTC 2000)
# admin_level :string(255) default("none"), not null
# ban_text :text default(""), not null
# about_me :text default(""), not null
-# email_bounced_at :datetime
+# locale :string(255)
+# email_bounced_at :datetime
# email_bounce_message :text default(""), not null
#
diff --git a/app/models/user_info_request_sent_alert.rb b/app/models/user_info_request_sent_alert.rb
index d07b4e553..5f23355bf 100644
--- a/app/models/user_info_request_sent_alert.rb
+++ b/app/models/user_info_request_sent_alert.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 95
+# Schema version: 108
#
# Table name: user_info_request_sent_alerts
#
@@ -7,7 +7,7 @@
# user_id :integer not null
# info_request_id :integer not null
# alert_type :string(255) not null
-# info_request_event_id :integer
+# info_request_event_id :integer
#
# models/user_info_request_sent_alert.rb:
diff --git a/app/views/admin_general/timeline.rhtml b/app/views/admin_general/timeline.rhtml
index dc72e46cd..39a4b3e36 100644
--- a/app/views/admin_general/timeline.rhtml
+++ b/app/views/admin_general/timeline.rhtml
@@ -36,10 +36,9 @@
end
%>
<% elsif event.event_type == 'edit_outgoing' %>
- <% outgoing_messages = OutgoingMessage.find(:all, event.params[:outgoing_message_id].to_i) %>
+ <% outgoing_message = OutgoingMessage.find(event.params[:outgoing_message_id].to_i) %>
had outgoing message edited by administrator <strong><%=h event.params[:editor] %></strong>.
- <% if outgoing_messages.size > 0 %>
- <% outgoing_message = outgoing_messages[0] %>
+ <% if outgoing_message %>
<% for p in ['body']
if event.params[p.to_sym] != event.params[('old_'+p).to_sym]
%> Changed <%=p%> from '<%=h event.params[('old_'+p).to_sym]%>' to '<%=h event.params[p.to_sym] %>'. <%
@@ -50,10 +49,9 @@
Missing outgoing message, internal error.
<% end %>
<% elsif event.event_type == 'edit_comment' %>
- <% comments = Comment.find(:all, event.params[:comment_id].to_i) %>
+ <% comment = Comment.find(event.params[:comment_id].to_i) %>
had annotation edited by administrator <strong><%=h event.params[:editor] %></strong>.
- <% if comments.size > 0 %>
- <% comment = comments[0] %>
+ <% if comment %>
<% for p in ['body']
if event.params[p.to_sym] != event.params[('old_'+p).to_sym]
%> Changed <%=p%> from '<%=h event.params[('old_'+p).to_sym]%>' to '<%=h event.params[p.to_sym] %>'. <%
diff --git a/app/views/general/_topnav.rhtml b/app/views/general/_topnav.rhtml
index 619ff3593..8ef928bba 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' %>"><%= link_to _("Home"), frontpage_url %></li>
+ <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>
</ul>
-</div> \ No newline at end of file
+</div>
diff --git a/app/views/general/frontpage.rhtml b/app/views/general/frontpage.rhtml
index 35751b6a4..da45a8c37 100644
--- a/app/views/general/frontpage.rhtml
+++ b/app/views/general/frontpage.rhtml
@@ -60,7 +60,7 @@
<%= public_body_link(event.info_request.public_body) %> <%= _('answered a request about') %>
<%=link_to h(event.info_request.title), request_url(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.info_request.title, "", 200) %></p>
+ <p class="excerpt" onclick="document.location.href='<%=request_url(event.info_request)%>'"><%= excerpt(event.search_text_main(true), "", 200) %></p>
</li>
<% end %>
</ul>
diff --git a/app/views/general/search.rhtml b/app/views/general/search.rhtml
index 87a6ab446..43aa9785a 100644
--- a/app/views/general/search.rhtml
+++ b/app/views/general/search.rhtml
@@ -187,6 +187,8 @@
<%= render :partial => 'user/user_listing_single', :locals => { :display_user => result[:model] } %>
<% end %>
</div>
+ <%= will_paginate WillPaginate::Collection.new(@page, @users_per_page, @xapian_users.matches_estimated) %>
+
<% end %>
</div>
diff --git a/app/views/public_body/_search_ahead.rhtml b/app/views/public_body/_search_ahead.rhtml
index 436471544..484d28256 100644
--- a/app/views/public_body/_search_ahead.rhtml
+++ b/app/views/public_body/_search_ahead.rhtml
@@ -13,6 +13,7 @@
<%= render :partial => 'body_listing_single', :locals => { :public_body => result[:model] } %>
<% end %>
</div>
+ <%= will_paginate WillPaginate::Collection.new(@page, 10, @xapian_requests.matches_estimated) %>
<% end %>
</p>
diff --git a/app/views/request/_request_listing_via_event.rhtml b/app/views/request/_request_listing_via_event.rhtml
index e7c378cec..e247163a3 100644
--- a/app/views/request/_request_listing_via_event.rhtml
+++ b/app/views/request/_request_listing_via_event.rhtml
@@ -4,7 +4,7 @@ end %>
<div class="request_listing">
<div class="request_left">
- <span class="head">
+ <span class="head">
<% if event.is_incoming_message? %>
<%= link_to highlight_words(info_request.title, @highlight_words), incoming_message_url(event.incoming_message) %>
<% elsif event.is_outgoing_message? and event.event_type == 'followup_sent' %>
@@ -14,9 +14,9 @@ end %>
<% else %>
<%= link_to highlight_words(info_request.title, @highlight_words), request_url(info_request) %>
<% end %>
- </span>
- <div class="requester">
- <% if event.event_type == 'sent' %>
+ </span>
+ <div class="requester">
+ <% if event.event_type == 'sent' %>
<%= _('Request 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=>user_link_absolute(info_request.user),:date=>simple_date(event.created_at )) %>
<% elsif event.event_type == 'followup_sent' %>
<%=event.display_status %>
@@ -27,19 +27,22 @@ end %>
<% elsif event.event_type == 'comment' %>
<%= _('Request to {{public_body_name}} by {{info_request_user}}. Annotated by {{event_comment_user}} on {{date}}.',:public_body_name=>public_body_link_absolute(info_request.public_body),:info_request_user=>user_link_absolute(info_request.user),:event_comment_user=>user_link_absolute(event.comment.user),:date=>simple_date(event.created_at)) %>
<% else %>
- <% raise _("unknown event type indexed ") + event.event_type %>
+ <%# Events of other types will not be indexed: see InfoRequestEvent#indexed_by_search?
+ However, it can happen that we see other types of event transiently here in the period
+ between a change being made and the update-xapian-index job being run. %>
+ <!-- Event of type '<%= event.event_type %>', id=<%= event.id %> -->
<% end %>
- </div>
- <span class="bottomline icon_<%= info_request.calculate_status %>">
+ </div>
+ <span class="bottomline icon_<%= info_request.calculate_status %>">
<strong>
<%= info_request.display_status %>
</strong><br>
- </span>
+ </span>
</div>
<div class="request_right">
<span class="desc">
<%= highlight_and_excerpt(event.search_text_main(true), @highlight_words, 150) %>
- </span>
- </div>
+ </span>
+ </div>
</div>
diff --git a/app/views/request/select_authority.rhtml b/app/views/request/select_authority.rhtml
index 55ebc40c4..0e8df872d 100644
--- a/app/views/request/select_authority.rhtml
+++ b/app/views/request/select_authority.rhtml
@@ -7,16 +7,17 @@
// http://benalman.com/projects/jquery-throttle-debounce-plugin/
$("#query").keypress($.debounce( 300, function() {
// Do a type ahead search and display results
- $("#typeahead_response").load("<%=search_ahead_bodies_url%>?q="+encodeURI(this.value), function() {
+ $("#typeahead_response").load("<%=search_ahead_bodies_url%>?query="+encodeURI(this.value), function() {
$("#authority_preview").hide(); // Hide the preview, since results have changed
});
}));
// We're using the existing body list: we intercept the clicks on the titles to
// display a preview on the right hand side of the screen
- $("#typeahead_response a").live('click', function() {
+ $("#typeahead_response .head a").live('click', function() {
$("#authority_preview").load(this.href+" #public_body_show", function() {
$("#authority_preview").show();
+ $(window).scrollTop($("#banner").height());
$("#authority_preview #header_right").hide();
});
return false;
@@ -33,8 +34,8 @@
<p>
<p>
<%= _('First, type in the <strong>name of the UK public authority</strong> you\'d
- <br>like information from. <strong>By law, they have to respond</strong>
- (<a href="%s">why?</a>).') % help_about_url %>
+ like information from. <strong>By law, they have to respond</strong>
+ (<a href="%s#%s">why?</a>).') % [help_about_url, "whybother_them"] %>
</p>
<%= text_field_tag 'query', params[:query], { :size => 30 } %>
<%= hidden_field_tag 'bodies', 1 %>
@@ -56,6 +57,8 @@
<%= render :partial => 'public_body/body_listing_single', :locals => { :public_body => result[:model] } %>
<% end %>
</div>
+ <%= will_paginate WillPaginate::Collection.new(@page, 10, @xapian_requests.matches_estimated) %>
+
<% end %>
diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml
index 9ac203541..2d2394f5c 100644
--- a/app/views/user/show.rhtml
+++ b/app/views/user/show.rhtml
@@ -147,7 +147,7 @@
<% end %>
<% else %>
<h2 class="foi_results" id="foi_requests">
- <%= @is_you ? n_('Your %d Freedom of Information request', 'Your %d Freedom of Information requests', @xapian_requests.results.size) % @xapian_requests.results.size : n_('This person\'s %d Freedom of Information request', 'This person\'s %d Freedom of Information requests', @xapian_requests.results.size) % @xapian_requests.results.size %>
+ <%= @is_you ? n_('Your %d Freedom of Information request', 'Your %d Freedom of Information requests', @xapian_requests.results.size) % @xapian_requests.results.size : n_('This person\'s %d Freedom of Information request', 'This person\'s %d Freedom of Information requests', @xapian_requests.matches_estimated.to_s) % @xapian_requests.matches_estimated %>
<!-- matches_estimated <%=@xapian_requests.matches_estimated%> -->
<%= @match_phrase %>
<%= @page_desc %>