|
|
@@ -13,25 +13,25 @@ function (angular, $, _) {
|
|
|
'<span class="panel-title drag-handle pointer">' +
|
|
|
'<span class="panel-title-text drag-handle">{{ctrl.panel.title}}</span>' +
|
|
|
'<span class="panel-links-btn"><i class="fa fa-external-link"></i></span>' +
|
|
|
- '<span class="panel-time-info" ng-show="ctrl.panelMeta.timeInfo"><i class="fa fa-clock-o"></i> {{panelMeta.timeInfo}}</span>' +
|
|
|
+ '<span class="panel-time-info" ng-show="ctrl.panelMeta.timeInfo"><i class="fa fa-clock-o"></i> {{ctrl.panelMeta.timeInfo}}</span>' +
|
|
|
'</span>';
|
|
|
|
|
|
- function createExternalLinkMenu($scope) {
|
|
|
+ function createExternalLinkMenu(ctrl) {
|
|
|
var template = '<div class="panel-menu small">';
|
|
|
template += '<div class="panel-menu-row">';
|
|
|
|
|
|
- if ($scope.ctrl.panel.links) {
|
|
|
- _.each($scope.panel.links, function(link) {
|
|
|
- var info = linkSrv.getPanelLinkAnchorInfo(link, $scope.panel.scopedVars);
|
|
|
+ if (ctrl.panel.links) {
|
|
|
+ _.each(ctrl.panel.links, function(link) {
|
|
|
+ var info = linkSrv.getPanelLinkAnchorInfo(link, ctrl.panel.scopedVars);
|
|
|
template += '<a class="panel-menu-link" href="' + info.href + '" target="' + info.target + '">' + info.title + '</a>';
|
|
|
});
|
|
|
}
|
|
|
return template;
|
|
|
}
|
|
|
- function createMenuTemplate($scope) {
|
|
|
+ function createMenuTemplate(ctrl) {
|
|
|
var template = '<div class="panel-menu small">';
|
|
|
|
|
|
- if ($scope.ctrl.dashboard.meta.canEdit) {
|
|
|
+ if (ctrl.dashboard.meta.canEdit) {
|
|
|
template += '<div class="panel-menu-inner">';
|
|
|
template += '<div class="panel-menu-row">';
|
|
|
template += '<a class="panel-menu-icon pull-left" ng-click="updateColumnSpan(-1)"><i class="fa fa-minus"></i></a>';
|
|
|
@@ -44,9 +44,9 @@ function (angular, $, _) {
|
|
|
template += '<div class="panel-menu-row">';
|
|
|
template += '<a class="panel-menu-link" gf-dropdown="extendedMenu"><i class="fa fa-bars"></i></a>';
|
|
|
|
|
|
- _.each($scope.ctrl.panelMeta.menu, function(item) {
|
|
|
+ _.each(ctrl.panelMeta.menu, function(item) {
|
|
|
// skip edit actions if not editor
|
|
|
- if (item.role === 'Editor' && !$scope.ctrl.dashboard.meta.canEdit) {
|
|
|
+ if (item.role === 'Editor' && !ctrl.dashboard.meta.canEdit) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -63,8 +63,8 @@ function (angular, $, _) {
|
|
|
return template;
|
|
|
}
|
|
|
|
|
|
- function getExtendedMenu($scope) {
|
|
|
- return angular.copy($scope.ctrl.panelMeta.extendedMenu);
|
|
|
+ function getExtendedMenu(ctrl) {
|
|
|
+ return angular.copy(ctrl.panelMeta.extendedMenu);
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
@@ -74,13 +74,14 @@ function (angular, $, _) {
|
|
|
var $panelLinksBtn = $link.find(".panel-links-btn");
|
|
|
var $panelContainer = elem.parents(".panel-container");
|
|
|
var menuScope = null;
|
|
|
+ var ctrl = $scope.ctrl;
|
|
|
var timeout = null;
|
|
|
var $menu = null;
|
|
|
|
|
|
elem.append($link);
|
|
|
|
|
|
$scope.$watchCollection('panel.links', function(newValue) {
|
|
|
- var showIcon = (newValue ? newValue.length > 0 : false) && $scope.panel.title !== '';
|
|
|
+ var showIcon = (newValue ? newValue.length > 0 : false) && ctrl.panel.title !== '';
|
|
|
$panelLinksBtn.toggle(showIcon);
|
|
|
});
|
|
|
|
|
|
@@ -124,9 +125,9 @@ function (angular, $, _) {
|
|
|
|
|
|
var menuTemplate;
|
|
|
if ($(e.target).hasClass('fa-external-link')) {
|
|
|
- menuTemplate = createExternalLinkMenu($scope);
|
|
|
+ menuTemplate = createExternalLinkMenu(ctrl);
|
|
|
} else {
|
|
|
- menuTemplate = createMenuTemplate($scope);
|
|
|
+ menuTemplate = createMenuTemplate(ctrl);
|
|
|
}
|
|
|
|
|
|
$menu = $(menuTemplate);
|
|
|
@@ -135,7 +136,7 @@ function (angular, $, _) {
|
|
|
});
|
|
|
|
|
|
menuScope = $scope.$new();
|
|
|
- menuScope.extendedMenu = getExtendedMenu($scope);
|
|
|
+ menuScope.extendedMenu = getExtendedMenu(ctrl);
|
|
|
menuScope.dismiss = function() {
|
|
|
dismiss(null, true);
|
|
|
};
|