aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb32
1 files changed, 16 insertions, 16 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 47accae1c..e305e90f4 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -20,7 +20,7 @@ class ApplicationController < ActionController::Base
# 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
@@ -34,7 +34,7 @@ class ApplicationController < ActionController::Base
def set_vary_header
response.headers['Vary'] = 'Cookie'
end
-
+
helper_method :anonymous_cache, :short_cache, :medium_cache, :long_cache
def anonymous_cache(time)
if session[:user_id].nil?
@@ -131,7 +131,7 @@ class ApplicationController < ActionController::Base
end
end
# Make sure expiry time for session is set (before_filters are
- # otherwise missed by this override)
+ # otherwise missed by this override)
session_remember_me
case exception
when ActiveRecord::RecordNotFound, ActionController::UnknownAction, ActionController::RoutingError
@@ -153,13 +153,13 @@ class ApplicationController < ActionController::Base
alias original_rescue_action_locally rescue_action_locally
def rescue_action_locally(exception)
# Make sure expiry time for session is set (before_filters are
- # otherwise missed by this override)
+ # otherwise missed by this override)
session_remember_me
# Display default, detailed error for developers
original_rescue_action_locally(exception)
end
-
+
def local_request?
false
end
@@ -220,7 +220,7 @@ class ApplicationController < ActionController::Base
end
end
- # get the local locale
+ # get the local locale
def locale_from_params(*args)
if params[:show_locale]
params[:show_locale]
@@ -320,7 +320,7 @@ class ApplicationController < ActionController::Base
end
end
- #
+ #
def check_read_only
read_only = MySociety::Config.get('READ_ONLY', '')
if !read_only.empty?
@@ -349,7 +349,7 @@ class ApplicationController < ActionController::Base
@http_auth_user = admin_http_auth_user
end
- # Convert URL name for sort by order, to Xapian query
+ # Convert URL name for sort by order, to Xapian query
def order_to_sort_by(sortby)
if sortby.nil?
return [nil, nil]
@@ -365,7 +365,7 @@ class ApplicationController < ActionController::Base
end
# Function for search
- def perform_search(models, query, sortby, collapse, per_page = 25, this_page = nil)
+ def perform_search(models, query, sortby, collapse, per_page = 25, this_page = nil)
@query = query
@sortby = sortby
@@ -401,7 +401,7 @@ class ApplicationController < ActionController::Base
collapse = 'request_collapse'
end
options = {
- :offset => (@page - 1) * @per_page,
+ :offset => (@page - 1) * @per_page,
:limit => @per_page,
:sort_by_prefix => nil,
:sort_by_ascending => true,
@@ -420,7 +420,7 @@ class ApplicationController < ActionController::Base
if e.message =~ /^QueryParserError: Wildcard/
# Wildcard expands to too many terms
logger.info "Wildcard query '#{query.strip + '*'}' caused: #{e.message}"
-
+
user_query = ActsAsXapian.query_parser.parse_query(
query,
Xapian::QueryParser::FLAG_LOVEHATE |
@@ -449,8 +449,8 @@ class ApplicationController < ActionController::Base
def param_exists(item)
return params[item] && !params[item].empty?
- end
-
+ end
+
def get_request_variety_from_params
query = ""
sortby = "newest"
@@ -475,7 +475,7 @@ class ApplicationController < ActionController::Base
def get_status_from_params
query = ""
- if params[:latest_status]
+ if params[:latest_status]
statuses = []
if params[:latest_status].class == String
params[:latest_status] = [params[:latest_status]]
@@ -526,7 +526,7 @@ class ApplicationController < ActionController::Base
query = ""
tags = []
if param_exists(:tags)
- params[:tags].split().each do |tag|
+ params[:tags].split().each do |tag|
tags << "tag:#{tag}"
end
end
@@ -535,7 +535,7 @@ class ApplicationController < ActionController::Base
end
return query
end
-
+
def make_query_from_params
query = params[:query] || "" if query.nil?
query += get_date_range_from_params