summaryrefslogtreecommitdiffstats
path: root/app/controllers/application.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/application.rb')
-rw-r--r--app/controllers/application.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/controllers/application.rb b/app/controllers/application.rb
index ad86b6b33..607ac091b 100644
--- a/app/controllers/application.rb
+++ b/app/controllers/application.rb
@@ -158,6 +158,21 @@ class ApplicationController < ActionController::Base
attachments
end
+ # Returns the number of objects that should be displayed
+ # on the paginated list
+ def per_page_option
+ per_page = nil
+ if params[:per_page] && Setting.per_page_options_array.include?(params[:per_page].to_s.to_i)
+ per_page = params[:per_page].to_s.to_i
+ session[:per_page] = per_page
+ elsif session[:per_page]
+ per_page = session[:per_page]
+ else
+ per_page = Setting.per_page_options_array.first || 25
+ end
+ per_page
+ end
+
# qvalues http header parser
# code taken from webrick
def parse_qvalues(value)