diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-10-30 08:32:31 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-10-30 08:32:31 +0000 |
commit | db5bd2b2de4733b3c900468edf4eb35896e4f723 (patch) | |
tree | d6f86917faf3374f1a878f2566857b57b19852d8 /app/models/user_preference.rb | |
parent | f7782c46480f8d5ab995c988ea265d12eb7ad0a9 (diff) | |
download | redmine-db5bd2b2de4733b3c900468edf4eb35896e4f723.tar.gz redmine-db5bd2b2de4733b3c900468edf4eb35896e4f723.zip |
My page - Spent time: configurable number of days to display (#8761).
git-svn-id: http://svn.redmine.org/redmine/trunk@15942 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/user_preference.rb')
-rw-r--r-- | app/models/user_preference.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb index f492ac139..26f8e4ea2 100644 --- a/app/models/user_preference.rb +++ b/app/models/user_preference.rb @@ -91,6 +91,19 @@ class UserPreference < ActiveRecord::Base self[:my_page_layout] = arg end + def my_page_settings(block=nil) + s = self[:my_page_settings] ||= {} + if block + s[block] ||= {} + else + s + end + end + + def my_page_settings=(arg) + self[:my_page_settings] = arg + end + def remove_block(block) block = block.to_s.underscore %w(top left right).each do |f| @@ -108,4 +121,9 @@ class UserPreference < ActiveRecord::Base my_page_layout['top'] ||= [] my_page_layout['top'].unshift(block) end + + def update_block_settings(block, settings) + block_settings = my_page_settings(block).merge(settings.symbolize_keys) + my_page_settings[block] = block_settings + end end |