feat(users): show scoreLevel on admin manage user view

This commit is contained in:
OldHawk
2017-06-12 12:16:57 +08:00
parent 711bc12a23
commit 5b79b720ed
6 changed files with 13 additions and 7 deletions

View File

@@ -6,7 +6,7 @@
.controller('HeaderController', HeaderController);
HeaderController.$inject = ['$scope', '$state', '$stateParams', '$translate', 'Authentication', 'menuService', 'MeanTorrentConfig', 'localStorageService',
'ScoreLevelService'];
'ScoreLevelService'];
function HeaderController($scope, $state, $stateParams, $translate, Authentication, menuService, MeanTorrentConfig, localStorageService, ScoreLevelService) {
var vm = this;

View File

@@ -7,6 +7,7 @@
function scoreLevel() {
var directive = {
restrict: 'A',
replace: true,
link: link
};
@@ -14,7 +15,7 @@
function link(scope, element, attrs) {
scope.$watch(attrs.scoreLevel, function (level) {
var l = 'L' + attrs.scoreLevel;
var l = 'L' + level;
l = '<kbd>' + l + '</kbd>';
element.addClass('score-level');

View File

@@ -49,7 +49,7 @@
<a ui-sref="{{item.state}}" ng-bind="item.title" menu-title="{{item.title}}"></a>
</li>
<li ui-sref-active="active" ng-repeat="item in vm.scoreMenu.items" class="menu-score-parent">
<a ui-sref="{{item.state}}" ng-bind="item.title" menu-title="{{item.title}}"></a><span class="menu-score" score-level="{{vm.scoreLevelData.currLevel}}"></span>
<a ui-sref="{{item.state}}" ng-bind="item.title" menu-title="{{item.title}}"></a><span class="menu-score" score-level="vm.scoreLevelData.currLevel"></span>
</li>
<li class="divider"></li>
<li ui-sref-active="active" ng-repeat="item in vm.accountMenu.items">

View File

@@ -6,9 +6,10 @@
.controller('UserController', UserController);
UserController.$inject = ['$scope', '$state', '$window', 'Authentication', 'userResolve', 'Notification', 'NotifycationService', 'MeanTorrentConfig',
'AdminService'];
'AdminService', 'ScoreLevelService'];
function UserController($scope, $state, $window, Authentication, user, Notification, NotifycationService, MeanTorrentConfig, AdminService) {
function UserController($scope, $state, $window, Authentication, user, Notification, NotifycationService, MeanTorrentConfig, AdminService,
ScoreLevelService) {
var vm = this;
vm.authentication = Authentication;
@@ -18,6 +19,7 @@
vm.remove = remove;
vm.update = update;
vm.isContextUserSelf = isContextUserSelf;
vm.scoreLevelData = ScoreLevelService.getScoreLevelJson(vm.user.score);
vm.setUserScorePopover = {
title: 'SCORE_TITLE',
@@ -156,6 +158,9 @@
function onSetScoreSuccess(response) {
vm.user = response;
console.log(vm.scoreLevelData);
vm.scoreLevelData = ScoreLevelService.getScoreLevelJson(vm.user.score);
console.log(vm.scoreLevelData);
NotifycationService.showSuccessNotify('SET_SCORE_SUCCESSFULLY');
}

View File

@@ -149,7 +149,7 @@
<dt class="h-line">{{ 'STATUS_FIELD.SCORE' | translate}}</dt>
<dd class="h-line">
<span>{{ vm.user.score }}</span>
<span>{{ vm.user.score }}</span> <span score-level="vm.scoreLevelData.currLevel"></span>
<div class="pull-right" ng-if="vm.authentication.user.isAdmin">
<button class="btn btn-default btn-xs" style="width: 64px;"

View File

@@ -34,7 +34,7 @@
<dt class="h-line">{{ 'STATUS_FIELD.SCORE' | translate}}</dt>
<dd class="h-line">
<span class="text-score">{{ vm.user.score }}</span> <span score-level="{{vm.scoreLevelData.currLevel}}"></span> <a ui-sref="score.detail">{{ 'STATUS_FIELD.DETAIL' | translate }}</a>
<span class="text-score">{{ vm.user.score }}</span> <span score-level="vm.scoreLevelData.currLevel"></span> <a ui-sref="score.detail">{{ 'STATUS_FIELD.DETAIL' | translate }}</a>
</dd>
<div class="margin-top-10">