Files
meanTorrent/modules/users/client/controllers/userinfo/userinfo.client.controller.js

36 lines
924 B
JavaScript

(function () {
'use strict';
angular
.module('users')
.controller('UserInfoController', UserInfoController);
UserInfoController.$inject = ['$scope', '$state', 'Authentication', 'userResolve', 'ScoreLevelService', '$timeout'];
function UserInfoController($scope, $state, Authentication, user, ScoreLevelService, $timeout) {
var vm = this;
vm.authentication = Authentication;
vm.user = user;
vm.messageTo = messageTo;
vm.isContextUserSelf = isContextUserSelf;
vm.scoreLevelData = ScoreLevelService.getScoreLevelJson(vm.user.score);
/**
* messageTo
*/
function messageTo() {
var to = vm.user._id + '|' + vm.user.username;
$state.go('messages.send', {to: to});
}
/**
* isContextUserSelf
* @returns {boolean}
*/
function isContextUserSelf() {
return vm.user.username === vm.authentication.user.username;
}
}
}());