From 55a2c54ab682036d292f6d6e442943ea4df60521 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 7 Apr 2015 12:11:16 -0400 Subject: [PATCH] Better keyboard handling and show score on results --- static/css/directives/ui/header-bar.css | 10 +++++++--- static/directives/header-bar.html | 1 + static/js/directives/ui/header-bar.js | 5 +++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/static/css/directives/ui/header-bar.css b/static/css/directives/ui/header-bar.css index 1c5a14249..70c339f50 100644 --- a/static/css/directives/ui/header-bar.css +++ b/static/css/directives/ui/header-bar.css @@ -156,9 +156,13 @@ nav.navbar-default .navbar-nav>li>a.active { vertical-align: middle; } -.header-bar-element .search-results li a { - color: black; - text-decoration: none !important; +.header-bar-element .search-results li .score:before { + content: "Score: "; +} + +.header-bar-element .search-results li .score { + float: right; + color: #ccc; } .header-bar-element .search-results li .result-name { diff --git a/static/directives/header-bar.html b/static/directives/header-bar.html index fd40aee34..9066d8114 100644 --- a/static/directives/header-bar.html +++ b/static/directives/header-bar.html @@ -101,6 +101,7 @@ ng-class="searchResultState.current == $index ? 'current' : ''" ng-click="showResult(result)"> {{ result.kind }} + {{ result.score }} diff --git a/static/js/directives/ui/header-bar.js b/static/js/directives/ui/header-bar.js index a1d2cc97a..8c7373e22 100644 --- a/static/js/directives/ui/header-bar.js +++ b/static/js/directives/ui/header-bar.js @@ -91,6 +91,11 @@ angular.module('quay').directive('headerBar', function () { }; $scope.handleSearchKeyDown = function(e) { + if (e.keyCode == 27) { + $scope.toggleSearch(); + return; + } + if (!$scope.searchResultState) { return; } if (e.keyCode == 40) {