mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-02-02 20:49:24 +01:00
45 lines
1.0 KiB
JavaScript
45 lines
1.0 KiB
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;
|
|
}
|
|
|
|
/**
|
|
* init
|
|
*/
|
|
vm.init = function () {
|
|
$timeout(function () {
|
|
$('html,body').scrollTop(0);
|
|
}, 0);
|
|
};
|
|
}
|
|
}());
|