feat(users): show user signature in forum topic and replies

This commit is contained in:
OldHawk
2017-11-08 16:45:31 +08:00
parent ddc90ac902
commit 79179766c9
7 changed files with 63 additions and 11 deletions

View File

@@ -966,6 +966,7 @@
SEARCH_RESULT_LIST: 'Search Result',
SEARCH_LOADING: 'is loading result, please wait...',
SEARCH_EMPTY: 'No matching results',
SIGNATURE_TAG: 'Signature',
CATEGORY: {
AFFAIRS: 'Affairs',

View File

@@ -966,6 +966,7 @@
SEARCH_RESULT_LIST: '搜索结果',
SEARCH_LOADING: '正在装载搜索结果,请稍候...',
SEARCH_EMPTY: '没有匹配的搜索结果',
SIGNATURE_TAG: '用户签名',
CATEGORY: {
AFFAIRS: '站务区',

View File

@@ -1620,7 +1620,8 @@ body {
}
.signature-input {
background-color: #efefef;
font-size: 0.9em;
background-color: #f5f5f5;
border-radius: 4px;
border: solid 1px #dedede;
padding: 10px;

View File

@@ -78,6 +78,7 @@
forumId: $stateParams.forumId,
topicId: $stateParams.topicId
}, function (topic) {
mtDebug.info(topic);
vm.topic = topic;
vm.buildPager();
@@ -96,6 +97,17 @@
}
};
/**
* getUserSignatureMarked
* @param u
* @returns {*}
*/
vm.getUserSignatureMarked = function (u) {
if (u) {
return marked(u.signature, {sanitize: true});
}
};
/**
* getUserScoreLevel
* @param u

View File

@@ -136,7 +136,7 @@
}
.readonly {
cursor: pointer;
cursor: pointer;
}
.post-list {
@@ -366,7 +366,7 @@
padding-left: 15px;
color: #586069;
background-color: lighten(@comment-background-default, 2%);
border-bottom: 1px dashed #d1d5da;
border-bottom: 1px solid #d1d5da;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
min-height: 42px;
@@ -475,6 +475,35 @@
}
}
}
.reply-comment-signature {
position: relative;
padding: 10px 15px;
font-size: 0.9em;
color: #586069;
background-color: lighten(@comment-background-default, 2%);
border-top: 1px solid #d1d5da;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
p {
&:first-child {
margin-top: 5px;
}
&:last-child {
margin-bottom: 0;
}
}
.signature-tag {
position: absolute;
background-color: lighten(@comment-background-default, 2%);
top: -10px;
left: 15px;
font-size: 12px;
color: #ccc;
padding: 1px 5px 0 5px;
border-radius: 3px;
border: solid 1px #d1d5da;
}
}
}
.reply-avatar {
img {

View File

@@ -117,6 +117,9 @@
<div id="{{vm.topic._id}}" data-provide="markdown" class="reply-comment-body-text"
ng-bind-html="vm.getTopicContent(vm.topic)">
</div>
<div class="text-right margin-top-10" ng-show="vm.topic.updatedAt">
<p class="reply-comment-body-edited-text">[ {{vm.topic.updatedBy.displayName}} {{ 'COMMENT_EDITED_INFO' | translate}} {{vm.topic.updatedAt | date:'yyyy-MM-dd HH:mm:ss'}} ]</p>
</div>
<div class="attach-list" ng-if="vm.topic._attach.length">
<div class="attach-header" translate="FORUMS.ATTACH_LIST_HEADER"></div>
<ol>
@@ -141,9 +144,10 @@
</span>
</div>
</div>
<div class="row text-right margin-top-10" ng-show="vm.topic.updatedAt">
<p class="reply-comment-body-edited-text">[ {{vm.topic.updatedBy.displayName}} {{ 'COMMENT_EDITED_INFO' | translate}} {{vm.topic.updatedAt | date:'yyyy-MM-dd HH:mm:ss'}} ]</p>
</div>
</div>
<div class="reply-comment-signature" ng-if="vm.topic.user.signature">
<div ng-bind-html="vm.getUserSignatureMarked(vm.topic.user);"></div>
<span class="signature-tag" translate="FORUMS.SIGNATURE_TAG"></span>
</div>
</div>
</div>
@@ -193,6 +197,9 @@
<div id="{{rep._id}}" data-provide="markdown" class="reply-comment-body-text"
ng-bind-html="vm.getTopicContent(rep)">
</div>
<div class="text-right margin-top-10" ng-show="rep.updatedAt">
<p class="reply-comment-body-edited-text">[ {{rep.updatedBy.displayName}} {{ 'COMMENT_EDITED_INFO' | translate}} {{rep.updatedAt | date:'yyyy-MM-dd HH:mm:ss'}} ]</p>
</div>
<div class="attach-list" ng-if="rep._attach.length">
<div class="attach-header" translate="FORUMS.ATTACH_LIST_HEADER"></div>
<ol>
@@ -216,9 +223,10 @@
</span>
</div>
</div>
<div class="row text-right margin-top-10" ng-show="rep.updatedAt">
<p class="reply-comment-body-edited-text">[ {{rep.updatedBy.displayName}} {{ 'COMMENT_EDITED_INFO' | translate}} {{rep.updatedAt | date:'yyyy-MM-dd HH:mm:ss'}} ]</p>
</div>
</div>
<div class="reply-comment-signature" ng-if="rep.user.signature">
<div ng-bind-html="vm.getUserSignatureMarked(rep.user);"></div>
<span class="signature-tag" translate="FORUMS.SIGNATURE_TAG"></span>
</div>
</div>
</div>

View File

@@ -953,11 +953,11 @@ exports.topicById = function (req, res, next, id) {
}
Topic.findById(id)
.populate('user', 'username displayName profileImageURL isVip uploaded downloaded score')
.populate('user', 'username displayName profileImageURL isVip uploaded downloaded score signature')
.populate('lastUser', 'username displayName profileImageURL isVip uploaded downloaded')
.populate('updatedBy', 'username displayName profileImageURL isVip uploaded downloaded')
.populate('_thumbs.user', 'username displayName profileImageURL isVip uploaded downloaded')
.populate('_replies.user', 'username displayName profileImageURL isVip uploaded downloaded')
.populate('_replies.user', 'username displayName profileImageURL isVip uploaded downloaded signature')
.populate('_replies.updatedBy', 'username displayName profileImageURL isVip uploaded downloaded')
.populate('_replies._thumbs.user', 'username displayName profileImageURL isVip uploaded downloaded')
.exec(function (err, topic) {