Mercurial > hg > soundsoftware-site
diff app/controllers/my_controller.rb @ 1115:433d4f72a19b redmine-2.2
Update to Redmine SVN revision 11137 on 2.2-stable branch
author | Chris Cannam |
---|---|
date | Mon, 07 Jan 2013 12:01:42 +0000 |
parents | cbb26bc654de |
children | bb32da3bea34 3e4c3460b6ca |
line wrap: on
line diff
--- a/app/controllers/my_controller.rb Wed Jun 27 14:54:18 2012 +0100 +++ b/app/controllers/my_controller.rb Mon Jan 07 12:01:42 2013 +0000 @@ -1,5 +1,5 @@ # Redmine - project management software -# Copyright (C) 2006-2011 Jean-Philippe Lang +# Copyright (C) 2006-2012 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -35,9 +35,6 @@ 'right' => ['issuesreportedbyme'] }.freeze - verify :xhr => true, - :only => [:add_block, :remove_block, :order_blocks] - def index page render :action => 'page' @@ -68,6 +65,24 @@ end end + # Destroys user's account + def destroy + @user = User.current + unless @user.own_account_deletable? + redirect_to :action => 'account' + return + end + + if request.post? && params[:confirm] + @user.destroy + if @user.destroyed? + logout_user + flash[:notice] = l(:notice_account_deleted) + end + redirect_to home_path + end + end + # Manage user's password def password @user = User.current @@ -120,7 +135,11 @@ @user = User.current @blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT.dup @block_options = [] - BLOCKS.each {|k, v| @block_options << [l("my.blocks.#{v}", :default => [v, v.to_s.humanize]), k.dasherize]} + BLOCKS.each do |k, v| + unless %w(top left right).detect {|f| (@blocks[f] ||= []).include?(k)} + @block_options << [l("my.blocks.#{v}", :default => [v, v.to_s.humanize]), k.dasherize] + end + end end # Add a block to user's page @@ -137,7 +156,7 @@ layout['top'].unshift block @user.pref[:my_page_layout] = layout @user.pref.save - render :partial => "block", :locals => {:user => @user, :block_name => block} + redirect_to :action => 'page_layout' end # Remove a block to user's page @@ -150,7 +169,7 @@ %w(top left right).each {|f| (layout[f] ||= []).delete block } @user.pref[:my_page_layout] = layout @user.pref.save - render :nothing => true + redirect_to :action => 'page_layout' end # Change blocks order on user's page @@ -160,7 +179,8 @@ group = params[:group] @user = User.current if group.is_a?(String) - group_items = (params["list-#{group}"] || []).collect(&:underscore) + group_items = (params["blocks"] || []).collect(&:underscore) + group_items.each {|s| s.sub!(/^block_/, '')} if group_items and group_items.is_a? Array layout = @user.pref[:my_page_layout] || {} # remove group blocks if they are presents in other groups