From 009fe0e0e8472368dfe17570a217e35c48920fee Mon Sep 17 00:00:00 2001 From: Emmanuel Darnis Date: Fri, 9 Mar 2018 11:59:07 +0000 Subject: [PATCH] [IMPAC-739] Add new figure layout --- .../figure/figure.directive.coffee | 22 +++++++++++++++++++ .../widgets-layouts/figure/figure.less | 10 +++++++++ .../widgets-layouts/figure/figure.tmpl.html | 7 ++++++ src/impac-angular.module.js | 6 +++++ 4 files changed, 45 insertions(+) create mode 100644 src/components/widgets-layouts/figure/figure.directive.coffee create mode 100644 src/components/widgets-layouts/figure/figure.less create mode 100644 src/components/widgets-layouts/figure/figure.tmpl.html diff --git a/src/components/widgets-layouts/figure/figure.directive.coffee b/src/components/widgets-layouts/figure/figure.directive.coffee new file mode 100644 index 00000000..ef27ca18 --- /dev/null +++ b/src/components/widgets-layouts/figure/figure.directive.coffee @@ -0,0 +1,22 @@ +module = angular.module('impac.components.widgets-layouts.figure',[]) + +module.controller('FigureLayoutCtrl', ($scope, ChartFormatterSvc) -> + + $scope.getColorByIndex = (index) -> + ChartFormatterSvc.getColor(index) + +) + +module.directive('impacFigureLayout', ($templateCache) -> + return { + restrict: 'E', + scope: { + content: '=' + timePeriodEnabled: '=?' + selectorList: '=?' + selectorUid: '=?' + }, + template: $templateCache.get('widgets-layouts/figure.tmpl.html'), + controller: 'FigureLayoutCtrl' + } +) diff --git a/src/components/widgets-layouts/figure/figure.less b/src/components/widgets-layouts/figure/figure.less new file mode 100644 index 00000000..c1027a3f --- /dev/null +++ b/src/components/widgets-layouts/figure/figure.less @@ -0,0 +1,10 @@ +.analytics .layouts.figure { + h3 { + text-align: center; + } + + .value { + .center-bold(0px); + margin-bottom: 3px; + } +} diff --git a/src/components/widgets-layouts/figure/figure.tmpl.html b/src/components/widgets-layouts/figure/figure.tmpl.html new file mode 100644 index 00000000..f6a1de45 --- /dev/null +++ b/src/components/widgets-layouts/figure/figure.tmpl.html @@ -0,0 +1,7 @@ +
+
+

{{figure.label}}

+
{{figure.value}}
+
{{figure.unit}}>
+
+
diff --git a/src/impac-angular.module.js b/src/impac-angular.module.js index 6347dbe6..de4653c8 100644 --- a/src/impac-angular.module.js +++ b/src/impac-angular.module.js @@ -35,6 +35,7 @@ angular.module('impac.components', 'impac.components.widget', 'impac.components.widgets', 'impac.components.widgets-settings', + 'impac.components.widgets-layouts', 'impac.components.widgets-common', 'impac.components.common', 'impac.components.templates' @@ -118,6 +119,11 @@ angular.module('impac.components.widgets-settings', 'impac.components.widgets-settings.offsets' ] ); +angular.module('impac.components.widgets-layouts', + [ + 'impac.components.widgets-layouts.figure' + ] +); angular.module('impac.components.dashboard-settings', [ 'impac.components.dashboard-settings.currency',