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