]> source.dussan.org Git - redmine.git/commitdiff
New user name format: firstname + first letter of lastname (#12085).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 30 Oct 2012 08:40:12 +0000 (08:40 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 30 Oct 2012 08:40:12 +0000 (08:40 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10770 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/user.rb
test/unit/user_test.rb

index 87db4eb5aaf1b735f3de67867716dd48e6894d82..6702b7e580586f3e34631d2667ca777a5580ce63 100644 (file)
@@ -33,30 +33,35 @@ class User < Principal
         :order => %w(firstname lastname id),
         :setting_order => 1
       },
+    :firstname_lastinitial => {
+        :string => '#{firstname} #{lastname.to_s.chars.first}.',
+        :order => %w(firstname lastname id),
+        :setting_order => 2
+      },
     :firstname => {
         :string => '#{firstname}',
         :order => %w(firstname id),
-        :setting_order => 2
+        :setting_order => 3
       },
     :lastname_firstname => {
         :string => '#{lastname} #{firstname}',
         :order => %w(lastname firstname id),
-        :setting_order => 3
+        :setting_order => 4
       },
     :lastname_coma_firstname => {
         :string => '#{lastname}, #{firstname}',
         :order => %w(lastname firstname id),
-        :setting_order => 4
+        :setting_order => 5
       },
     :lastname => {
         :string => '#{lastname}',
         :order => %w(lastname id),
-        :setting_order => 5
+        :setting_order => 6
       },
     :username => {
         :string => '#{login}',
         :order => %w(login id),
-        :setting_order => 6
+        :setting_order => 7
       },
   }
 
index 88b254171e6bd56dc7e9b06909ac2fe6b7015ff7..eff9a61ff5a07315163354a787b01b2f26ddf562 100644 (file)
@@ -410,6 +410,7 @@ class UserTest < ActiveSupport::TestCase
   end
 
   def test_name_format
+    assert_equal 'John S.', @jsmith.name(:firstname_lastinitial)
     assert_equal 'Smith, John', @jsmith.name(:lastname_coma_firstname)
     with_settings :user_format => :firstname_lastname do
       assert_equal 'John Smith', @jsmith.reload.name