aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/admin_comment_controller.rb2
-rw-r--r--app/controllers/admin_incoming_message_controller.rb6
-rw-r--r--app/controllers/admin_outgoing_message_controller.rb4
-rw-r--r--app/controllers/admin_public_body_controller.rb14
-rw-r--r--app/controllers/admin_request_controller.rb6
-rw-r--r--app/controllers/api_controller.rb2
-rw-r--r--app/controllers/application_controller.rb2
-rw-r--r--app/controllers/general_controller.rb4
-rw-r--r--app/controllers/public_body_controller.rb8
-rw-r--r--app/controllers/request_controller.rb8
-rw-r--r--app/controllers/request_game_controller.rb2
-rw-r--r--app/controllers/user_controller.rb6
12 files changed, 33 insertions, 31 deletions
diff --git a/app/controllers/admin_comment_controller.rb b/app/controllers/admin_comment_controller.rb
index 0d5e84fed..030afb645 100644
--- a/app/controllers/admin_comment_controller.rb
+++ b/app/controllers/admin_comment_controller.rb
@@ -21,7 +21,7 @@ class AdminCommentController < AdminController
if @comment.update_attributes(params[:comment])
@comment.info_request.log_event("edit_comment",
{ :comment_id => @comment.id,
- :editor => admin_current_user(),
+ :editor => admin_current_user,
:old_body => old_body,
:body => @comment.body,
:old_visible => old_visible,
diff --git a/app/controllers/admin_incoming_message_controller.rb b/app/controllers/admin_incoming_message_controller.rb
index 8dfd53662..db7bed34c 100644
--- a/app/controllers/admin_incoming_message_controller.rb
+++ b/app/controllers/admin_incoming_message_controller.rb
@@ -14,7 +14,7 @@ class AdminIncomingMessageController < AdminController
if @incoming_message.save
@incoming_message.info_request.log_event('edit_incoming',
:incoming_message_id => @incoming_message.id,
- :editor => admin_current_user(),
+ :editor => admin_current_user,
:old_prominence => old_prominence,
:prominence => @incoming_message.prominence,
:old_prominence_reason => old_prominence_reason,
@@ -34,7 +34,7 @@ class AdminIncomingMessageController < AdminController
@incoming_message.fully_destroy
@incoming_message.info_request.log_event("destroy_incoming",
- { :editor => admin_current_user(), :deleted_incoming_message_id => incoming_message_id })
+ { :editor => admin_current_user, :deleted_incoming_message_id => incoming_message_id })
# expire cached files
expire_for_request(@info_request)
flash[:notice] = 'Incoming message successfully destroyed.'
@@ -64,7 +64,7 @@ class AdminIncomingMessageController < AdminController
incoming_message_id = incoming_message.id
incoming_message.info_request.log_event("redeliver_incoming", {
- :editor => admin_current_user(),
+ :editor => admin_current_user,
:destination_request => destination_request.id,
:deleted_incoming_message_id => incoming_message_id
})
diff --git a/app/controllers/admin_outgoing_message_controller.rb b/app/controllers/admin_outgoing_message_controller.rb
index 6c0b23ceb..56e27b108 100644
--- a/app/controllers/admin_outgoing_message_controller.rb
+++ b/app/controllers/admin_outgoing_message_controller.rb
@@ -12,7 +12,7 @@ class AdminOutgoingMessageController < AdminController
@outgoing_message.fully_destroy
@outgoing_message.info_request.log_event("destroy_outgoing",
- { :editor => admin_current_user(), :deleted_outgoing_message_id => outgoing_message_id })
+ { :editor => admin_current_user, :deleted_outgoing_message_id => outgoing_message_id })
flash[:notice] = 'Outgoing message successfully destroyed.'
redirect_to admin_request_url(@info_request)
@@ -30,7 +30,7 @@ class AdminOutgoingMessageController < AdminController
if @outgoing_message.save
@outgoing_message.info_request.log_event("edit_outgoing",
{ :outgoing_message_id => @outgoing_message.id,
- :editor => admin_current_user(),
+ :editor => admin_current_user,
:old_body => old_body,
:body => @outgoing_message.body,
:old_prominence => old_prominence,
diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb
index 12ce8bf90..b3c2c1dfd 100644
--- a/app/controllers/admin_public_body_controller.rb
+++ b/app/controllers/admin_public_body_controller.rb
@@ -12,7 +12,7 @@ class AdminPublicBodyController < AdminController
end
def show
- @locale = self.locale_from_params()
+ @locale = locale_from_params
I18n.with_locale(@locale) do
@public_body = PublicBody.find(params[:id])
@info_requests = @public_body.info_requests.paginate :order => "created_at desc",
@@ -44,7 +44,7 @@ class AdminPublicBodyController < AdminController
if params[:change_request_id]
@change_request = PublicBodyChangeRequest.find(params[:change_request_id])
end
- params[:public_body][:last_edit_editor] = admin_current_user()
+ params[:public_body][:last_edit_editor] = admin_current_user
@public_body = PublicBody.new(params[:public_body])
if @public_body.save
if @change_request
@@ -85,7 +85,7 @@ class AdminPublicBodyController < AdminController
@change_request = PublicBodyChangeRequest.find(params[:change_request_id])
end
I18n.with_locale(I18n.default_locale) do
- params[:public_body][:last_edit_editor] = admin_current_user()
+ params[:public_body][:last_edit_editor] = admin_current_user
@public_body = PublicBody.find(params[:id])
if @public_body.update_attributes(params[:public_body])
if @change_request
@@ -102,7 +102,7 @@ class AdminPublicBodyController < AdminController
end
def destroy
- @locale = self.locale_from_params()
+ @locale = locale_from_params
I18n.with_locale(@locale) do
public_body = PublicBody.find(params[:id])
@@ -178,7 +178,7 @@ class AdminPublicBodyController < AdminController
params[:tag],
params[:tag_behaviour],
true,
- admin_current_user(),
+ admin_current_user,
I18n.available_locales)
if errors.size == 0
@@ -192,7 +192,7 @@ class AdminPublicBodyController < AdminController
params[:tag],
params[:tag_behaviour],
false,
- admin_current_user(),
+ admin_current_user,
I18n.available_locales)
if errors.size != 0
raise "dry run mismatched real run"
@@ -235,7 +235,7 @@ class AdminPublicBodyController < AdminController
end
def lookup_query
- @locale = self.locale_from_params()
+ @locale = locale_from_params
underscore_locale = @locale.gsub '-', '_'
I18n.with_locale(@locale) do
@query = params[:query]
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb
index bacf087e9..eaf6c337d 100644
--- a/app/controllers/admin_request_controller.rb
+++ b/app/controllers/admin_request_controller.rb
@@ -57,7 +57,7 @@ class AdminRequestController < AdminController
if @info_request.valid?
@info_request.save!
@info_request.log_event("edit",
- { :editor => admin_current_user(),
+ { :editor => admin_current_user,
:old_title => old_title, :title => @info_request.title,
:old_prominence => old_prominence, :prominence => @info_request.prominence,
:old_described_state => old_described_state, :described_state => params[:info_request][:described_state],
@@ -105,7 +105,7 @@ class AdminRequestController < AdminController
info_request.user = destination_user
info_request.save!
info_request.log_event("move_request", {
- :editor => admin_current_user(),
+ :editor => admin_current_user,
:old_user_url_name => old_user.url_name,
:user_url_name => destination_user.url_name
})
@@ -176,7 +176,7 @@ class AdminRequestController < AdminController
info_request.prominence = "requester_only"
info_request.log_event("hide", {
- :editor => admin_current_user(),
+ :editor => admin_current_user,
:reason => params[:reason],
:subject => subject,
:explanation => explanation
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb
index 779ae04a6..3b8991f28 100644
--- a/app/controllers/api_controller.rb
+++ b/app/controllers/api_controller.rb
@@ -42,7 +42,7 @@ class ApiController < ApplicationController
:status => 'ready',
:message_type => 'initial_request',
:body => json["body"],
- :last_sent_at => Time.now(),
+ :last_sent_at => Time.now,
:what_doing => 'normal_sort',
:info_request => request
)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 07956d370..a76e6630a 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -206,7 +206,7 @@ class ApplicationController < ActionController::Base
def foi_fragment_cache_part_path(param)
path = url_for(param)
id = param['id'] || param[:id]
- first_three_digits = id.to_s()[0..2]
+ first_three_digits = id.to_s[0..2]
path = path.sub("/request/", "/request/" + first_three_digits + "/")
return path
end
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index 324f5f2e4..53288c2f4 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -15,7 +15,7 @@ class GeneralController < ApplicationController
# New, improved front page!
def frontpage
medium_cache
- @locale = self.locale_from_params()
+ @locale = locale_from_params
successful_query = InfoRequestEvent.make_query_from_params( :latest_status => ['successful'] )
@track_thing = TrackThing.create_track_for_search_query(successful_query)
@feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'),
@@ -33,7 +33,7 @@ class GeneralController < ApplicationController
@feed_autodetect = []
@feed_url = AlaveteliConfiguration::blog_feed
separator = @feed_url.include?('?') ? '&' : '?'
- @feed_url = "#{@feed_url}#{separator}lang=#{self.locale_from_params()}"
+ @feed_url = "#{@feed_url}#{separator}lang=#{locale_from_params}"
@blog_items = []
if not @feed_url.empty?
content = quietly_try_to_open(@feed_url)
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb
index b34c929f5..1b01dc837 100644
--- a/app/controllers/public_body_controller.rb
+++ b/app/controllers/public_body_controller.rb
@@ -24,7 +24,7 @@ class PublicBodyController < ApplicationController
redirect_to :url_name => MySociety::Format.simplify_url_part(params[:url_name], 'body'), :status => :moved_permanently
return
end
- @locale = self.locale_from_params()
+ @locale = locale_from_params
I18n.with_locale(@locale) do
@public_body = PublicBody.find_by_url_name_with_historic(params[:url_name])
raise ActiveRecord::RecordNotFound.new("None found") if @public_body.nil?
@@ -40,6 +40,8 @@ class PublicBodyController < ApplicationController
set_last_body(@public_body)
+ @number_of_visible_requests = @public_body.info_requests.visible.count
+
top_url = frontpage_url
@searched_to_send_request = false
referrer = request.env['HTTP_REFERER']
@@ -83,7 +85,7 @@ class PublicBodyController < ApplicationController
@public_body = PublicBody.find_by_url_name_with_historic(params[:url_name])
raise ActiveRecord::RecordNotFound.new("None found") if @public_body.nil?
- I18n.with_locale(self.locale_from_params()) do
+ I18n.with_locale(locale_from_params) do
if params[:submitted_view_email]
if verify_recaptcha
flash.discard(:error)
@@ -106,7 +108,7 @@ class PublicBodyController < ApplicationController
@tag = params[:tag]
- @locale = self.locale_from_params
+ @locale = locale_from_params
underscore_locale = @locale.gsub '-', '_'
underscore_default_locale = I18n.default_locale.to_s.gsub '-', '_'
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index f63fb0301..45229fd7e 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -75,7 +75,7 @@ class RequestController < ApplicationController
else
medium_cache
end
- @locale = self.locale_from_params()
+ @locale = locale_from_params
I18n.with_locale(@locale) do
# Look up by old style numeric identifiers
@@ -164,7 +164,7 @@ class RequestController < ApplicationController
def list
medium_cache
@view = params[:view]
- @locale = self.locale_from_params()
+ @locale = locale_from_params
@page = get_search_page_from_params if !@page # used in cache case, as perform_search sets @page as side effect
@per_page = PER_PAGE
@max_results = MAX_RESULTS
@@ -848,7 +848,7 @@ class RequestController < ApplicationController
# FOI officers can upload a response
def upload_response
- @locale = self.locale_from_params()
+ @locale = locale_from_params
I18n.with_locale(@locale) do
@info_request = InfoRequest.find_by_url_title!(params[:url_title])
@@ -914,7 +914,7 @@ class RequestController < ApplicationController
end
def download_entire_request
- @locale = self.locale_from_params()
+ @locale = locale_from_params
I18n.with_locale(@locale) do
@info_request = InfoRequest.find_by_url_title!(params[:url_title])
if authenticated?(
diff --git a/app/controllers/request_game_controller.rb b/app/controllers/request_game_controller.rb
index cb3ba1f3a..2915b5c2f 100644
--- a/app/controllers/request_game_controller.rb
+++ b/app/controllers/request_game_controller.rb
@@ -23,7 +23,7 @@ class RequestGameController < ApplicationController
:site_name => site_name)
end
- @league_table_28_days = RequestClassification.league_table(10, [ "created_at >= ?", Time.now() - 28.days ])
+ @league_table_28_days = RequestClassification.league_table(10, [ "created_at >= ?", Time.now - 28.days ])
@league_table_all_time = RequestClassification.league_table(10)
@play_urls = true
end
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index 8d9adfc77..bb4ba28d1 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -373,7 +373,7 @@ class UserController < ApplicationController
if (not session[:user_circumstance]) or (session[:user_circumstance] != "change_email")
# don't store the password in the db
params[:signchangeemail].delete(:password)
- post_redirect = PostRedirect.new(:uri => signchangeemail_url(),
+ post_redirect = PostRedirect.new(:uri => signchangeemail_url,
:post_params => params,
:circumstance => "change_email" # special login that lets you change your email
)
@@ -510,7 +510,7 @@ class UserController < ApplicationController
else
flash[:notice] = _("<p>Thanks for updating your profile photo.</p>
<p><strong>Next...</strong> You can put some text about you and your research on your profile.</p>")
- redirect_to set_profile_about_me_url()
+ redirect_to set_profile_about_me_url
end
else
render :template => 'user/set_draft_profile_photo'
@@ -596,7 +596,7 @@ class UserController < ApplicationController
else
flash[:notice] = _("<p>Thanks for changing the text about you on your profile.</p>
<p><strong>Next...</strong> You can upload a profile photograph too.</p>")
- redirect_to set_profile_photo_url()
+ redirect_to set_profile_photo_url
end
end