<commit_before>'use strict';

angular.module('core').controller('HeaderController', ['$scope', 'Authentication', 'Menus',
	function($scope, Authentication, Menus) {
		$scope.authentication = Authentication;  // save the authen obj.

		var hasAdminRole = function () {
			Array.prototype.contains = function(obj) {
			    var i = this.length;
			    while (i--) {
			        if (this[i] === obj) {
			            return true;
			        }
			    }
			    return false;
			};
			if ($scope.authentication.user.roles !== null) {
				return  $scope.authentication.user.roles.contains('admin');
			} else {
				return false;
			}
		};

		$scope.isAdmin = hasAdminRole();
		$scope.member_id = $scope.authentication.user.member;
		$scope.$on('$stateChangeSuccess', function() {
			$scope.isAdmin = hasAdminRole();
		});
		
		// $scope.isCollapsed = false;
		// $scope.menu = Menus.getMenu('topbar');

		// $scope.toggleCollapsibleMenu = function() {
		// 	$scope.isCollapsed = !$scope.isCollapsed;
		// };

		// // Collapsing the menu after navigation
		// $scope.$on('$stateChangeSuccess', function() {
		// 	$scope.isCollapsed = false;
		// });<commit_msg>fix the bug of menu show.<commit_after>'use strict';

angular.module('core').controller('HeaderController', ['$scope', 'Authentication', 'Menus',
	function($scope, Authentication, Menus) {
		$scope.authentication = Authentication;  // save the authen obj.

		var hasAdminRole = function () {
			Array.prototype.contains = function(obj) {
			    var i = this.length;
			    while (i--) {
			        if (this[i] === obj) {
			            return true;
			        }
			    }
			    return false;
			};
			if ($scope.authentication.user !== '') {
				return  $scope.authentication.user.roles.contains('admin');
			} else {
				return false;
			}
		};

		$scope.isAdmin = hasAdminRole();
		$scope.member_id = $scope.authentication.user.member;
		$scope.$on('$stateChangeSuccess', function() {
			$scope.isAdmin = hasAdminRole();
		});
		
		// $scope.isCollapsed = false;
		// $scope.menu = Menus.getMenu('topbar');

		// $scope.toggleCollapsibleMenu = function() {
		// 	$scope.isCollapsed = !$scope.isCollapsed;
		// };

		// // Collapsing the menu after navigation
		// $scope.$on('$stateChangeSuccess', function() {
		// 	$scope.isCollapsed = false;
		// });
{'fraction_non_alphanumeric': 0.17259323503902863, 'fraction_numerical': 0.0, 'mean_word_length': 2.8322259136212624, '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': '6200401', 'n_tokens_mistral': 852, 'n_tokens_neox': 727, 'n_words': 134}