summaryrefslogtreecommitdiffstats
path: root/app/models/setting.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-12-29 11:36:30 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-12-29 11:36:30 +0000
commit9a1b46fe42873c5fa4c8bb9cf6755eed9e8315db (patch)
tree55c78bfcc226b12a1f8cbb1469caa7528be78a6f /app/models/setting.rb
parent7eec539222731f5b3fca40d6dbaae8f00f01feba (diff)
downloadredmine-9a1b46fe42873c5fa4c8bb9cf6755eed9e8315db.tar.gz
redmine-9a1b46fe42873c5fa4c8bb9cf6755eed9e8315db.zip
New setting added to specify how many objects should be displayed on most paginated lists.
Default is: 25, 50, 100 (users can choose one of these values). If one value only is entered in this setting (eg. 25), the 'per page' links are not displayed (prior behaviour). git-svn-id: http://redmine.rubyforge.org/svn/trunk@1026 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/setting.rb')
-rw-r--r--app/models/setting.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/setting.rb b/app/models/setting.rb
index 4d4cf0045..46b6d76ce 100644
--- a/app/models/setting.rb
+++ b/app/models/setting.rb
@@ -95,6 +95,11 @@ class Setting < ActiveRecord::Base
class_eval src, __FILE__, __LINE__
end
+ # Helper that returns an array based on per_page_options setting
+ def self.per_page_options_array
+ per_page_options.split(%r{[\s,]}).collect(&:to_i).select {|n| n > 0}.sort
+ end
+
# Checks if settings have changed since the values were read
# and clears the cache hash if it's the case
# Called once per request