Merge branch 'develop' of github.com:martini/zammad into develop

This commit is contained in:
Felix Niklas 2015-11-04 12:47:21 +01:00
commit 6afd5d5432
3 changed files with 35 additions and 7 deletions

View file

@ -415,6 +415,14 @@ class App.TicketZoom extends App.Controller
currentParams = currentParams =
ticket: @formParam( @el.find('.edit') ) ticket: @formParam( @el.find('.edit') )
article: @formParam( @el.find('.article-add') ) article: @formParam( @el.find('.article-add') )
# add attachments if exist
attachmentCount = @$('.article-add .textBubble .attachments .attachment').length
if attachmentCount > 0
currentParams.article.attachments = true
else
delete currentParams.article.attachments
#console.log('lll', currentStore) #console.log('lll', currentStore)
# remove not needed attributes # remove not needed attributes
delete currentParams.article.form_id delete currentParams.article.form_id
@ -650,6 +658,14 @@ class App.TicketZoom extends App.Controller
# reset task # reset task
@taskReset() @taskReset()
# reset/delete uploaded attachments
App.Ajax.request(
type: 'DELETE'
url: App.Config.get('api_path') + '/ticket_attachment_upload'
data: JSON.stringify( { form_id: @form_id } )
processData: false
)
# reset edit ticket / reset new article # reset edit ticket / reset new article
App.Event.trigger('ui::ticket::taskReset', { ticket_id: @ticket.id }) App.Event.trigger('ui::ticket::taskReset', { ticket_id: @ticket.id })

View file

@ -371,7 +371,7 @@ class App.TicketZoomArticleNew extends App.Controller
openTextarea: (event, withoutAnimation) => openTextarea: (event, withoutAnimation) =>
if @articleNewEdit.hasClass('is-open') if @articleNewEdit.hasClass('is-open')
return return
duration = 300 duration = 300
if withoutAnimation if withoutAnimation
@ -517,7 +517,7 @@ class App.TicketZoomArticleNew extends App.Controller
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
) )

View file

@ -66,12 +66,24 @@ class TicketArticlesController < ApplicationController
# DELETE /ticket_attachment_upload # DELETE /ticket_attachment_upload
def ticket_attachment_upload_delete def ticket_attachment_upload_delete
Store.remove_item( params[:store_id] ) if params[:store_id]
Store.remove_item(params[:store_id])
render json: {
success: true,
}
return
elsif params[:form_id]
Store.remove(
object: 'UploadCache',
o_id: params[:form_id],
)
render json: {
success: true,
}
return
end
# return result render json: { message: 'No such store_id or form_id!' }, status: :unprocessable_entity
render json: {
success: true,
}
end end
# POST /ticket_attachment_upload # POST /ticket_attachment_upload