pin user format order at setting panel (#10937)

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10542 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2012-10-01 07:07:49 +00:00
parent 5f794b5af5
commit de0e0f09a3
2 changed files with 27 additions and 6 deletions

View File

@ -39,7 +39,8 @@ class SettingsController < ApplicationController
redirect_to :action => 'edit', :tab => params[:tab] redirect_to :action => 'edit', :tab => params[:tab]
else else
@options = {} @options = {}
@options[:user_format] = User::USER_FORMATS.keys.collect {|f| [User.current.name(f), f.to_s] } user_format = User::USER_FORMATS.collect{|key, value| [key, value[:setting_order]]}.sort{|a, b| a[1] <=> b[1]}
@options[:user_format] = user_format.collect{|v| v[0]}.collect{|f| [User.current.name(f), f.to_s]}
@deliveries = ActionMailer::Base.perform_deliveries @deliveries = ActionMailer::Base.perform_deliveries
@guessed_host_and_path = request.host_with_port.dup @guessed_host_and_path = request.host_with_port.dup

View File

@ -28,11 +28,31 @@ class User < Principal
# Different ways of displaying/sorting users # Different ways of displaying/sorting users
USER_FORMATS = { USER_FORMATS = {
:firstname_lastname => {:string => '#{firstname} #{lastname}', :order => %w(firstname lastname id)}, :firstname_lastname => {
:firstname => {:string => '#{firstname}', :order => %w(firstname id)}, :string => '#{firstname} #{lastname}',
:lastname_firstname => {:string => '#{lastname} #{firstname}', :order => %w(lastname firstname id)}, :order => %w(firstname lastname id),
:lastname_coma_firstname => {:string => '#{lastname}, #{firstname}', :order => %w(lastname firstname id)}, :setting_order => 1
:username => {:string => '#{login}', :order => %w(login id)}, },
:firstname => {
:string => '#{firstname}',
:order => %w(firstname id),
:setting_order => 2
},
:lastname_firstname => {
:string => '#{lastname} #{firstname}',
:order => %w(lastname firstname id),
:setting_order => 3
},
:lastname_coma_firstname => {
:string => '#{lastname}, #{firstname}',
:order => %w(lastname firstname id),
:setting_order => 4
},
:username => {
:string => '#{login}',
:order => %w(login id),
:setting_order => 5
},
} }
MAIL_NOTIFICATION_OPTIONS = [ MAIL_NOTIFICATION_OPTIONS = [