blob: c2d96cd9428113a68dbb6e6464ef12392d1a0c48 [file] [log] [blame]
Matteo Scandolo266907e2016-12-20 13:41:42 -08001/**
2 * LUNA - Responsive Admin Theme
3 *
4 */
5/* tslint:disable */
6
7
8/**
9 * pageTitle - Directive for set Page title - mata title
10 */
11import * as $ from 'jquery';
12export 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 */
32export 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) {
Matteo Scandolo266907e2016-12-20 13:41:42 -080037 $scope.minimalize = function () {
38 $("body").toggleClass("nav-toggle");
39 }
40 }
41 };
42}
43
44
45/**
46 * sparkline - Directive for Sparkline chart
47 */
48// export function sparkline() {
49// return {
50// restrict: 'A',
51// scope: {
52// sparkData: '=',
53// sparkOptions: '=',
54// },
55// link: function (scope, element, attrs) {
56// scope.$watch(scope.sparkData, function () {
57// render();
58// });
59// scope.$watch(scope.sparkOptions, function(){
60// render();
61// });
62// var render = function () {
63// $(element).sparkline(scope.sparkData, scope.sparkOptions);
64// };
65// }
66// }
67// }
68
69/**
70 * panelTools - Directive for panel tools elements in right corner of panel
71 */
72export function panelTools($timeout) {
73 return {
74 restrict: 'A',
75 scope: true,
76 templateUrl: 'views/common/panel_tools.html',
77 controller: function ($scope, $element) {
78 // Function for collapse ibox
79 $scope.showhide = function () {
80 var hpanel = $element.closest('div.panel');
81 var icon = $element.find('i:first');
82 var body = hpanel.find('div.panel-body');
83 var footer = hpanel.find('div.panel-footer');
84 body.slideToggle(300);
85 footer.slideToggle(200);
86
87 // Toggle icon from up to down
88 icon.toggleClass('fa-chevron-up').toggleClass('fa-chevron-down');
89 hpanel.toggleClass('').toggleClass('panel-collapse');
90 $timeout(function () {
91 hpanel.resize();
92 hpanel.find('[id^=map-]').resize();
93 }, 50);
94 };
95
96 // Function for close ibox
97 $scope.closebox = function () {
98 var hpanel = $element.closest('div.panel');
99 hpanel.remove();
100 }
101
102 }
103 };
104};