feat(forums): add forum topic title & content & reply length limit.

This commit is contained in:
OldHawk
2017-12-14 10:35:36 +08:00
parent 3a29d5c0d7
commit b5b1e7ec0b
6 changed files with 17 additions and 13 deletions

View File

@@ -276,11 +276,17 @@ module.exports = {
* @messageMaxLength
*/
inputLength: {
userSignatureLength: 512,
chatMessageMaxLength: 512,
messageBoxContentLength: 1024,
messageBoxReplyLength: 512,
userSignatureLength: 512,
torrentCommentLength: 512
torrentCommentLength: 512,
forumTopicTitleLength: 128,
forumTopicContentLength: 4096,
forumReplyContentLength: 2048
},
/**

View File

@@ -115,7 +115,7 @@
border-radius: 4px;
background-color: #2a2a2a;
padding: 10px 0 15px 0;
margin: 20px 0 0 0;
margin: 0 0 20px;
overflow: hidden;
.fa-5x {

View File

@@ -12,6 +12,7 @@
marked, $stateParams, TopicsService) {
var vm = this;
vm.forumsConfig = MeanTorrentConfig.meanTorrentConfig.forumsConfig;
vm.inputLengthConfig = MeanTorrentConfig.meanTorrentConfig.inputLength;
vm.user = Authentication.user;
vm.forumPath = [];

View File

@@ -15,6 +15,7 @@
var vm = this;
vm.DLS = DownloadService;
vm.forumsConfig = MeanTorrentConfig.meanTorrentConfig.forumsConfig;
vm.inputLengthConfig = MeanTorrentConfig.meanTorrentConfig.inputLength;
vm.announce = MeanTorrentConfig.meanTorrentConfig.announce;
vm.scoreConfig = MeanTorrentConfig.meanTorrentConfig.score;
vm.itemsPerPageConfig = MeanTorrentConfig.meanTorrentConfig.itemsPerPage;
@@ -482,14 +483,10 @@
* beginPostReply
*/
vm.beginPostReply = function () {
vm.scrollToReply = true;
$('#postReplyContent').focus();
$timeout(function () {
$('#postReplyContent').scrollTop($('#postReplyContent')[0].scrollHeight);
}, 100);
$timeout(function () {
vm.scrollToReply = false;
}, 500);
$('html,body').animate({scrollTop: $('#post-new-reply-table')[0].offsetTop - 60}, 200);
}, 10);
};
/**

View File

@@ -21,7 +21,7 @@
<div class="form-group" show-errors>
<input id="postTitle" name="postTitle"
class="form-control margin-bottom-10" ng-model="vm.postFields.title" type="text"
placeholder="{{'FORUMS.FIELDS.TITLE' | translate}}" required autofocus>
placeholder="{{'FORUMS.FIELDS.TITLE' | translate}}" maxlength="{{vm.inputLengthConfig.forumTopicTitleLength}}" required autofocus>
<div ng-messages="vm.postForm.postTitle.$error" role="alert">
<p class="help-block error-text" ng-message="required">{{ 'FORUMS.PT_REQUIRED' | translate}}</p>
@@ -30,7 +30,7 @@
<div class="form-group" show-errors>
<textarea id="postContent" name="postContent" class="autocomplete" ng-model="vm.postFields.content"
mt-markdown-editor="postContent"
mt-markdown-editor="postContent" maxlength="{{vm.inputLengthConfig.forumTopicContentLength}}"
upload-dir="/modules/forums/client/attach/temp/"
upload-method="vm.uploadAttach(editor, ufile, progressback, callback, errback);" required></textarea>

View File

@@ -250,7 +250,7 @@
</ul>
</div>
<div class="table-responsive table-category" scroll-if="vm.scrollToReply" ng-if="!vm.topic.readOnly || vm.canEdit(vm.topic)">
<div class="table-responsive table-category" id="post-new-reply-table" scroll-if="vm.scrollToReply" ng-if="!vm.topic.readOnly || vm.canEdit(vm.topic)">
<table class="table table-valign-middle margin-bottom-10">
<thead>
<tr>
@@ -268,7 +268,7 @@
<form name="vm.replyForm" ng-submit="vm.postReply(vm.replyForm.$valid)" novalidate autocomplete="off">
<div class="form-group" show-errors>
<textarea id="postReplyContent" name="postReplyContent" class="autocomplete" ng-model="vm.postReplyFields.content"
mt-markdown-editor="postReplyContent"
mt-markdown-editor="postReplyContent" maxlength="{{vm.inputLengthConfig.forumReplyContentLength}}"
upload-dir="/modules/forums/client/attach/temp/"
upload-method="vm.uploadAttach(editor, ufile, progressback, callback, errback);" required></textarea>