for some reason people seem to not understand why you can not submit close to empty posts, fix that

This commit is contained in:
Sam Saffron 2013-02-15 12:20:00 +11:00
parent e94b6e7796
commit 6132373fab
2 changed files with 20 additions and 7 deletions

View file

@ -335,14 +335,16 @@ window.Discourse.Composer = Discourse.Model.extend
saveDraft: ->
return if @disableDrafts
return if @get('disableDrafts')
return unless @get('reply')
return if @get('reply').length < Discourse.SiteSettings.min_post_length
data =
reply: @get("reply"),
action: @get("action"),
title: @get("title"),
categoryName: @get("categoryName"),
postId: @get("post.id"),
reply: @get('reply'),
action: @get('action'),
title: @get('title'),
categoryName: @get('categoryName'),
postId: @get('post.id'),
archetypeId: @get('archetypeId')
metaData: @get('metaData')
usernames: @get('targetUsernames')
@ -356,6 +358,13 @@ window.Discourse.Composer = Discourse.Model.extend
)
resetDraftStatus: (->
reply = @get('reply')
len = Discourse.SiteSettings.min_post_length
if !reply
@set('draftStatus', Em.String.i18n('composer.min_length.at_least', n: len))
else if reply.length < len
@set('draftStatus', Em.String.i18n('composer.min_length.more', n: len - reply.length))
else
@set('draftStatus', null)
).observes('reply','title')

View file

@ -244,6 +244,10 @@ en:
saved_draft_tip: "saved"
saved_local_draft_tip: "saved locally"
min_length:
at_least: "enter at least {{n}} characters"
more: "{{n}} to go..."
save_edit: "Save Edit"
reply: "Reply"
create_topic: "Create Topic"