From 718263afd110e39f6e24c2971d1b15eea2c5720d Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 3 Jun 2016 15:24:42 +0200 Subject: [PATCH] Improved autosave. Also moved to event based auto save for ticket creation. --- .../javascripts/app/controllers/agent_ticket_create.coffee | 5 ++++- app/assets/javascripts/app/controllers/ticket_zoom.coffee | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/app/controllers/agent_ticket_create.coffee b/app/assets/javascripts/app/controllers/agent_ticket_create.coffee index 57aba6707..afc05b72f 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_create.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_create.coffee @@ -142,7 +142,10 @@ class App.TicketCreate extends App.Controller @latestTitle = title App.TaskManager.touch(@task_key) - @interval(update, 3000, @id) + @el.on('change.local blur.local keyup.local paste.local input.local', 'form, .js-textarea', (e) => + @delay(update, 250, 'ticket-create-form-update') + ) + @delay(update, 800, 'ticket-create-form-update') # get data / in case also ticket data for split buildScreen: (params) => diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.coffee index f93993b8c..313e88d81 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.coffee @@ -100,7 +100,7 @@ class App.TicketZoom extends App.Controller @activeState = true # start autosave - @delay(@autosaveStart, 800, "ticket-zoom-auto-save-#{@ticket_id}") + @autosaveStart() # if ticket is shown the first time if !@shown @@ -428,6 +428,7 @@ class App.TicketZoom extends App.Controller @el.on('change.local blur.local keyup.local paste.local input.local', 'form, .js-textarea', (e) => @delay(update, 250, 'ticket-zoom-form-update') ) + @delay(update, 800, 'ticket-zoom-form-update') currentStore: => return if !@ticket