mirror of
https://github.com/redmine/redmine.git
synced 2025-11-04 20:35:57 +01:00
Don't reload the page when adding/removing a block.
git-svn-id: http://svn.redmine.org/redmine/trunk@16394 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -147,18 +147,29 @@ class MyController < ApplicationController
|
||||
# params[:block] : id of the block to add
|
||||
def add_block
|
||||
@user = User.current
|
||||
@user.pref.add_block params[:block]
|
||||
@user.pref.save
|
||||
redirect_to my_page_path
|
||||
@block = params[:block]
|
||||
if @user.pref.add_block @block
|
||||
@user.pref.save
|
||||
respond_to do |format|
|
||||
format.html { redirect_to my_page_path }
|
||||
format.js
|
||||
end
|
||||
else
|
||||
render_error :status => 422
|
||||
end
|
||||
end
|
||||
|
||||
# Remove a block to user's page
|
||||
# params[:block] : id of the block to remove
|
||||
def remove_block
|
||||
@user = User.current
|
||||
@user.pref.remove_block params[:block]
|
||||
@block = params[:block]
|
||||
@user.pref.remove_block @block
|
||||
@user.pref.save
|
||||
redirect_to my_page_path
|
||||
respond_to do |format|
|
||||
format.html { redirect_to my_page_path }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# Change blocks order on user's page
|
||||
|
||||
Reference in New Issue
Block a user