diff --git a/modules/core/client/app/trans-string-en.js b/modules/core/client/app/trans-string-en.js index 28225d7d..e7c4e632 100644 --- a/modules/core/client/app/trans-string-en.js +++ b/modules/core/client/app/trans-string-en.js @@ -629,7 +629,8 @@ LINK_EDIT: 'Edit', BTN_DELETE: ' Delete  ', BTN_SUBMIT: 'Submit New Topic', - BTN_POST_NEW: 'Post New Topic', + BTN_POST_NEW_TOPIC: 'Post New Topic', + BTN_POST_NEW_REPLY: 'Post New Reply', ADD_SUCCESSFULLY: 'Forum added successfully', ADD_FAILED: 'Forum added failed', EDIT_SUCCESSFULLY: 'Forum edited successfully', diff --git a/modules/core/client/app/trans-string-zh.js b/modules/core/client/app/trans-string-zh.js index c975a57b..8b28d62d 100644 --- a/modules/core/client/app/trans-string-zh.js +++ b/modules/core/client/app/trans-string-zh.js @@ -629,7 +629,8 @@ LINK_EDIT: '编辑', BTN_DELETE: ' 删除  ', BTN_SUBMIT: ' 提交新话题 ', - BTN_POST_NEW: ' 发起新话题 ', + BTN_POST_NEW_TOPIC: ' 发起新话题 ', + BTN_POST_NEW_REPLY: ' 回复 ', ADD_SUCCESSFULLY: '版块添加成功', ADD_FAILED: '版块添加失败', EDIT_SUCCESSFULLY: '版块编辑成功', diff --git a/modules/forums/client/controllers/forums-post.client.controller.js b/modules/forums/client/controllers/forums-post.client.controller.js index ec839f98..ebe0f13c 100644 --- a/modules/forums/client/controllers/forums-post.client.controller.js +++ b/modules/forums/client/controllers/forums-post.client.controller.js @@ -15,6 +15,13 @@ vm.user = Authentication.user; vm.forumPath = []; + /** + * If user is not signed in then redirect back home + */ + if (!Authentication.user) { + $state.go('authentication.signin'); + } + /** * init */ diff --git a/modules/forums/client/controllers/forums-topic.client.controller.js b/modules/forums/client/controllers/forums-topic.client.controller.js index 63c20b21..d90ca438 100644 --- a/modules/forums/client/controllers/forums-topic.client.controller.js +++ b/modules/forums/client/controllers/forums-topic.client.controller.js @@ -15,6 +15,13 @@ vm.user = Authentication.user; vm.forumPath = []; + /** + * If user is not signed in then redirect back home + */ + if (!Authentication.user) { + $state.go('authentication.signin'); + } + /** * init */ @@ -41,5 +48,15 @@ }; + /** + * getTopicContent + * @param t + * @returns {*} + */ + vm.getTopicContent = function (t) { + if (t) { + return marked(t.content, {sanitize: true}); + } + }; } }()); diff --git a/modules/forums/client/controllers/forums-view.client.controller.js b/modules/forums/client/controllers/forums-view.client.controller.js index 2801303d..a66220ce 100644 --- a/modules/forums/client/controllers/forums-view.client.controller.js +++ b/modules/forums/client/controllers/forums-view.client.controller.js @@ -15,6 +15,13 @@ vm.user = Authentication.user; vm.forumPath = []; + /** + * If user is not signed in then redirect back home + */ + if (!Authentication.user) { + $state.go('authentication.signin'); + } + /** * init */ diff --git a/modules/forums/client/controllers/forums.client.controller.js b/modules/forums/client/controllers/forums.client.controller.js index f13d094a..c63c2fe4 100644 --- a/modules/forums/client/controllers/forums.client.controller.js +++ b/modules/forums/client/controllers/forums.client.controller.js @@ -14,6 +14,13 @@ vm.forumsConfig = MeanTorrentConfig.meanTorrentConfig.forumsConfig; vm.user = Authentication.user; + /** + * If user is not signed in then redirect back home + */ + if (!Authentication.user) { + $state.go('authentication.signin'); + } + /** * init */ diff --git a/modules/forums/client/less/forum.less b/modules/forums/client/less/forum.less index d24ed280..e0577970 100644 --- a/modules/forums/client/less/forum.less +++ b/modules/forums/client/less/forum.less @@ -204,6 +204,144 @@ } } +.reply-list { + .pagination { + margin-bottom: 5px; + margin-top: 10px; + } + .table-category { + border-radius: 6px; + } + table { + border-spacing: 0; + border-collapse: inherit; + border: solid 3px @brand-primary; + thead { + background-color: @brand-primary; + border: solid 1px @brand-primary; + color: #efefef; + tr { + th { + border: solid 2px @brand-primary; + padding: 13px 10px; + .count-info { + font-size: 12px; + font-weight: normal; + } + } + } + } + tbody { + tr { + td { + border-top: none; + white-space: normal !important; + border-bottom: solid 2px lighten(@brand-primary, 45%); + } + } + tr:last-child { + td { + border-bottom: none; + } + } + } + } +} + +.reply-item { + .reply-wrapper { + padding-left: 60px; + margin: 20px 30px; + .reply-comment { + position: relative; + background-color: #fff; + border: 1px solid #d1d5da; + border-radius: 3px; + &::before { + position: absolute; + top: 11px; + right: 100%; + left: -16px; + display: block; + width: 0; + height: 0; + pointer-events: none; + content: " "; + border-color: transparent; + border-style: solid solid outset; + + border-width: 8px; + border-right-color: #d1d5da; + } + &::after { + position: absolute; + top: 11px; + right: 100%; + left: -16px; + display: block; + width: 0; + height: 0; + pointer-events: none; + content: " "; + border-color: transparent; + border-style: solid solid outset; + + margin-top: 1px; + margin-left: 2px; + border-width: 7px; + border-right-color: lighten(@comment-background-default, 2%); + } + .reply-comment-header { + padding-right: 15px; + padding-left: 15px; + color: #586069; + background-color: lighten(@comment-background-default, 2%); + border-bottom: 1px dashed #d1d5da; + border-top-left-radius: 3px; + border-top-right-radius: 3px; + min-height: 42px; + .reply-comment-header-text { + max-width: 70%; + padding-top: 10px; + padding-bottom: 10px; + .user-ud-text { + font-size: 12px; + color: lighten(@gray-base, 60%); + } + } + .reply-comment-header-time-text { + font-size: 12px; + color: lighten(@gray-base, 60%); + margin-left: 5px; + } + } + .reply-comment-body { + padding-right: 15px; + padding-left: 15px; + min-height: 42px; + .reply-comment-body-text { + padding-top: 10px; + } + .reply-comment-body-edited-text { + font-size: 12px; + color: lighten(@gray-base, 60%); + margin-right: 15px; + } + } + } + .reply-avatar { + img { + cursor: pointer; + float: left; + margin-left: -60px; + border-radius: 3px; + height: 44px; + width: 44px; + } + } + } +} + .add-moderator-popover { max-width: 250px; max-height: 150px; diff --git a/modules/forums/client/views/topic.client.view.html b/modules/forums/client/views/topic.client.view.html index c1a10791..c69450a8 100644 --- a/modules/forums/client/views/topic.client.view.html +++ b/modules/forums/client/views/topic.client.view.html @@ -36,11 +36,76 @@ -
+ +
+ +
+ + + + + + + + + + + +
+ {{vm.topic.title}} + +
+ {{'FORUMS.FIELDS.VIEWS' | translate}}: {{vm.topic.viewCount}}, + {{'FORUMS.FIELDS.REPLIES' | translate}}: {{vm.topic.replyCount}} +
+
+
+
+ + + + +
+
+
{{vm.topic.user.displayName}} + + ({{vm.topic.user.uploaded | bytes}} + {{vm.topic.user.downloaded | bytes}} + ) + + + {{vm.topic.createdAt | date:'yyyy-MM-dd HH:mm:ss'}} +
+
+
+
+
+

[ {{vm.topic.updatedBy}} {{ 'COMMENT_EDITED_INFO' | translate}} {{vm.topic.updatedAt | date:'yyyy-MM-dd HH:mm:ss'}} ]

+
+
+
+
+
+
+
+
+ +
+
\ No newline at end of file diff --git a/modules/forums/client/views/view.client.view.html b/modules/forums/client/views/view.client.view.html index 4862fe2e..3c6d0dc0 100644 --- a/modules/forums/client/views/view.client.view.html +++ b/modules/forums/client/views/view.client.view.html @@ -46,7 +46,7 @@
{{'FORUMS.BTN_POST_NEW' | translate}} + ui-sref="forums.post({forumId: vm.forum._id})">{{'FORUMS.BTN_POST_NEW_TOPIC' | translate}}
diff --git a/modules/forums/server/models/topic.server.model.js b/modules/forums/server/models/topic.server.model.js index 14c8081d..fef64019 100644 --- a/modules/forums/server/models/topic.server.model.js +++ b/modules/forums/server/models/topic.server.model.js @@ -83,20 +83,24 @@ var TopicSchema = new Schema({ _attach: [AttachSchema], _scoreList: [ScoreSchema], - lastUser: { - type: Schema.Types.ObjectId, - ref: 'User' - }, isTop: { type: Number, default: 0 }, + lastUser: { + type: Schema.Types.ObjectId, + ref: 'User' + }, lastReplyAt: { type: Date }, updatedAt: { type: Date }, + updatedBy: { + type: Schema.Types.ObjectId, + ref: 'User' + }, createdAt: { type: Date, default: Date.now diff --git a/modules/messages/client/directives/message-to.client.directive.js b/modules/messages/client/directives/message-to.client.directive.js index fab02b6e..57060331 100644 --- a/modules/messages/client/directives/message-to.client.directive.js +++ b/modules/messages/client/directives/message-to.client.directive.js @@ -16,26 +16,28 @@ function link(scope, element, attrs) { scope.$watch(attrs.messageTo, function (s) { - var user = s; - var to = user._id + '|' + user.displayName; - var title = $translate.instant('MESSAGE_TO_ICON_TITLE'); - var e = $compile('')(scope); + if(s) { + var user = s; + var to = user._id + '|' + user.displayName; + var title = $translate.instant('MESSAGE_TO_ICON_TITLE'); + var e = $compile('')(scope); - e.attr('title', title); + e.attr('title', title); - if (attrs.toClass) { - e.addClass(attrs.toClass); - } else { - e.css('font-size', '12px'); - e.css('margin-left', '10px'); - } - - if (element[0].firstChild) { - if (element[0].firstChild.nodeName === '#text') { - angular.element(element[0].firstChild).after(e); + if (attrs.toClass) { + e.addClass(attrs.toClass); + } else { + e.css('font-size', '12px'); + e.css('margin-left', '10px'); + } + + if (element[0].firstChild) { + if (element[0].firstChild.nodeName === '#text') { + angular.element(element[0].firstChild).after(e); + } + } else { + angular.element(element[0]).append(e); } - } else { - angular.element(element[0]).append(e); } }); }