feat(users): add user-info link at many place

This commit is contained in:
OldHawk
2017-07-17 22:45:54 +08:00
parent 9b33bee429
commit e9e93da8ec
4 changed files with 28 additions and 17 deletions

View File

@@ -86,15 +86,15 @@
<div class="reply-item">
<!-- topic content -->
<div class="reply-wrapper">
<a class="reply-avatar">
<img title="{{vm.topic.user.displayName}}" ng-src="/{{vm.topic.user.profileImageURL}}">
</a>
<span user-info="vm.topic.user" info-class="reply-avatar">
<img ng-src="/{{vm.topic.user.profileImageURL}}">
</span>
<div class="reply-comment">
<div class="reply-comment-header">
<div class="reply-comment-header-text">{{vm.topic.user.displayName}} <span
score-level="vm.getUserScoreLevel(vm.topic.user);"></span>
<div class="reply-comment-header-text">
<span user-info="vm.topic.user">{{vm.topic.user.displayName}}</span>
<span score-level="vm.getUserScoreLevel(vm.topic.user);"></span>
<span message-to="vm.topic.user" to-class="message-to-icon"></span>
<span class="user-ud-text">
(<span class="glyphicon glyphicon-arrow-up torrent-up"></span>{{vm.topic.user.uploaded | bytes}}
@@ -115,7 +115,8 @@
title="{{'FORUMS.TITLES.TOPIC_DELETE' | translate}}"
ng-show="vm.canEdit() || vm.isOwner(vm.topic)"
ng-click="vm.beginDeleteTopic(vm.topic);"></i>
<i class="fa" ng-class="vm.topic.isTop ? 'fa-arrow-circle-down' : 'fa-arrow-circle-up'" aria-hidden="true"
<i class="fa" ng-class="vm.topic.isTop ? 'fa-arrow-circle-down' : 'fa-arrow-circle-up'"
aria-hidden="true"
title="{{'FORUMS.TITLES.TOPIC_TOP_TOPIC' | translate}}"
ng-show="vm.canEdit()"
ng-click="vm.beginTopTopic(vm.topic);"></i>
@@ -159,15 +160,15 @@
<!-- topic replies -->
<div class="reply-wrapper" ng-repeat="rep in vm.topic._replies">
<a class="reply-avatar">
<img title="{{rep.user.displayName}}" ng-src="/{{rep.user.profileImageURL}}">
</a>
<span user-info="rep.user" info-class="reply-avatar">
<img ng-src="/{{rep.user.profileImageURL}}">
</span>
<div class="reply-comment">
<div class="reply-comment-header">
<div class="reply-comment-header-text">{{rep.user.displayName}} <span
score-level="vm.getUserScoreLevel(vm.topic.user);"></span>
<div class="reply-comment-header-text">
<span user-info="rep.user">{{rep.user.displayName}}</span>
<span score-level="vm.getUserScoreLevel(vm.topic.user);"></span>
<span message-to="vm.topic.user" to-class="message-to-icon"></span>
<span class="user-ud-text">
(<span class="glyphicon glyphicon-arrow-up torrent-up"></span>{{rep.user.uploaded | bytes}}

View File

@@ -5,9 +5,9 @@
.module('users')
.controller('UserInfoController', UserInfoController);
UserInfoController.$inject = ['$scope', '$state', 'Authentication', 'userResolve', 'ScoreLevelService'];
UserInfoController.$inject = ['$scope', '$state', 'Authentication', 'userResolve', 'ScoreLevelService', '$timeout'];
function UserInfoController($scope, $state, Authentication, user, ScoreLevelService) {
function UserInfoController($scope, $state, Authentication, user, ScoreLevelService, $timeout) {
var vm = this;
vm.authentication = Authentication;
@@ -31,5 +31,14 @@
function isContextUserSelf() {
return vm.user.username === vm.authentication.user.username;
}
/**
* init
*/
vm.init = function () {
$timeout(function () {
$('html,body').scrollTop(0);
}, 0);
};
}
}());

View File

@@ -19,7 +19,8 @@
if (s) {
var user = s;
var title = $translate.instant('USER_INFO_TITLE', {name: user.displayName});
var e = angular.element('<a href="#" ui-sref="userinfo({userId: \'' + user._id + '\'})" title="' + title + '">' + element[0].innerHTML + '</a>');
var cls = attrs.infoClass;
var e = angular.element('<a href="#" class="' + (cls ? cls : "") + '" ui-sref="userinfo({userId: \'' + user._id + '\'})" title="' + title + '">' + element[0].innerHTML + '</a>');
element.html(e[0].outerHTML);
$compile(element.contents())(scope);
}

View File

@@ -1,4 +1,4 @@
<section class="container">
<section class="container" ng-init="vm.init();">
<div class="page-header">
<div class="row">
<div class="col-md-3 col-md-offset-3">