Moved menu stuff to own controller

This commit is contained in:
Blade Barringer
2015-06-29 12:38:46 -05:00
parent 2f48534342
commit bc837fd4db
7 changed files with 78 additions and 44 deletions

View File

@@ -5,8 +5,8 @@
*/
angular.module('habitrpg')
.controller("AuthCtrl", ['$scope', '$rootScope', 'User', '$http', '$location', '$window','ApiUrl', '$modal', 'Analytics', 'Chat',
function($scope, $rootScope, User, $http, $location, $window, ApiUrl, $modal, Analytics, Chat) {
.controller("AuthCtrl", ['$scope', '$rootScope', 'User', '$http', '$location', '$window','ApiUrl', '$modal', 'Analytics',
function($scope, $rootScope, User, $http, $location, $window, ApiUrl, $modal, Analytics) {
$scope.Analytics = Analytics;
$scope.logout = function() {
@@ -102,41 +102,6 @@ angular.module('habitrpg')
}
};
// @TODO: Pull out menu stuff into separate menu controller
$scope.expandMenu = function(menu) {
$scope._expandedMenu = ($scope._expandedMenu == menu) ? null : menu;
};
function selectNotificationValue(mysteryValue, invitationValue, unallocatedValue, messageValue, noneValue) {
var user = $scope.user;
if (user.purchased && user.purchased.plan && user.purchased.plan.mysteryItems && user.purchased.plan.mysteryItems.length) {
return mysteryValue;
} else if ((user.invitations.party && user.invitations.party.id) || (user.invitations.guilds && user.invitations.guilds.length > 0)) {
return invitationValue;
} else if (user.flags.classSelected && !(user.preferences && user.preferences.disableClasses) && user.stats.points) {
return unallocatedValue;
} else if (!(_.isEmpty(user.newMessages))) {
return messageValue;
} else {
return noneValue;
}
};
$scope.clearMessages = Chat.seenMessage;
$scope.iconClasses = function() {
return selectNotificationValue(
"glyphicon-gift",
"glyphicon-user",
"glyphicon-plus-sign",
"glyphicon-comment",
"glyphicon-comment inactive");
};
$scope.hasNoNotifications = function() {
return selectNotificationValue(false, false, false, false, true);
}
// ------ Social ----------
hello.init({