mirror of
https://github.com/goharbor/harbor.git
synced 2024-10-09 02:38:34 +02:00
38 lines
897 B
JavaScript
38 lines
897 B
JavaScript
(function() {
|
|
|
|
'use strict';
|
|
|
|
angular
|
|
.module('harbor.optional.menu')
|
|
.directive('optionalMenu', optionalMenu);
|
|
|
|
OptionalMenuController.$inject = ['$scope'];
|
|
|
|
function OptionalMenuController($scope, $timeout) {
|
|
var vm = this;
|
|
}
|
|
|
|
function optionalMenu() {
|
|
var directive = {
|
|
'restrict': 'E',
|
|
'templateUrl': '/static/ng/resources/js/components/optional-menu/optional-menu.directive.html',
|
|
'link': link,
|
|
'scope': true,
|
|
'controller': OptionalMenuController,
|
|
'controllerAs': 'vm',
|
|
'bindToController': true
|
|
};
|
|
return directive;
|
|
function link(scope, element, attrs, ctrl) {
|
|
ctrl.isLoggedIn = false;
|
|
scope.$on('currentUser', function(e, val) {
|
|
if(val != null) {
|
|
ctrl.isLoggedIn = true;
|
|
ctrl.username = val.username;
|
|
}
|
|
scope.$apply();
|
|
});
|
|
}
|
|
}
|
|
|
|
})(); |