mirror of https://github.com/grafana/grafana
refactor(): began refactoring topnav directive to be more like the new style of components, and also make it usable on all pages including dashboard
parent
0a58404584
commit
070af40487
@ -0,0 +1,27 @@ |
||||
<div class="navbar navbar-static-top"> |
||||
<div class="navbar-inner"><div class="container-fluid"> |
||||
<div class="top-nav"> |
||||
<div class="top-nav-btn top-nav-menu-btn"> |
||||
<a class="pointer" ng-click="ctrl.contextSrv.toggleSideMenu()"> |
||||
<span class="top-nav-logo-background"> |
||||
<img class="logo-icon" src="img/fav32.png"></img> |
||||
</span> |
||||
<i class="fa fa-caret-down"></i> |
||||
</a> |
||||
</div> |
||||
|
||||
<span class="icon-circle top-nav-icon"> |
||||
<i ng-class="icon"></i> |
||||
</span> |
||||
|
||||
<a ng-href="{{titleUrl}}" class="top-nav-title"> |
||||
{{ctrl.title}} |
||||
</a> |
||||
<i ng-show="subnav" class="top-nav-breadcrumb-icon fa fa-angle-right"></i> |
||||
</div> |
||||
|
||||
<div ng-transclude></div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
@ -0,0 +1,36 @@ |
||||
///<reference path="../../../headers/common.d.ts" />
|
||||
|
||||
import config from 'app/core/config'; |
||||
import _ from 'lodash'; |
||||
import $ from 'jquery'; |
||||
import coreModule from '../../core_module'; |
||||
|
||||
export class NavbarCtrl { |
||||
contextSrv: any; |
||||
|
||||
/** @ngInject */ |
||||
constructor(private $scope, contextSrv) { |
||||
this.contextSrv = contextSrv; |
||||
} |
||||
} |
||||
|
||||
export function navbarDirective() { |
||||
return { |
||||
restrict: 'E', |
||||
templateUrl: 'app/core/components/navbar/navbar.html', |
||||
controller: NavbarCtrl, |
||||
bindToController: true, |
||||
controllerAs: 'ctrl', |
||||
transclude: true, |
||||
scope: { |
||||
title: "@", |
||||
titleUrl: "@", |
||||
}, |
||||
link: function(scope, elem, attrs) { |
||||
scope.icon = attrs.icon; |
||||
scope.subnav = attrs.subnav; |
||||
} |
||||
}; |
||||
} |
||||
|
||||
coreModule.directive('navbar', navbarDirective); |
||||
Loading…
Reference in new issue