##// END OF EJS Templates
Gemfile: pin nokogiri version 1.6...
Gemfile: pin nokogiri version 1.6 nokogiri 1.7.0.1 requires Ruby version >= 2.1.0. git-svn-id: http://svn.redmine.org/redmine/trunk@16167 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r15601:124a459d5585
r15785:72f59192525b
Show More
my_controller.rb
186 lines | 5.1 KiB | text/x-ruby | RubyLexer
Jean-Philippe Lang
Allow My Page blocks to be added to from a plugin (#2840)....
r2465 # Redmine - project management software
Jean-Philippe Lang
Updates copyright for 2016....
r14856 # Copyright (C) 2006-2016 Jean-Philippe Lang
Jean-Philippe Lang
- new controller "myController"...
r60 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/my_controller.rb....
r6680 #
Jean-Philippe Lang
- new controller "myController"...
r60 # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/my_controller.rb....
r6680 #
Jean-Philippe Lang
- new controller "myController"...
r60 # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class MyController < ApplicationController
Jean-Philippe Lang
Use the main menu for project related actions that support cross-project display....
r15601 self.main_menu = false
Jean-Philippe Lang
Use .before_action instead of .before_filter....
r15273 before_action :require_login
Toshi MARUYAMA
gender neutral source comment at app/controllers/my_controller.rb...
r11858 # let user change user's password when user has to
Jean-Philippe Lang
Use .skip_before_action instead of .skip_before_filter....
r15274 skip_before_action :check_password_change, :only => :password
Jean-Philippe Lang
- new controller "myController"...
r60
Jean-Philippe Lang
Require password re-entry for sensitive actions (#19851)....
r13951 require_sudo_mode :account, only: :post
require_sudo_mode :reset_rss_key, :reset_api_key, :show_api_key, :destroy
Jean-Philippe Lang
Moves @layout 'base'@ to ApplicationController....
r1726 helper :issues
Jean-Philippe Lang
Code cleanup....
r4383 helper :users
Jean-Philippe Lang
User custom fields can now be set as editable so that users can edit them on 'My account'....
r2274 helper :custom_fields
Jean-Philippe Lang
Moves @layout 'base'@ to ApplicationController....
r1726
Jean-Philippe Lang
- new controller "myController"...
r60 def index
page
render :action => 'page'
end
# Show user's page
def page
Jean-Philippe Lang
Anonymous users can now be allowed to create, edit, comment issues, comment news and post messages in the forums....
r906 @user = User.current
Jean-Philippe Lang
Moves blocks definition to Redmine::MyPage....
r15548 @blocks = @user.pref.my_page_layout
Jean-Philippe Lang
- new controller "myController"...
r60 end
# Edit user's account
def account
Jean-Philippe Lang
More flexible mail notifications settings at user level. A user has now 3 options:...
r842 @user = User.current
Jean-Philippe Lang
"hide my email address" preference added, so that it's not displayed on account/show...
r61 @pref = @user.pref
Jean-Philippe Lang
More flexible mail notifications settings at user level. A user has now 3 options:...
r842 if request.post?
Jean-Philippe Lang
Use safe_attributes for user preferences....
r15306 @user.safe_attributes = params[:user]
@user.pref.safe_attributes = params[:pref]
Jean-Philippe Lang
More flexible mail notifications settings at user level. A user has now 3 options:...
r842 if @user.save
@user.pref.save
set_language_if_valid @user.language
flash[:notice] = l(:notice_account_updated)
Jean-Philippe Lang
Use named routes in controllers....
r10754 redirect_to my_account_path
Jean-Philippe Lang
More flexible mail notifications settings at user level. A user has now 3 options:...
r842 return
end
Jean-Philippe Lang
- new controller "myController"...
r60 end
end
Jean-Philippe Lang
Adds the ability for users to delete their own account (#10664). Can be disabled in application settings....
r9283 # Destroys user's account
def destroy
@user = User.current
unless @user.own_account_deletable?
Jean-Philippe Lang
Use named routes in controllers....
r10754 redirect_to my_account_path
Jean-Philippe Lang
Adds the ability for users to delete their own account (#10664). Can be disabled in application settings....
r9283 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
Jean-Philippe Lang
More flexible mail notifications settings at user level. A user has now 3 options:...
r842 # Manage user's password
def password
Jean-Philippe Lang
Anonymous users can now be allowed to create, edit, comment issues, comment news and post messages in the forums....
r906 @user = User.current
Eric Davis
Allow AuthSources to control if they allow password changes....
r3631 unless @user.change_password_allowed?
Jean-Philippe Lang
Removes "xxx and return" calls (#4446)....
r3071 flash[:error] = l(:notice_can_t_change_password)
Jean-Philippe Lang
Use named routes in controllers....
r10754 redirect_to my_account_path
Jean-Philippe Lang
Removes "xxx and return" calls (#4446)....
r3071 return
end
Jean-Philippe Lang
More flexible mail notifications settings at user level. A user has now 3 options:...
r842 if request.post?
Jean-Philippe Lang
Option to force a user to change his password (#3872)....
r11851 if !@user.check_password?(params[:password])
flash.now[:error] = l(:notice_account_wrong_password)
elsif params[:password] == params[:new_password]
Jean-Philippe Lang
Removed hardcoded string (#3872)....
r11853 flash.now[:error] = l(:notice_new_password_must_be_different)
Jean-Philippe Lang
Option to force a user to change his password (#3872)....
r11851 else
Jean-Philippe Lang
More flexible mail notifications settings at user level. A user has now 3 options:...
r842 @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
Jean-Philippe Lang
Option to force a user to change his password (#3872)....
r11851 @user.must_change_passwd = false
Jean-Philippe Lang
More flexible mail notifications settings at user level. A user has now 3 options:...
r842 if @user.save
Jean-Philippe Lang
Keep track of valid user sessions (#21058)....
r14353 # The session token was destroyed by the password change, generate a new one
session[:tk] = @user.generate_session_token
Jean-Philippe Lang
Let the mailer set the email content (#21421)....
r14885 Mailer.password_updated(@user)
Jean-Philippe Lang
More flexible mail notifications settings at user level. A user has now 3 options:...
r842 flash[:notice] = l(:notice_account_password_updated)
Jean-Philippe Lang
Use named routes in controllers....
r10754 redirect_to my_account_path
Jean-Philippe Lang
More flexible mail notifications settings at user level. A user has now 3 options:...
r842 end
Jean-Philippe Lang
- new controller "myController"...
r60 end
end
Jean-Philippe Lang
Added the ability to reset its own RSS access key on "My account"....
r666 end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/my_controller.rb....
r6680
Jean-Philippe Lang
Added the ability to reset its own RSS access key on "My account"....
r666 # Create a new feeds key
def reset_rss_key
Eric Davis
Make sure the RSS token is getting destroyed and created....
r3096 if request.post?
if User.current.rss_token
User.current.rss_token.destroy
User.current.reload
end
User.current.rss_key
Jean-Philippe Lang
Added the ability to reset its own RSS access key on "My account"....
r666 flash[:notice] = l(:notice_feeds_access_key_reseted)
end
Jean-Philippe Lang
Use named routes in controllers....
r10754 redirect_to my_account_path
Jean-Philippe Lang
- new controller "myController"...
r60 end
Jean-Philippe Lang
Require password re-entry for sensitive actions (#19851)....
r13951 def show_api_key
@user = User.current
end
Eric Davis
Added an API token for each User to use when making API requests. (#3920)...
r3103 # Create a new API key
def reset_api_key
if request.post?
if User.current.api_token
User.current.api_token.destroy
User.current.reload
end
User.current.api_key
flash[:notice] = l(:notice_api_access_key_reseted)
end
Jean-Philippe Lang
Use named routes in controllers....
r10754 redirect_to my_account_path
Eric Davis
Added an API token for each User to use when making API requests. (#3920)...
r3103 end
Jean-Philippe Lang
My page - Spent time: configurable number of days to display (#8761)....
r15560 def update_page
@user = User.current
block_settings = params[:settings] || {}
block_settings.each do |block, settings|
@user.pref.update_block_settings(block, settings)
end
@user.pref.save
@updated_blocks = block_settings.keys
end
Jean-Philippe Lang
- new controller "myController"...
r60 # User's page layout configuration
def page_layout
Jean-Philippe Lang
Anonymous users can now be allowed to create, edit, comment issues, comment news and post messages in the forums....
r906 @user = User.current
Jean-Philippe Lang
Moves blocks definition to Redmine::MyPage....
r15548 @blocks = @user.pref.my_page_layout
Jean-Philippe Lang
- new controller "myController"...
r60 end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/my_controller.rb....
r6680
Jean-Philippe Lang
- new controller "myController"...
r60 # Add a block to user's page
# The block is added on top of the page
# params[:block] : id of the block to add
def add_block
Jean-Philippe Lang
Adds #add_block and #remove_block methods....
r15550 @user = User.current
@user.pref.add_block params[:block]
@user.pref.save
Jean-Philippe Lang
Use named routes in controllers....
r10754 redirect_to my_page_layout_path
Jean-Philippe Lang
- new controller "myController"...
r60 end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/my_controller.rb....
r6680
Jean-Philippe Lang
- new controller "myController"...
r60 # Remove a block to user's page
# params[:block] : id of the block to remove
def remove_block
Jean-Philippe Lang
Fixes block reordering on my page (#2971)....
r3080 @user = User.current
Jean-Philippe Lang
Adds #add_block and #remove_block methods....
r15550 @user.pref.remove_block params[:block]
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/my_controller.rb....
r6680 @user.pref.save
Jean-Philippe Lang
Use named routes in controllers....
r10754 redirect_to my_page_layout_path
Jean-Philippe Lang
- new controller "myController"...
r60 end
# Change blocks order on user's page
# params[:group] : group to order (top, left or right)
Jean-Philippe Lang
Adds #add_block and #remove_block methods....
r15550 # params[:blocks] : array of block ids of the group
Jean-Philippe Lang
- new controller "myController"...
r60 def order_blocks
group = params[:group]
Jean-Philippe Lang
Fixes block reordering on my page (#2971)....
r3080 @user = User.current
Jean-Philippe Lang
Fixes that "My Page" personalization was not storing reordered blocks (#2971)....
r2545 if group.is_a?(String)
Jean-Philippe Lang
JQuery in, Prototype/Scriptaculous out (#11445)....
r9885 group_items = (params["blocks"] || []).collect(&:underscore)
group_items.each {|s| s.sub!(/^block_/, '')}
Jean-Philippe Lang
Adds #add_block and #remove_block methods....
r15550 # 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
Jean-Philippe Lang
- new controller "myController"...
r60 end
Jean-Philippe Lang
Use head instead of render :nothing => true....
r15305 head 200
Jean-Philippe Lang
- new controller "myController"...
r60 end
end