<commit_before>'use strict';

angular.module('modulePlannerApp')
  .controller('NavbarCtrl', function ($scope, $location, Auth, _) {
    $scope.menu = [
      {
        link: '/settings',
        title: 'Settings',
      }, {
        isDropdown: true,
        isAdmin: true,
        title: 'Admin',
        dropdown: [
          {
            link: '/users',
            title: 'Manage Users'
          }, {
            link: '/users',
            title: 'Manage Courses'
          }, {
            link: '/users',
            title: 'Manage Requirements'
          }
        ]
      }
    ];

    if ($scope.currentUser && $scope.currentUser.role !== 'admin') {
      $scope.menu = _.filter($scope.menu, function(item){        
        return !item.isAdmin;
      });
    }
    
    $scope.logout = function() {
      Auth.logout()
      .then(function() {
        $location.path('/login');
      });
    };

    $scope.isActive = function(route) {
      return route === $location.path();
    };
  });
<commit_msg>Update to admin navbar<commit_after>'use strict';

angular.module('modulePlannerApp')
  .controller('NavbarCtrl', function ($scope, $location, Auth, _) {
    $scope.master = [
      {
        link: '/settings',
        title: 'Settings',
      }, {
        isDropdown: true,
        isAdmin: true,
        title: 'Admin',
        dropdown: [
          {
            link: '/users',
            title: 'Manage Users'
          }, {
            link: '/users',
            title: 'Manage Courses'
          }, {
            link: '/users',
            title: 'Manage Requirements'
          }
        ]
      }
    ];

    
    $scope.$watch('currentUser', function(newVal, oldVal){
      $scope.filterMenuItems();
    }, true);

    $scope.filterMenuItems = function(){
      if ($scope.currentUser && $scope.currentUser.role !== 'admin') {
        $scope.menu = _.filter($scope.master, function(item){
          return !item.isAdmin;
        });
      } else {
        $scope.menu = $scope.master;
      }
    };


    $scope.logout = function() {
      Auth.logout()
      .then(function() {
        $location.path('/login');
      });
    };

    $scope.isActive = function(route) {
      return route === $location.path();
    };
  });

{'fraction_non_alphanumeric': 0.1631929046563193, 'fraction_numerical': 0.0, 'mean_word_length': 1.617169373549884, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3607688', 'n_tokens_mistral': 678, 'n_tokens_neox': 666, 'n_words': 121}