empty() .attachment (remove spaces) to keep css working, thanks @mrflix :-o

This commit is contained in:
Martin Edenhofer 2014-10-07 20:05:50 +02:00
parent 0521aeed11
commit 94a9b5e004
2 changed files with 18 additions and 2 deletions

View file

@ -730,6 +730,8 @@ class App.ControllerForm extends App.Controller
item item
) )
store_id = $(e.currentTarget).data('id') store_id = $(e.currentTarget).data('id')
# 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'
@ -737,7 +739,13 @@ class App.ControllerForm extends App.Controller
processData: false processData: false
success: (data, status, xhr) => success: (data, status, xhr) =>
) )
$(e.currentTarget).closest('.attachment').empty()
# remove attachment from dom
element = $(e.currentTarget).closest('.attachments')
$(e.currentTarget).closest('.attachment').remove()
# empty .attachment (remove spaces) to keep css working, thanks @mrflix :-o
if element.find('.attachment').length == 0
element.empty()
) )
@attachments = [] @attachments = []

View file

@ -1089,6 +1089,8 @@ class Edit extends App.Controller
item item
) )
store_id = $(e.currentTarget).data('id') store_id = $(e.currentTarget).data('id')
# 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'
@ -1096,7 +1098,13 @@ class Edit extends App.Controller
processData: false processData: false
success: (data, status, xhr) => success: (data, status, xhr) =>
) )
$(e.currentTarget).closest('.attachment').empty()
# remove attachment from dom
element = $(e.currentTarget).closest('.attachments')
$(e.currentTarget).closest('.attachment').remove()
# empty .attachment (remove spaces) to keep css working, thanks @mrflix :-o
if element.find('.attachment').length == 0
element.empty()
) )
reset: (e) => reset: (e) =>