diff --git a/app/assets/javascripts/discourse/controllers/composer.js.es6 b/app/assets/javascripts/discourse/controllers/composer.js.es6 index c39b58a55b3..6334be90d48 100644 --- a/app/assets/javascripts/discourse/controllers/composer.js.es6 +++ b/app/assets/javascripts/discourse/controllers/composer.js.es6 @@ -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', []); diff --git a/app/assets/javascripts/discourse/controllers/topic_controller.js b/app/assets/javascripts/discourse/controllers/topic_controller.js index bb6600545f8..6b9eb6abf6c 100644 --- a/app/assets/javascripts/discourse/controllers/topic_controller.js +++ b/app/assets/javascripts/discourse/controllers/topic_controller.js @@ -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'), diff --git a/app/assets/javascripts/discourse/templates/composer.js.handlebars b/app/assets/javascripts/discourse/templates/composer.js.handlebars index 66a0dd3d219..f5ed48bd2ef 100644 --- a/app/assets/javascripts/discourse/templates/composer.js.handlebars +++ b/app/assets/javascripts/discourse/templates/composer.js.handlebars @@ -38,7 +38,7 @@ {{/if}}
- {{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}}
diff --git a/app/assets/javascripts/discourse/templates/topic.js.handlebars b/app/assets/javascripts/discourse/templates/topic.js.handlebars index 7fce824a0b5..0fe6f9f5e31 100644 --- a/app/assets/javascripts/discourse/templates/topic.js.handlebars +++ b/app/assets/javascripts/discourse/templates/topic.js.handlebars @@ -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}} diff --git a/app/assets/javascripts/discourse/views/text-field.js.es6 b/app/assets/javascripts/discourse/views/text-field.js.es6 index dd791810a4a..40560b8c849 100644 --- a/app/assets/javascripts/discourse/views/text-field.js.es6 +++ b/app/assets/javascripts/discourse/views/text-field.js.es6 @@ -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')) {