diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index 3d2f9c1fa..e3387e400 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -39,7 +39,8 @@ class SettingsController < ApplicationController redirect_to :action => 'edit', :tab => params[:tab] else @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 @guessed_host_and_path = request.host_with_port.dup diff --git a/app/models/user.rb b/app/models/user.rb index 73c8d6c5d..bd1488fa0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -28,11 +28,31 @@ class User < Principal # Different ways of displaying/sorting users USER_FORMATS = { - :firstname_lastname => {:string => '#{firstname} #{lastname}', :order => %w(firstname lastname id)}, - :firstname => {:string => '#{firstname}', :order => %w(firstname id)}, - :lastname_firstname => {:string => '#{lastname} #{firstname}', :order => %w(lastname firstname id)}, - :lastname_coma_firstname => {:string => '#{lastname}, #{firstname}', :order => %w(lastname firstname id)}, - :username => {:string => '#{login}', :order => %w(login id)}, + :firstname_lastname => { + :string => '#{firstname} #{lastname}', + :order => %w(firstname lastname id), + :setting_order => 1 + }, + :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 = [