Matteo Scandolo | 266907e | 2016-12-20 13:41:42 -0800 | [diff] [blame] | 1 | /** |
| 2 | * LUNA - Responsive Admin Theme |
| 3 | * |
| 4 | */ |
| 5 | /* tslint:disable */ |
| 6 | |
Matteo Scandolo | 266907e | 2016-12-20 13:41:42 -0800 | [diff] [blame] | 7 | import * as $ from 'jquery'; |
Matteo Scandolo | 266907e | 2016-12-20 13:41:42 -0800 | [diff] [blame] | 8 | |
| 9 | /** |
| 10 | * minimalizaSidebar - Directive for minimalize sidebar |
| 11 | */ |
| 12 | export function minimalizaMenu($rootScope) { |
| 13 | return { |
| 14 | restrict: 'EA', |
| 15 | template: '<div class="left-nav-toggle"><a href ng-click="minimalize()"><i class="stroke-hamburgermenu"></i> </a>', |
| 16 | controller: function ($scope, $element) { |
Matteo Scandolo | 266907e | 2016-12-20 13:41:42 -0800 | [diff] [blame] | 17 | $scope.minimalize = function () { |
| 18 | $("body").toggleClass("nav-toggle"); |
| 19 | } |
| 20 | } |
| 21 | }; |
| 22 | } |
| 23 | |
| 24 | |
| 25 | /** |
| 26 | * sparkline - Directive for Sparkline chart |
| 27 | */ |
| 28 | // export function sparkline() { |
| 29 | // return { |
| 30 | // restrict: 'A', |
| 31 | // scope: { |
| 32 | // sparkData: '=', |
| 33 | // sparkOptions: '=', |
| 34 | // }, |
| 35 | // link: function (scope, element, attrs) { |
| 36 | // scope.$watch(scope.sparkData, function () { |
| 37 | // render(); |
| 38 | // }); |
| 39 | // scope.$watch(scope.sparkOptions, function(){ |
| 40 | // render(); |
| 41 | // }); |
| 42 | // var render = function () { |
| 43 | // $(element).sparkline(scope.sparkData, scope.sparkOptions); |
| 44 | // }; |
| 45 | // } |
| 46 | // } |
| 47 | // } |
| 48 | |
| 49 | /** |
| 50 | * panelTools - Directive for panel tools elements in right corner of panel |
| 51 | */ |
| 52 | export function panelTools($timeout) { |
| 53 | return { |
| 54 | restrict: 'A', |
| 55 | scope: true, |
| 56 | templateUrl: 'views/common/panel_tools.html', |
| 57 | controller: function ($scope, $element) { |
| 58 | // Function for collapse ibox |
| 59 | $scope.showhide = function () { |
| 60 | var hpanel = $element.closest('div.panel'); |
| 61 | var icon = $element.find('i:first'); |
| 62 | var body = hpanel.find('div.panel-body'); |
| 63 | var footer = hpanel.find('div.panel-footer'); |
| 64 | body.slideToggle(300); |
| 65 | footer.slideToggle(200); |
| 66 | |
| 67 | // Toggle icon from up to down |
| 68 | icon.toggleClass('fa-chevron-up').toggleClass('fa-chevron-down'); |
| 69 | hpanel.toggleClass('').toggleClass('panel-collapse'); |
| 70 | $timeout(function () { |
| 71 | hpanel.resize(); |
| 72 | hpanel.find('[id^=map-]').resize(); |
| 73 | }, 50); |
| 74 | }; |
| 75 | |
| 76 | // Function for close ibox |
| 77 | $scope.closebox = function () { |
| 78 | var hpanel = $element.closest('div.panel'); |
| 79 | hpanel.remove(); |
| 80 | } |
| 81 | |
| 82 | } |
| 83 | }; |
| 84 | }; |