diff --git a/src/app/features/dashboard/rowCtrl.js b/src/app/features/dashboard/rowCtrl.js index 2e18291719d..e2ab9a0c156 100644 --- a/src/app/features/dashboard/rowCtrl.js +++ b/src/app/features/dashboard/rowCtrl.js @@ -38,11 +38,6 @@ function (angular, app, _, config) { } }; - // This can be overridden by individual panels - $scope.close_edit = function() { - $scope.$broadcast('render'); - }; - $scope.add_panel = function(panel) { $scope.dashboard.add_panel(panel, $scope.row); }; @@ -92,6 +87,10 @@ function (angular, app, _, config) { }); }; + $scope.updatePanelSpan = function(panel, span) { + panel.span = Math.min(Math.max(panel.span + span, 1), 12); + }; + $scope.replacePanel = function(newPanel, oldPanel) { var row = $scope.row; var index = _.indexOf(row.panels, oldPanel); @@ -144,9 +143,11 @@ function (angular, app, _, config) { module.directive('panelWidth', function() { return function(scope, element) { - scope.$watch('panel.span', function() { + function updateWidth() { element[0].style.width = ((scope.panel.span / 1.2) * 10) + '%'; - }); + } + + scope.$watch('panel.span', updateWidth); }; }); @@ -168,11 +169,21 @@ function (angular, app, _, config) { }; }); - module.directive('panelGhostPanel', function() { + module.directive('panelGhost', function() { return function(scope, element) { - var dropZoneSpan = 12 - scope.dashboard.rowSpan(scope.row); - element.find('.panel-container').css('height', scope.row.height); - element[0].style.width = ((dropZoneSpan / 1.2) * 10) + '%'; + function updateWidth() { + var spanLeft = 12 - scope.dashboard.rowSpan(scope.row); + if (spanLeft > 1) { + element.show(); + element.find('.panel-container').css('height', scope.row.height); + element[0].style.width = ((spanLeft / 1.2) * 10) + '%'; + } else { + element.hide(); + } + } + + updateWidth(); + scope.$on('dashboard-panel-span-updated', updateWidth); }; }); diff --git a/src/app/features/panel/panelMenu.js b/src/app/features/panel/panelMenu.js index 96fcc521f49..1f7d6aba71c 100644 --- a/src/app/features/panel/panelMenu.js +++ b/src/app/features/panel/panelMenu.js @@ -20,8 +20,8 @@ function (angular, $, _) { var template = '
'; template += '
'; template += '
'; - template += ''; - template += ''; + template += ''; + template += ''; template += ''; template += '
'; template += '
'; diff --git a/src/app/features/panel/panelSrv.js b/src/app/features/panel/panelSrv.js index 4c5e34cdbfa..0e983fc3d07 100644 --- a/src/app/features/panel/panelSrv.js +++ b/src/app/features/panel/panelSrv.js @@ -40,8 +40,7 @@ function (angular, _, config) { }; $scope.updateColumnSpan = function(span) { - $scope.panel.span = Math.min(Math.max($scope.panel.span + span, 1), 12); - $scope.row.updatePanelSpan() + $scope.updatePanelSpan($scope.panel, span); $timeout(function() { $scope.$broadcast('render'); diff --git a/src/app/partials/dashboard.html b/src/app/partials/dashboard.html index 6d7d0634fcd..edfe1bfcafb 100644 --- a/src/app/partials/dashboard.html +++ b/src/app/partials/dashboard.html @@ -86,14 +86,20 @@
-
-
-
- Drop here -
-
+
+
+
+ +
+
+
+ +
+
+
+ Drop here +
+
diff --git a/src/app/partials/roweditor.html b/src/app/partials/roweditor.html index 4c77a0bf814..177a8fd4ce5 100644 --- a/src/app/partials/roweditor.html +++ b/src/app/partials/roweditor.html @@ -5,7 +5,7 @@
-
+
@@ -26,29 +26,5 @@
-
-
- - - - - - - - - - - - - - - - - -
TitleTypeSpan
{{panel.title}}{{panel.type}} - - - -
-
+
diff --git a/src/css/less/panel.less b/src/css/less/panel.less index e3f1fd2b598..20164acfb9e 100644 --- a/src/css/less/panel.less +++ b/src/css/less/panel.less @@ -169,15 +169,23 @@ } } -.ghost-panel { - &:hover { - .panel-container { - visibility: visible; - } - } +.panel-ghost{ + width: 100%; .panel-container { - visibility: hidden; - border: 1px solid @grayDark; + border: none; + background: transparent; + } + .panel-ghost-list { + margin: 10px 0 10px 20px; + } + + button { + text-align: left; + min-width: 135px; + .fa { + position: relative; + left: -5px; + } } }