diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-03-16 18:02:43 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-03-16 18:02:43 +0000 |
commit | 4cfd5133733a08ebf5ba89aa3994e4a86679c809 (patch) | |
tree | 562cc4d5d11453a058134de4aa95c2c9f121ebf5 /app/models | |
parent | 1a180a67be5c205653e5d006fd027c0cafb3b597 (diff) | |
download | redmine-4cfd5133733a08ebf5ba89aa3994e4a86679c809.tar.gz redmine-4cfd5133733a08ebf5ba89aa3994e4a86679c809.zip |
Allow multiple instances of custom queries on My page (#1565).
git-svn-id: http://svn.redmine.org/redmine/trunk@16413 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/user_preference.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb index e0b17631c..836ad3978 100644 --- a/app/models/user_preference.rb +++ b/app/models/user_preference.rb @@ -109,6 +109,7 @@ class UserPreference < ActiveRecord::Base self[:my_page_settings] = arg end + # Removes block from the user page layout def remove_block(block) block = block.to_s.underscore %w(top left right).each do |f| @@ -117,9 +118,12 @@ class UserPreference < ActiveRecord::Base my_page_layout end + # Adds block to the user page layout + # Returns nil if block is not valid or if it's already + # present in the user page layout def add_block(block) block = block.to_s.underscore - return unless Redmine::MyPage.blocks.key?(block) + return unless Redmine::MyPage.valid_block?(block, my_page_layout.values.flatten) remove_block(block) # add it on top |