2016-01-16 23:26:29 +01:00
|
|
|
///<reference path="../../../headers/common.d.ts" />
|
|
|
|
|
|
|
|
|
|
import config from 'app/core/config';
|
|
|
|
|
import _ from 'lodash';
|
|
|
|
|
import $ from 'jquery';
|
|
|
|
|
import coreModule from '../../core_module';
|
2017-06-02 14:00:42 +02:00
|
|
|
import {NavModel, NavModelItem} from '../../nav_model_srv';
|
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-06-02 14:00:42 +02:00
|
|
|
constructor(private $scope, private $rootScope, private contextSrv) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showSearch() {
|
|
|
|
|
this.$rootScope.appEvent('show-dash-search');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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: `
|
|
|
|
|
<h1>
|
2017-08-15 23:17:34 +02:00
|
|
|
<i class="{{::model.node.icon}}" ng-if="::model.node.icon"></i>
|
|
|
|
|
<img ng-src="{{::model.node.img}}" ng-if="::model.node.img"></i>
|
2017-08-19 11:09:11 +02:00
|
|
|
{{model.node.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);
|