[PATCH 19 of 19] autocomplete: consistently show 'username (Full Name)'

Thomas De Schampheleire patrickdepinguin at gmail.com
Tue Jun 30 16:43:29 EDT 2015


# HG changeset patch
# User Thomas De Schampheleire <thomas.de.schampheleire at gmail.com>
# Date 1435696257 -7200
#      Tue Jun 30 22:30:57 2015 +0200
# Node ID b0620802d61a9a7b9bf4442ad0204ee8f8f53725
# Parent  1b989931c539d2ef2160eb9d2b5734d9c711d5ca
autocomplete: consistently show 'username (Full Name)'

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
@@ -1177,8 +1177,7 @@ var autocompleteFormatter = function (oR
         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 autocompleteGravatar(grprefix + autocompleteHighlightMatch(grname, query, grnameMatchIndex) + grsuffix, null, null, true);
@@ -1195,7 +1194,7 @@ var autocompleteFormatter = function (oR
         var fnameMatchIndex = fname.toLowerCase().indexOf(query),
             lnameMatchIndex = lname.toLowerCase().indexOf(query),
             nnameMatchIndex = nname.toLowerCase().indexOf(query),
-            displayfname, displaylname, displaynname;
+            displayfname, displaylname, displaynname, displayname;
 
         if (fnameMatchIndex > -1) {
             displayfname = autocompleteHighlightMatch(fname, query, fnameMatchIndex);
@@ -1210,12 +1209,17 @@ var autocompleteFormatter = function (oR
         }
 
         if (nnameMatchIndex > -1) {
-            displaynname = "(" + autocompleteHighlightMatch(nname, query, nnameMatchIndex) + ")";
+            displaynname = autocompleteHighlightMatch(nname, query, nnameMatchIndex);
         } else {
-            displaynname = nname ? "(" + nname + ")" : "";
+            displaynname = nname;
         }
 
-        return autocompleteGravatar(displayfname + " " + displaylname + " " + displaynname, oResultData.gravatar_lnk, oResultData.gravatar_size);
+        displayname = displaynname;
+        if (displayfname && displaylname) {
+            displayname = "{0} {1} ({2})".format(displayfname, displaylname, displayname);
+        }
+
+        return autocompleteGravatar(displayname, oResultData.gravatar_lnk, oResultData.gravatar_size);
     } else {
         return '';
     }


More information about the kallithea-general mailing list