2016-01-16 23:26:29 +01:00
|
|
|
import coreModule from '../../core_module';
|
2017-09-22 08:42:07 +02:00
|
|
|
import {NavModel} from '../../nav_model_srv';
|
2017-12-19 15:28:58 +01:00
|
|
|
import appEvents from 'app/core/app_events';
|
2016-01-16 23:26:29 +01:00
|
|
|
|
|
|
|
|
export class NavbarCtrl {
|
2017-06-02 14:00:42 +02:00
|
|
|
model: NavModel;
|
|
|
|
|
|
2016-01-16 23:26:29 +01:00
|
|
|
/** @ngInject */
|
2017-12-19 15:28:58 +01:00
|
|
|
constructor() {}
|
2017-06-02 14:00:42 +02:00
|
|
|
|
|
|
|
|
showSearch() {
|
2017-12-19 15:28:58 +01:00
|
|
|
appEvents.emit('show-dash-search');
|
2017-06-02 14:00:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
navItemClicked(navItem, evt) {
|
|
|
|
|
if (navItem.clickHandler) {
|
|
|
|
|
navItem.clickHandler();
|
|
|
|
|
evt.preventDefault();
|
|
|
|
|
}
|
2016-01-16 23:26:29 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function navbarDirective() {
|
|
|
|
|
return {
|
|
|
|
|
restrict: 'E',
|
2016-02-01 18:19:02 +01:00
|
|
|
templateUrl: 'public/app/core/components/navbar/navbar.html',
|
2016-01-16 23:26:29 +01:00
|
|
|
controller: NavbarCtrl,
|
|
|
|
|
bindToController: true,
|
2016-02-13 14:32:20 +01:00
|
|
|
controllerAs: 'ctrl',
|
2016-01-16 23:26:29 +01:00
|
|
|
scope: {
|
2017-06-02 14:00:42 +02:00
|
|
|
model: "=",
|
2016-01-16 23:26:29 +01:00
|
|
|
},
|
2017-06-02 14:00:42 +02:00
|
|
|
link: function(scope, elem) {
|
2016-01-16 23:26:29 +01:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-15 20:53:31 +02:00
|
|
|
export function pageH1() {
|
|
|
|
|
return {
|
|
|
|
|
restrict: 'E',
|
|
|
|
|
template: `
|
2017-11-30 08:18:23 +01:00
|
|
|
<h1 class="page-header__title">
|
2017-11-30 11:31:38 +01:00
|
|
|
<i class="page-header__icon {{::model.header.icon}}" ng-if="::model.header.icon"></i>
|
|
|
|
|
<img class="page-header__img" ng-src="{{::model.header.img}}" ng-if="::model.header.img"></i>
|
|
|
|
|
{{model.header.text}}
|
2017-08-15 20:53:31 +02:00
|
|
|
</h1>
|
|
|
|
|
`,
|
|
|
|
|
scope: {
|
|
|
|
|
model: "=",
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
coreModule.directive('pageH1', pageH1);
|
2016-01-16 23:26:29 +01:00
|
|
|
coreModule.directive('navbar', navbarDirective);
|