summaryrefslogtreecommitdiffstats
path: root/app/controllers/my_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-04-04 17:17:47 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-04-04 17:17:47 +0000
commit88a3a351d08b5446317c1813cf2b966aa5f716fb (patch)
tree169a31dda9d70770d0c63337e93c6f1b27617851 /app/controllers/my_controller.rb
parentb9ee00a8c8ba2fe2b32eb33d299d4764ebc2968b (diff)
downloadredmine-88a3a351d08b5446317c1813cf2b966aa5f716fb.tar.gz
redmine-88a3a351d08b5446317c1813cf2b966aa5f716fb.zip
Don't hardcode the groups on My page.
git-svn-id: http://svn.redmine.org/redmine/trunk@16475 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/my_controller.rb')
-rw-r--r--app/controllers/my_controller.rb11
1 files changed, 3 insertions, 8 deletions
diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb
index f0b56e44f..15fc9e388 100644
--- a/app/controllers/my_controller.rb
+++ b/app/controllers/my_controller.rb
@@ -37,6 +37,7 @@ class MyController < ApplicationController
# Show user's page
def page
@user = User.current
+ @groups = @user.pref.my_page_groups
@blocks = @user.pref.my_page_layout
end
@@ -178,14 +179,8 @@ class MyController < ApplicationController
# params[:blocks] : array of block ids of the group
def order_blocks
@user = User.current
- group = params[:group].to_s
- if %w(top left right).include? group
- group_items = (params[:blocks] || []).collect(&:underscore)
- # remove group blocks if they are presents in other groups
- group_items.each {|s| @user.pref.remove_block(s)}
- @user.pref.my_page_layout[group] = group_items
- @user.pref.save
- end
+ @user.pref.order_blocks params[:group], params[:blocks]
+ @user.pref.save
head 200
end
end