mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 20:24:05 -06:00
Change composer error message when title is too long or too short, and make sure the submit button is 'disabled' when title is too long
This commit is contained in:
parent
e2774cc2df
commit
ada79260b3
@ -164,7 +164,9 @@ Discourse.Composer = Discourse.Model.extend({
|
|||||||
// - creating a new topic
|
// - creating a new topic
|
||||||
// - editing the 1st post
|
// - editing the 1st post
|
||||||
// - creating a private message
|
// - creating a private message
|
||||||
if (this.get('editTitle') && this.get('titleLength') < Discourse.SiteSettings.min_topic_title_length) return true;
|
if (this.get('editTitle') &&
|
||||||
|
(this.get('titleLength') < Discourse.SiteSettings.min_topic_title_length ||
|
||||||
|
this.get('titleLength') > Discourse.SiteSettings.max_topic_title_length) ) return true;
|
||||||
|
|
||||||
// Need at least one user when sending a private message
|
// Need at least one user when sending a private message
|
||||||
if (this.get('creatingPrivateMessage') && (this.get('targetUsernames').trim() + ',').indexOf(',') === 0) return true;
|
if (this.get('creatingPrivateMessage') && (this.get('targetUsernames').trim() + ',').indexOf(',') === 0) return true;
|
||||||
|
@ -375,8 +375,10 @@ Discourse.ComposerView = Discourse.View.extend({
|
|||||||
var title = this.get('content.title'), reason;
|
var title = this.get('content.title'), reason;
|
||||||
if( !title || title.length < 1 ){
|
if( !title || title.length < 1 ){
|
||||||
reason = Em.String.i18n('composer.error.title_missing');
|
reason = Em.String.i18n('composer.error.title_missing');
|
||||||
} else if( title.length < Discourse.SiteSettings.min_topic_title_length || title.length > Discourse.SiteSettings.max_topic_title_length ) {
|
} else if( title.length < Discourse.SiteSettings.min_topic_title_length ) {
|
||||||
reason = Em.String.i18n('composer.error.title_length', {min: Discourse.SiteSettings.min_topic_title_length, max: Discourse.SiteSettings.max_topic_title_length})
|
reason = Em.String.i18n('composer.error.title_too_short', {min: Discourse.SiteSettings.min_topic_title_length})
|
||||||
|
} else if( title.length > Discourse.SiteSettings.max_topic_title_length ) {
|
||||||
|
reason = Em.String.i18n('composer.error.title_too_long', {max: Discourse.SiteSettings.max_topic_title_length})
|
||||||
}
|
}
|
||||||
|
|
||||||
if( reason ) {
|
if( reason ) {
|
||||||
|
@ -340,7 +340,8 @@ en:
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
title_missing: "Title is required."
|
title_missing: "Title is required."
|
||||||
title_length: "Title needs between {{min}} and {{max}} characters."
|
title_too_short: "Title must be at least {{min}} characters long."
|
||||||
|
title_too_long: "Title must be less than {{max}} characters long."
|
||||||
post_missing: "Post can't be empty."
|
post_missing: "Post can't be empty."
|
||||||
post_length: "Post must be at least {{min}} characters long."
|
post_length: "Post must be at least {{min}} characters long."
|
||||||
category_missing: "You must choose a category."
|
category_missing: "You must choose a category."
|
||||||
|
Loading…
Reference in New Issue
Block a user