aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/api_controller.rb2
-rw-r--r--app/controllers/application_controller.rb4
-rw-r--r--app/controllers/request_controller.rb5
-rw-r--r--app/controllers/track_controller.rb5
-rw-r--r--app/helpers/application_helper.rb8
-rw-r--r--app/models/incoming_message.rb8
-rw-r--r--app/models/public_body.rb1
-rw-r--r--app/views/general/_frontpage_requests_list.html.erb2
-rw-r--r--app/views/general/_header.html.erb37
-rw-r--r--app/views/layouts/default.html.erb38
-rw-r--r--app/views/request/_incoming_correspondence.text.erb2
-rw-r--r--app/views/request/_outgoing_correspondence.text.erb2
-rw-r--r--app/views/request/_request_listing_single.html.erb10
-rw-r--r--app/views/request/show.text.erb8
-rw-r--r--app/views/track/atom_feed.atom.erb2
15 files changed, 70 insertions, 64 deletions
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb
index e7bea67ef..00a3beebd 100644
--- a/app/controllers/api_controller.rb
+++ b/app/controllers/api_controller.rb
@@ -200,7 +200,7 @@ class ApiController < ApplicationController
])
end
if feed_type == "atom"
- render :template => "api/request_events.atom", :layout => false
+ render :template => "api/request_events", :formats => ['atom'], :layout => false
elsif feed_type == "json"
# For the JSON feed, we take a "since" parameter that allows the client
# to restrict to events more recent than a certain other event
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index cbdffc441..161a82b26 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -138,7 +138,9 @@ class ApplicationController < ActionController::Base
backtrace = Rails.backtrace_cleaner.clean(exception.backtrace, :silent)
message << " " << backtrace.join("\n ")
Rails.logger.fatal("#{message}\n\n")
- ExceptionNotifier::Notifier.exception_notification(request.env, exception).deliver
+ if !AlaveteliConfiguration.exception_notifications_from.blank? && !AlaveteliConfiguration.exception_notifications_to.blank?
+ ExceptionNotifier::Notifier.exception_notification(request.env, exception).deliver
+ end
@status = 500
end
respond_to do |format|
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 388473b51..44f3a5b9b 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -965,8 +965,9 @@ class RequestController < ApplicationController
end
if !done
file_info = { :filename => 'correspondence.txt',
- :data => render_to_string(:template => 'request/show.text',
- :layout => false) }
+ :data => render_to_string(:template => 'request/show',
+ :layout => false,
+ :formats => [:text]) }
end
file_info
end
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb
index 72c092221..1123903f9 100644
--- a/app/controllers/track_controller.rb
+++ b/app/controllers/track_controller.rb
@@ -160,7 +160,10 @@ class TrackController < ApplicationController
format.json { render :json => @xapian_object.results.map { |r| r[:model].json_for_api(true,
lambda { |t| view_context.highlight_and_excerpt(t, @xapian_object.words_to_highlight, 150) }
) } }
- format.any { render :template => 'track/atom_feed.atom', :layout => false, :content_type => 'application/atom+xml' }
+ format.any { render :template => 'track/atom_feed',
+ :formats => ['atom'],
+ :layout => false,
+ :content_type => 'application/atom+xml' }
end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e3b1e57ac..6d0a111e9 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -54,16 +54,16 @@ module ApplicationHelper
# Highlight words, also escapes HTML (other than spans that we add)
def highlight_words(t, words, html = true)
if html
- highlight(h(t), words, '<span class="highlight">\1</span>').html_safe
+ highlight(h(t), words, :highlighter => '<span class="highlight">\1</span>').html_safe
else
- highlight(t, words, '*\1*')
+ highlight(t, words, :highlighter => '*\1*')
end
end
def highlight_and_excerpt(t, words, excount, html = true)
- newt = excerpt(t, words[0], excount)
+ newt = excerpt(t, words[0], :radius => excount)
if not newt
- newt = excerpt(t, '', excount)
+ newt = excerpt(t, '', :radius => excount)
end
t = newt
t = highlight_words(t, words, html)
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 8b2aa87e7..bcf0b6ec9 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -129,15 +129,15 @@ class IncomingMessage < ActiveRecord::Base
if (!force.nil? || self.last_parsed.nil?)
ActiveRecord::Base.transaction do
self.extract_attachments!
- self.sent_at = self.mail.date || self.created_at
- self.subject = self.mail.subject
- self.mail_from = MailHandler.get_from_name(self.mail)
+ write_attribute(:sent_at, self.mail.date || self.created_at)
+ write_attribute(:subject, self.mail.subject)
+ write_attribute(:mail_from, MailHandler.get_from_name(self.mail))
if self.from_email
self.mail_from_domain = PublicBody.extract_domain_from_email(self.from_email)
else
self.mail_from_domain = ""
end
- self.valid_to_reply_to = self._calculate_valid_to_reply_to
+ write_attribute(:valid_to_reply_to, self._calculate_valid_to_reply_to)
self.last_parsed = Time.now
self.foi_attachments reload=true
self.save!
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index db6359f6b..883afc3af 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -199,7 +199,6 @@ class PublicBody < ActiveRecord::Base
self.non_versioned_columns << 'info_requests_overdue_count'
class Version
- attr_accessor :created_at
def last_edit_comment_for_html_display
text = self.last_edit_comment.strip
diff --git a/app/views/general/_frontpage_requests_list.html.erb b/app/views/general/_frontpage_requests_list.html.erb
index fa498dfa7..a628c14ef 100644
--- a/app/views/general/_frontpage_requests_list.html.erb
+++ b/app/views/general/_frontpage_requests_list.html.erb
@@ -21,7 +21,7 @@
<%=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_path(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), "", :radius => 200) %></p>
</li>
<% end %>
</ul>
diff --git a/app/views/general/_header.html.erb b/app/views/general/_header.html.erb
new file mode 100644
index 000000000..55bf719e2
--- /dev/null
+++ b/app/views/general/_header.html.erb
@@ -0,0 +1,37 @@
+<div id="banner">
+ <div id="banner_inner">
+ <div class="lang"><%= render :partial => 'general/locale_switcher' %></div>
+
+ <% if not (controller.action_name == 'signin' or controller.action_name == 'signup') %>
+ <div id="logged_in_bar">
+ <% if @user %>
+ <%= _('Hello, {{username}}!', :username => h(@user.name))%>
+
+ <% if @user %>
+ <%=link_to _("My requests"), show_user_requests_path(:url_name => @user.url_name) %>
+ <%=link_to _("My profile"), show_user_profile_path(:url_name => @user.url_name) %>
+ <%=link_to _("My wall"), show_user_wall_path(:url_name => @user.url_name) %>
+ <% end %>
+
+
+ <%= link_to _("Sign out"), signout_path(:r => request.fullpath) %>
+ <% else %>
+ <%= link_to _("Sign in or sign up"), signin_path(:r => request.fullpath) %>
+ <% end %>
+ </div>
+ <% end %>
+
+ <div id="navigation_search">
+ <form id="navigation_search_form" method="post" action="<%= search_redirect_path %>">
+ <p>
+ <%= text_field_tag 'query', params[:query], { :size => 40, :id => "navigation_search_query", :title => "type your search term here" } %>
+ <input id="navigation_search_button" type="submit" value="search">
+ </p>
+ </form>
+ </div>
+
+ <%= render :partial => 'general/orglink' %>
+
+ <%= render :partial => 'general/topnav' %>
+ </div>
+</div>
diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb
index e90e89a00..8d69b2a08 100644
--- a/app/views/layouts/default.html.erb
+++ b/app/views/layouts/default.html.erb
@@ -76,43 +76,7 @@
<% end %>
<div class="entirebody">
- <div id="banner">
- <div id="banner_inner">
- <div class="lang"><%= render :partial => 'general/locale_switcher' %></div>
-
- <% if not (controller.action_name == 'signin' or controller.action_name == 'signup') %>
- <div id="logged_in_bar">
- <% if @user %>
- <%= _('Hello, {{username}}!', :username => h(@user.name))%>
-
- <% if @user %>
- <%=link_to _("My requests"), show_user_requests_path(:url_name => @user.url_name) %>
- <%=link_to _("My profile"), show_user_profile_path(:url_name => @user.url_name) %>
- <%=link_to _("My wall"), show_user_wall_path(:url_name => @user.url_name) %>
- <% end %>
-
-
- <%= link_to _("Sign out"), signout_path(:r => request.fullpath) %>
- <% else %>
- <%= link_to _("Sign in or sign up"), signin_path(:r => request.fullpath) %>
- <% end %>
- </div>
- <% end %>
-
- <div id="navigation_search">
- <form id="navigation_search_form" method="post" action="<%= search_redirect_path %>">
- <p>
- <%= text_field_tag 'query', params[:query], { :size => 40, :id => "navigation_search_query", :title => "type your search term here" } %>
- <input id="navigation_search_button" type="submit" value="search">
- </p>
- </form>
- </div>
-
- <%= render :partial => 'general/orglink' %>
-
- <%= render :partial => 'general/topnav' %>
- </div>
- </div>
+ <%= render :partial => 'general/header' %>
<div id="wrapper">
<div id="content">
<% if flash[:notice] %>
diff --git a/app/views/request/_incoming_correspondence.text.erb b/app/views/request/_incoming_correspondence.text.erb
index 33ddad926..c5e648d28 100644
--- a/app/views/request/_incoming_correspondence.text.erb
+++ b/app/views/request/_incoming_correspondence.text.erb
@@ -1,5 +1,5 @@
<%- if not incoming_message.user_can_view?(@user) %>
- <%= render :partial => 'request/hidden_correspondence.text', :locals => { :message => incoming_message }%>
+ <%= render :partial => 'request/hidden_correspondence', :formats => 'text', :locals => { :message => incoming_message }%>
<%- else %>
<%= _('From:') %><% if incoming_message.specific_from_name? %> <%= incoming_message.safe_mail_from %><% end %><% if incoming_message.from_public_body? %>, <%= @info_request.public_body.name %><% end %>
<%= _('To:') %> <% if @info_request.user_name %><%= @info_request.user_name %><% else %><%= "[#{_('An anonymous user')}]"%><% end %>
diff --git a/app/views/request/_outgoing_correspondence.text.erb b/app/views/request/_outgoing_correspondence.text.erb
index 80c71cc01..5375ef81b 100644
--- a/app/views/request/_outgoing_correspondence.text.erb
+++ b/app/views/request/_outgoing_correspondence.text.erb
@@ -1,5 +1,5 @@
<%- if not outgoing_message.user_can_view?(@user) %>
- <%= render :partial => 'request/hidden_correspondence.text', :locals => { :message => outgoing_message }%>
+ <%= render :partial => 'request/hidden_correspondence', :formats => 'text', :locals => { :message => outgoing_message }%>
<%- else %>
<%= _('From:') %> <% if @info_request.user_name %><%= @info_request.user_name %><% else %><%= "[#{_('An anonymous user')}]"%><% end %>
<%= _('To:') %> <%= @info_request.public_body.name %>
diff --git a/app/views/request/_request_listing_single.html.erb b/app/views/request/_request_listing_single.html.erb
index 56737fd3e..50f889d75 100644
--- a/app/views/request/_request_listing_single.html.erb
+++ b/app/views/request/_request_listing_single.html.erb
@@ -1,9 +1,9 @@
<div class="request_listing">
- <span class="head">
- <%= 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) %>
+ <span class="head">
+ <%= 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, "", :radius => 150) %>
</span>
<span class="bottomline icon_<%= info_request.calculate_status %>">
<strong>
diff --git a/app/views/request/show.text.erb b/app/views/request/show.text.erb
index 29ac2987f..8079d10d5 100644
--- a/app/views/request/show.text.erb
+++ b/app/views/request/show.text.erb
@@ -4,13 +4,13 @@
<% if info_request_event.visible %>
<% case info_request_event.event_type %>
<% when 'response' %>
- <%= render :partial => 'request/incoming_correspondence.text', :locals => { :incoming_message => info_request_event.incoming_message } %>
+ <%= render :partial => 'request/incoming_correspondence', :formats => 'text', :locals => { :incoming_message => info_request_event.incoming_message } %>
<% when 'sent', 'followup_sent' %>
- <%= render :partial => 'request/outgoing_correspondence.text', :locals => { :outgoing_message => info_request_event.outgoing_message, :info_request_event => info_request_event }%>
+ <%= render :partial => 'request/outgoing_correspondence', :formats => 'text', :locals => { :outgoing_message => info_request_event.outgoing_message, :info_request_event => info_request_event }%>
<% when 'resent', 'followup_resent' %>
- <%= render :partial => 'request/resent_outgoing_correspondence.text', :locals => { outgoing_message => info_request_event.outgoing_message, :info_request_event => info_request_event }%>
+ <%= render :partial => 'request/resent_outgoing_correspondence', :formats => 'text', :locals => { outgoing_message => info_request_event.outgoing_message, :info_request_event => info_request_event }%>
<% when 'comment' %>
- <%= render :partial => 'comment/single_comment.text', :locals => { :comment => info_request_event.comment } %>
+ <%= render :partial => 'comment/single_comment', :formats => 'text', :locals => { :comment => info_request_event.comment } %>
<% end %>
-------------------------------
<% end %>
diff --git a/app/views/track/atom_feed.atom.erb b/app/views/track/atom_feed.atom.erb
index a12b9eff0..be9c39e72 100644
--- a/app/views/track/atom_feed.atom.erb
+++ b/app/views/track/atom_feed.atom.erb
@@ -9,7 +9,7 @@
# Get the HTML content from the same partial template as website search does
content = ''
if result[:model].class.to_s == 'InfoRequestEvent'
- content += render :partial => 'request/request_listing_via_event.html', :locals => { :event => result[:model], :info_request => result[:model].info_request }
+ content += render :partial => 'request/request_listing_via_event', :formats => ['html'], :locals => { :event => result[:model], :info_request => result[:model].info_request }
else
content = "<p><strong>Unknown search result type " + result[:model].class.to_s + "</strong></p>"
end