]> git.mxchange.org Git - friendica.git/commitdiff
Add meaningful sorter to ACL autocomplete
authorHypolite Petovan <hypolite@mrpetovan.com>
Mon, 16 Dec 2019 08:13:32 +0000 (03:13 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 16 Dec 2019 08:13:32 +0000 (03:13 -0500)
view/templates/acl_selector.tpl

index a5929900b3bece5e24227f0a282d10676f441694..a9da4f6118d4c6bfbc3ed12771a354b14d569c6a 100644 (file)
                        identify: function(obj) { return obj.type + '-' + obj.id.toString(); },
                        datumTokenizer: Bloodhound.tokenizers.obj.whitespace(['name', 'addr']),
                        queryTokenizer: Bloodhound.tokenizers.whitespace,
+                       sorter: function (itemA, itemB) {
+                               if (itemA.name === itemB.name) {
+                                       return 0;
+                               } else if (itemA.name > itemB.name) {
+                                       return 1;
+                               } else {
+                                       return -1;
+                               }
+                       },
                });
                acl.initialize();