Improved max length on article text (richtext).

This commit is contained in:
Martin Edenhofer 2015-12-29 20:41:08 +01:00
parent fdeca0b7b2
commit 3878c40e70
2 changed files with 18 additions and 18 deletions

View file

@ -13,7 +13,7 @@ class App.UiElement.richtext
renderAttachment = (file) => renderAttachment = (file) =>
item.find('.attachments').append( App.view('generic/attachment_item')( item.find('.attachments').append( App.view('generic/attachment_item')(
fileName: file.filename fileName: file.filename
fileSize: App.Utils.humanFileSize( file.size ) fileSize: App.Utils.humanFileSize(file.size)
store_id: file.store_id store_id: file.store_id
)) ))
item.on( item.on(
@ -30,8 +30,8 @@ class App.UiElement.richtext
# delete attachment from storage # delete attachment from storage
App.Ajax.request( App.Ajax.request(
type: 'DELETE' type: 'DELETE'
url: App.Config.get('api_path') + '/ticket_attachment_upload' url: "#{App.Config.get('api_path')}/ticket_attachment_upload"
data: JSON.stringify( { store_id: store_id } ), data: JSON.stringify(store_id: store_id),
processData: false processData: false
) )
@ -52,22 +52,22 @@ class App.UiElement.richtext
@cancelContainer = item.find('.js-cancel') @cancelContainer = item.find('.js-cancel')
u = => html5Upload.initialize( u = => html5Upload.initialize(
uploadUrl: App.Config.get('api_path') + '/ticket_attachment_upload', uploadUrl: App.Config.get('api_path') + '/ticket_attachment_upload'
dropContainer: item.closest('form').get(0), dropContainer: item.closest('form').get(0)
cancelContainer: @cancelContainer, cancelContainer: @cancelContainer
inputField: item.find( 'input' ).get(0), inputField: item.find('input').get(0)
key: 'File',
data: { form_id: item.closest('form').find('[name=form_id]').val() },
maxSimultaneousUploads: 1, maxSimultaneousUploads: 1,
onFileAdded: (file) => key: 'File'
data:
form_id: item.closest('form').find('[name=form_id]').val()
onFileAdded: (file) =>
file.on( file.on(
onStart: => onStart: =>
@attachmentPlaceholder.addClass('hide') @attachmentPlaceholder.addClass('hide')
@attachmentUpload.removeClass('hide') @attachmentUpload.removeClass('hide')
@cancelContainer.removeClass('hide') @cancelContainer.removeClass('hide')
console.log('upload start') App.Log.debug 'UiElement.richtext', 'upload start'
onAborted: => onAborted: =>
@attachmentPlaceholder.removeClass('hide') @attachmentPlaceholder.removeClass('hide')
@ -75,7 +75,6 @@ class App.UiElement.richtext
# Called after received response from the server # Called after received response from the server
onCompleted: (response) => onCompleted: (response) =>
response = JSON.parse(response) response = JSON.parse(response)
@attachments.push response.data @attachments.push response.data
@ -88,7 +87,7 @@ class App.UiElement.richtext
renderAttachment(response.data) renderAttachment(response.data)
console.log('upload complete', response.data ) App.Log.debug 'UiElement.richtext', 'upload complete', response.data
# Called during upload progress, first parameter # Called during upload progress, first parameter
# is decimal value from 0 to 100. # is decimal value from 0 to 100.
@ -98,8 +97,9 @@ class App.UiElement.richtext
# hide cancel on 90% # hide cancel on 90%
if parseInt(progress) >= 90 if parseInt(progress) >= 90
@cancelContainer.addClass('hide') @cancelContainer.addClass('hide')
console.log('uploadProgress ', parseInt(progress)) App.Log.debug 'UiElement.richtext', 'uploadProgress ', parseInt(progress)
) )
) )
App.Delay.set( u, 100, undefined, 'form_upload' ) App.Delay.set(u, 100, undefined, 'form_upload')
item item

View file

@ -153,7 +153,7 @@ class App.TicketZoomArticleNew extends App.Controller
@$('[data-name="body"]').ce({ @$('[data-name="body"]').ce({
mode: 'richtext' mode: 'richtext'
multiline: true multiline: true
maxlength: 40000 maxlength: 50000
}) })
html5Upload.initialize( html5Upload.initialize(