FIX: Limit the maxLength of the title text fields to the site setting

for the maximum length.
This commit is contained in:
Robin Ward 2014-07-21 14:29:53 -04:00
parent 4b97d8300d
commit 0175ba000f
5 changed files with 6 additions and 3 deletions

View File

@ -14,6 +14,7 @@ export default Discourse.Controller.extend({
showEditReason: false,
editReason: null,
maxTitleLength: Discourse.computed.setting('max_topic_title_length'),
_initializeSimilar: function() {
this.set('similarTopics', []);

View File

@ -7,6 +7,8 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
selectedReplies: null,
queryParams: ['filter', 'username_filters', 'show_deleted'],
maxTitleLength: Discourse.computed.setting('max_topic_title_length'),
contextChanged: function(){
this.set('controllers.search.searchContext', this.get('model.searchContext'));
}.observes('topic'),

View File

@ -38,7 +38,7 @@
{{/if}}
<div class="title-input">
{{text-field value=model.title tabindex="2" id="reply-title" maxlength="255" placeholderKey="composer.title_placeholder"}}
{{text-field value=model.title tabindex="2" id="reply-title" maxLength=maxTitleLength placeholderKey="composer.title_placeholder"}}
{{popupInputTip validation=view.titleValidation shownAt=view.showTitleTip}}
</div>

View File

@ -21,7 +21,7 @@
{{else}}
{{category-chooser valueAttribute="id" value=newCategoryId source=category_id}}
{{/if}}
{{text-field id='edit-title' value=newTitle}}
{{text-field id='edit-title' value=newTitle maxLength=maxTitleLength}}
<button class='btn btn-primary btn-small no-text' {{action finishedEditingTopic}}><i class='fa fa-check'></i></button>
<button class='btn btn-small no-text' {{action cancelEditingTopic}}><i class='fa fa-times'></i></button>

View File

@ -7,7 +7,7 @@
@module Discourse
**/
export default Ember.TextField.extend({
attributeBindings: ['autocorrect', 'autocapitalize', 'autofocus'],
attributeBindings: ['autocorrect', 'autocapitalize', 'autofocus', 'maxLength'],
placeholder: function() {
if (this.get('placeholderKey')) {