Show exact matches for the URL at the top of the matching sites list (#108)

This commit is contained in:
Mark Hammond 2017-03-30 11:26:03 +11:00 committed by Kyle Spearrin
parent 0db94629be
commit 4676f045af
2 changed files with 6 additions and 1 deletions

View File

@ -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);

View File

@ -10,7 +10,7 @@
<div class="list-grouped">
<a href="javascript:void(0)" ng-click="fillLogin(login)" class="list-grouped-item condensed"
title="{{i18n.autoFill}} {{login.name}}"
ng-repeat="login in theLogins = (logins | orderBy: ['name', 'username']) track by $index">
ng-repeat="login in theLogins = (logins | orderBy: [sortUriMatch, 'name', 'username']) track by $index">
<span class="btn-list" href="" ng-click="$event.stopPropagation()" title="{{i18n.copyPassword}}"
ngclipboard ngclipboard-error="clipboardError(e)"
ngclipboard-success="clipboardSuccess(e, i18n.password)"