# HG changeset patch
# User Mads Kiilerich <mad...@unity3d.com>
# Date 1435153690 -7200
#      Wed Jun 24 15:48:10 2015 +0200
# Node ID 03befc961f641bfef6a5892f97ba1242dd2c7d88
# Parent  2619c73a230323c2b936a481732d9a63e191278d
user: show 'Firstname Lastname (username)' and use string formatting instead of 
appending strings

diff --git a/kallithea/model/db.py b/kallithea/model/db.py
--- a/kallithea/model/db.py
+++ b/kallithea/model/db.py
@@ -488,10 +488,10 @@ class User(Base, BaseModel):
     @property
     def full_name_and_username(self):
         """
-        Show full name and username.
+        Show full name and username as 'Firstname Lastname (username)'.
         If full name is not set, fall back to username only.
         """
-        return (('%s (%s %s)' % (self.username, self.firstname, self.lastname))
+        return (('%s %s (%s)' % (self.firstname, self.lastname, self.username))
                 if self.firstname and self.lastname else
                 self.username)
 
diff --git a/kallithea/public/js/base.js b/kallithea/public/js/base.js
--- a/kallithea/public/js/base.js
+++ b/kallithea/public/js/base.js
@@ -1208,8 +1208,7 @@ var _MembersAutoComplete = function (div
                 var grmembers = oResultData.grmembers;
                 var grnameMatchIndex = grname.toLowerCase().indexOf(query);
                 var grprefix = "{0}: ".format(_TM['Group']);
-                var grsuffix = " (" + grmembers + "  )";
-                var grsuffix = " ({0}  {1})".format(grmembers, _TM['members']);
+                var grsuffix = " ({0} {1})".format(grmembers, _TM['members']);
 
                 if (grnameMatchIndex > -1) {
                     return _gravatar(grprefix + highlightMatch(grname, query, 
grnameMatchIndex) + grsuffix,null,null,true);
@@ -1247,7 +1246,7 @@ var _MembersAutoComplete = function (div
 
                 displayname = displaynname;
                 if (displayfname && displaylname) {
-                    displayname += " (" + displayfname + " " + displaylname + 
")";
+                    displayname = "{0} {1} ({2})".format(displayfname, 
displaylname, displayname);
                 }
 
                 return _gravatar(displayname, oResultData.gravatar_lnk, 
oResultData.gravatar_size);
@@ -1396,7 +1395,7 @@ var MentionsAutoComplete = function (div
 
                 displayname = displaynname;
                 if (displayfname && displaylname) {
-                    displayname += " (" + displayfname + " " + displaylname + 
")";
+                    displayname = "{0} {1} ({2})".format(displayfname, 
displaylname, displayname);
                 }
 
                 return _gravatar(displayname, oResultData.gravatar_lnk, 
oResultData.gravatar_size);
@@ -1481,7 +1480,7 @@ var MentionsAutoComplete = function (div
 var addReviewMember = 
function(id,fname,lname,nname,gravatar_link,gravatar_size){
     var displayname = nname;
     if ((fname != "") && (lname != "")) {
-        displayname += " ({0} {1})".format(fname, lname);
+        displayname = "{0} {1} ({2})".format(fname, lname, displayname);
     }
     var gravatarelm = '<img alt="gravatar" style="width: {0}px; height: {0}px" 
src="{1}"/>'.format(gravatar_size, gravatar_link);
     if (!gravatar_link)
@@ -1644,7 +1643,7 @@ var PullRequestAutoComplete = function (
 
                 displayname = displaynname;
                 if (displayfname && displaylname) {
-                    displayname += " (" + displayfname + " " + displaylname + 
")";
+                    displayname = "{0} {1} ({2})".format(displayfname, 
displaylname, displayname);
                 }
 
                 return _gravatar(displayname, oResultData.gravatar_lnk, 
oResultData.gravatar_size);
_______________________________________________
kallithea-general mailing list
kallithea-general@sfconservancy.org
http://lists.sfconservancy.org/mailman/listinfo/kallithea-general

Reply via email to