--- /dev/null
+<div class='card card-search'>
+ <div class='card-left text-center'>
+ <entity-tag mentity='mentity' />
+ </div>
+ <div class='card-body'>
+ <h5 class='card-heading'>
+ <entity-signature mentity='mentity'/>
+ <br>
+ <small><entity-namespace namespace='mentity.namespace' /></small>
+ </h5>
+ <span class='synopsis' ng-bind-html='mentity.mdoc.html_synopsis' />
+ </div>
+</div>
<form ng-controller='SearchCtrl as searchCtrl' >
<div class='form-group has-icon'>
<input placeholder='Search...' type='text' class='form-control search-input'
- ng-model-options='{ debounce: 150 }' ng-model='query'
+ ng-model-options='{ debounce: 300 }' ng-model='query'
ng-keydown='update($event)' ng-change='search()'>
<span class='glyphicon glyphicon-search form-control-icon text-muted'></span>
</div>
<div ng-if='results.length > 0' class='search-results'>
<div class='card-list'>
- <entity-card ng-click='reset()' ng-class='{active: activeItem == $index}' mentity='mentity' ng-repeat='mentity in results' />
+ <search-card ng-click='selectEnter()' ng-class='{active: activeItem == $index}' ng-mouseover='setActive($index)' mentity='mentity' ng-repeat='mentity in results' />
</div>
</div>
</form>
angular
.module('ui', [ 'model' ])
- .controller('SearchCtrl', ['Model', '$routeParams', '$scope', '$window', function(Model, $routeParams, $scope, $window) {
+ .controller('SearchCtrl', ['Model', '$routeParams', '$scope', '$location', function(Model, $routeParams, $scope, $location) {
$scope.query = '';
$scope.reset = function() {
}
}
- $scope.selectEnter = function() {
- $window.location.href = $scope.results[$scope.activeItem].web_url;
+ $scope.selectEnter = function(e) {
+ $location.url($scope.results[$scope.activeItem].web_url);
$scope.reset();
}
$scope.reset();
}
+ $scope.setActive = function(index) {
+ $scope.activeItem = index;
+ }
+
$scope.search = function() {
if(!$scope.query) {
$scope.reset();
$scope.reset();
}])
+ .directive('searchCard', function() {
+ return {
+ restrict: 'E',
+ scope: {
+ mentity: '='
+ },
+ replace: true,
+ templateUrl: '/directives/search/card.html'
+ };
+ })
+
.directive('uiFilters', function() {
return {
restrict: 'E',