Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/HeuristicLab.Services.WebApp/3.3/WebApp/shared/menu/menuCtrl.js @ 16462

Last change on this file since 16462 was 12520, checked in by dglaser, 10 years ago

#2394:

HeuristicLab.Services.WebApp-3.3:

  • changed the menu controller to set all parents of an entry to active
File size: 1.7 KB
Line 
1(function () {
2    var module = appMainPlugin.getAngularModule();
3    module.controller('app.menu.ctrl',
4        ['$scope', '$timeout', '$location', '$window', 'app.authentication.service',
5        function ($scope, $timeout, $location, $window, authService) {
6            $scope.modules = app.modules;
7            $scope.menuEntries = app.getMenu().getMenuEntries();
8            $scope.isActive = function (viewLocation) {
9                var linkLocation = viewLocation.toUpperCase().substr(1);
10                var currentLocation = $location.path().toUpperCase();
11                if (linkLocation == currentLocation) {
12                    return true;
13                }
14                var linkLocationParts = linkLocation.split("/");
15                var currentLocationParts = currentLocation.split("/");
16                var linkLocationPartsLength = linkLocationParts.length;
17                if (linkLocationPartsLength < currentLocationParts.length) {
18                    for (var i = 0; i < linkLocationPartsLength; ++i) {
19                        if (linkLocationParts[i] !== currentLocationParts[i]) {
20                            return false;
21                        }
22                    }
23                    return true;
24                }
25                return false;
26            };
27
28            $scope.logout = function () {
29                authService.logout({}, function () {
30                    $window.location.hash = "";
31                    $window.location.reload();
32                });
33            };
34
35            $scope.hideMenu = function () {
36                $(".navbar-collapse").collapse('hide');
37            };
38        }]
39    );
40})();
Note: See TracBrowser for help on using the repository browser.