Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 13329 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
RevLine 
[12428]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) {
[12520]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;
[12428]21                        }
22                    }
[12520]23                    return true;
[12428]24                }
[12520]25                return false;
[12428]26            };
27
[12520]28            $scope.logout = function () {
29                authService.logout({}, function () {
[12428]30                    $window.location.hash = "";
31                    $window.location.reload();
32                });
33            };
[12435]34
[12520]35            $scope.hideMenu = function () {
[12435]36                $(".navbar-collapse").collapse('hide');
37            };
[12428]38        }]
39    );
40})();
Note: See TracBrowser for help on using the repository browser.