From 4676f045af2900794c0581b9cebf6b9992c252bd Mon Sep 17 00:00:00 2001 From: Mark Hammond Date: Thu, 30 Mar 2017 11:26:03 +1100 Subject: [PATCH] Show exact matches for the URL at the top of the matching sites list (#108) --- src/popup/app/current/currentController.js | 5 +++++ src/popup/app/current/views/current.html | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/popup/app/current/currentController.js b/src/popup/app/current/currentController.js index e8c09119a4..9d28d5c8a7 100644 --- a/src/popup/app/current/currentController.js +++ b/src/popup/app/current/currentController.js @@ -106,6 +106,11 @@ angular }); }; + $scope.sortUriMatch = function(login) { + // exact matches should sort earlier. + return url && url.startsWith(login.uri) ? 0 : 1; + } + $scope.$on('syncCompleted', function (event, successfully) { if ($scope.loaded) { setTimeout(loadVault, 500); diff --git a/src/popup/app/current/views/current.html b/src/popup/app/current/views/current.html index 03730af8ff..da6bcb980b 100644 --- a/src/popup/app/current/views/current.html +++ b/src/popup/app/current/views/current.html @@ -10,7 +10,7 @@
+ ng-repeat="login in theLogins = (logins | orderBy: [sortUriMatch, 'name', 'username']) track by $index">