Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 1 | window.angular && (function (angular) { |
| 2 | 'use strict'; |
| 3 | |
| 4 | angular |
| 5 | .module('app.common.directives') |
| 6 | .directive('appNavigation', function () { |
| 7 | return { |
| 8 | 'restrict': 'E', |
| 9 | 'templateUrl': 'common/directives/app-navigation.html', |
| 10 | 'scope': { |
| 11 | 'path': '=', |
| 12 | 'showNavigation': '=' |
| 13 | }, |
Michael Davis | dfad5d5 | 2017-07-20 14:53:46 -0500 | [diff] [blame] | 14 | <<<<<<< HEAD |
Iftekharul Islam | cd78950 | 2017-04-19 14:37:55 -0500 | [diff] [blame] | 15 | 'controller': ['$scope', '$location', 'dataService', function($scope, $location, dataService){ |
Iftekharul Islam | 685fe75 | 2017-05-05 09:17:54 -0500 | [diff] [blame] | 16 | $scope.showSubMenu = false; |
Iftekharul Islam | cd78950 | 2017-04-19 14:37:55 -0500 | [diff] [blame] | 17 | $scope.change = function(firstLevel){ |
Iftekharul Islam | 685fe75 | 2017-05-05 09:17:54 -0500 | [diff] [blame] | 18 | if(firstLevel != $scope.firstLevel) { |
| 19 | $scope.firstLevel = firstLevel; |
| 20 | $scope.showSubMenu = true; |
| 21 | }else{ |
| 22 | $scope.showSubMenu = !$scope.showSubMenu; |
| 23 | } |
Michael Davis | 272297b | 2017-04-24 12:11:53 -0500 | [diff] [blame] | 24 | }; |
| 25 | $scope.closeSubnav = function(){ |
Iftekharul Islam | 685fe75 | 2017-05-05 09:17:54 -0500 | [diff] [blame] | 26 | $scope.showSubMenu = false; |
Michael Davis | 272297b | 2017-04-24 12:11:53 -0500 | [diff] [blame] | 27 | }; |
Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 28 | $scope.$watch('showNavigation', function(){ |
| 29 | var paddingTop = 0; |
Iftekharul Islam | 685fe75 | 2017-05-05 09:17:54 -0500 | [diff] [blame] | 30 | var urlRoot = $location.path().split("/")[1]; |
| 31 | if(urlRoot != ""){ |
| 32 | $scope.firstLevel = urlRoot; |
| 33 | }else{ |
| 34 | $scope.firstLevel = 'overview'; |
| 35 | } |
Iftekharul Islam | cd78950 | 2017-04-19 14:37:55 -0500 | [diff] [blame] | 36 | |
Michael Davis | dfad5d5 | 2017-07-20 14:53:46 -0500 | [diff] [blame] | 37 | ======= |
| 38 | 'controller': ['$scope', 'dataService', function($scope, dataService){ |
| 39 | $scope.$watch('showNavigation', function(){ |
| 40 | var paddingTop = 0; |
| 41 | $scope.firstLevel = 'overview'; |
| 42 | $scope.secondLevel = 'system_overview'; |
| 43 | >>>>>>> 4c1a3dd... Major update to code structure |
Iftekharul Islam | 99d199f | 2017-03-24 15:28:25 -0500 | [diff] [blame] | 44 | if($scope.showNavigation){ |
| 45 | paddingTop = document.getElementById('header__wrapper').offsetHeight; |
| 46 | } |
| 47 | dataService.bodyStyle = {'padding-top': paddingTop + 'px'}; |
| 48 | $scope.navStyle = {'top': paddingTop + 'px'}; |
| 49 | }); |
| 50 | }] |
| 51 | }; |
| 52 | }); |
| 53 | })(window.angular); |