Code cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4497 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
9e2d401f43
commit
2066b2f666
|
@ -19,6 +19,7 @@ class MyController < ApplicationController
|
|||
before_filter :require_login
|
||||
|
||||
helper :issues
|
||||
helper :users
|
||||
helper :custom_fields
|
||||
|
||||
BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues,
|
||||
|
@ -65,7 +66,6 @@ class MyController < ApplicationController
|
|||
return
|
||||
end
|
||||
end
|
||||
@notification_options = @user.valid_notification_options
|
||||
end
|
||||
|
||||
# Manage user's password
|
||||
|
|
|
@ -85,16 +85,12 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def new
|
||||
@notification_options = User::MAIL_NOTIFICATION_OPTIONS
|
||||
|
||||
@user = User.new(:language => Setting.default_language, :mail_notification => Setting.default_notification_option)
|
||||
@auth_sources = AuthSource.find(:all)
|
||||
end
|
||||
|
||||
verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
|
||||
def create
|
||||
@notification_options = User::MAIL_NOTIFICATION_OPTIONS
|
||||
|
||||
@user = User.new(:language => Setting.default_language, :mail_notification => Setting.default_notification_option)
|
||||
@user.safe_attributes = params[:user]
|
||||
@user.admin = params[:user][:admin] || false
|
||||
|
@ -135,7 +131,6 @@ class UsersController < ApplicationController
|
|||
|
||||
def edit
|
||||
@user = User.find(params[:id])
|
||||
@notification_options = @user.valid_notification_options
|
||||
|
||||
@auth_sources = AuthSource.find(:all)
|
||||
@membership ||= Member.new
|
||||
|
@ -144,7 +139,6 @@ class UsersController < ApplicationController
|
|||
verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed }
|
||||
def update
|
||||
@user = User.find(params[:id])
|
||||
@notification_options = @user.valid_notification_options
|
||||
|
||||
@user.admin = params[:user][:admin] if params[:user][:admin]
|
||||
@user.login = params[:user][:login] if params[:user][:login]
|
||||
|
|
|
@ -33,6 +33,10 @@ module UsersHelper
|
|||
options
|
||||
end
|
||||
|
||||
def user_mail_notification_options(user)
|
||||
user.valid_notification_options.collect {|o| [l(o.last), o.first]}
|
||||
end
|
||||
|
||||
def change_status_link(user)
|
||||
url = {:controller => 'users', :action => 'update', :id => user, :page => params[:page], :status => params[:status], :tab => nil}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<p>
|
||||
<%= select_tag 'user[mail_notification]', options_for_select(@notification_options.collect {|o| [l(o.last), o.first]}, @user.mail_notification),
|
||||
<%= select_tag 'user[mail_notification]', options_for_select(user_mail_notification_options(@user), @user.mail_notification),
|
||||
:onchange => 'if (this.value == "selected") {Element.show("notified-projects")} else {Element.hide("notified-projects")}' %>
|
||||
</p>
|
||||
<% content_tag 'div', :id => 'notified-projects', :style => (@user.mail_notification == 'selected' ? '' : 'display:none;') do %>
|
||||
|
|
Loading…
Reference in New Issue