Commit 00d3d49a authored by Robert Knight's avatar Robert Knight

Convert `<search-input>` to a component

parent 2cbf1969
...@@ -146,6 +146,7 @@ module.exports = angular.module('h', [ ...@@ -146,6 +146,7 @@ module.exports = angular.module('h', [
.component('loginControl', require('./directive/login-control')) .component('loginControl', require('./directive/login-control'))
.component('loginForm', require('./directive/login-form').component) .component('loginForm', require('./directive/login-form').component)
.component('publishAnnotationBtn', require('./directive/publish-annotation-btn')) .component('publishAnnotationBtn', require('./directive/publish-annotation-btn'))
.component('searchInput', require('./directive/search-input'))
.component('searchStatusBar', require('./directive/search-status-bar')) .component('searchStatusBar', require('./directive/search-status-bar'))
.component('sidebarTutorial', require('./directive/sidebar-tutorial').component) .component('sidebarTutorial', require('./directive/sidebar-tutorial').component)
.component('shareDialog', require('./directive/share-dialog')) .component('shareDialog', require('./directive/share-dialog'))
...@@ -159,7 +160,6 @@ module.exports = angular.module('h', [ ...@@ -159,7 +160,6 @@ module.exports = angular.module('h', [
.directive('hOnTouch', require('./directive/h-on-touch')) .directive('hOnTouch', require('./directive/h-on-touch'))
.directive('hTooltip', require('./directive/h-tooltip')) .directive('hTooltip', require('./directive/h-tooltip'))
.directive('markdown', require('./directive/markdown')) .directive('markdown', require('./directive/markdown'))
.directive('searchInput', require('./directive/search-input'))
.directive('selectionTabs', require('./directive/selection-tabs')) .directive('selectionTabs', require('./directive/selection-tabs'))
.directive('sortDropdown', require('./directive/sort-dropdown')) .directive('sortDropdown', require('./directive/sort-dropdown'))
.directive('spinner', require('./directive/spinner')) .directive('spinner', require('./directive/spinner'))
......
...@@ -32,22 +32,17 @@ function SearchInputController($element, $http, $scope) { ...@@ -32,22 +32,17 @@ function SearchInputController($element, $http, $scope) {
}; };
} }
// @ngInject module.exports = {
module.exports = function () { controller: SearchInputController,
return { controllerAs: 'vm',
bindToController: true, bindings: {
controller: SearchInputController, // Specifies whether the search input field should always be expanded,
controllerAs: 'vm', // regardless of whether the it is focused or has an active query.
restrict: 'E', //
scope: { // If false, it is only expanded when focused or when 'query' is non-empty
// Specifies whether the search input field should always be expanded, alwaysExpanded: '<',
// regardless of whether the it is focused or has an active query. query: '<',
// onSearch: '&',
// If false, it is only expanded when focused or when 'query' is non-empty },
alwaysExpanded: '<', template: require('../templates/search_input.html'),
query: '<',
onSearch: '&',
},
template: require('../templates/search_input.html'),
};
}; };
...@@ -9,7 +9,7 @@ describe('searchInput', function () { ...@@ -9,7 +9,7 @@ describe('searchInput', function () {
before(function () { before(function () {
angular.module('app', []) angular.module('app', [])
.directive('searchInput', require('../search-input')); .component('searchInput', require('../search-input'));
}); });
beforeEach(function () { beforeEach(function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment