diff --git a/app/assets/javascripts/app/controllers/_application_controller.coffee b/app/assets/javascripts/app/controllers/_application_controller.coffee index 804efc241..484231493 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.coffee @@ -555,6 +555,13 @@ class App.Controller extends Spine.Controller renderScreenUnauthorized: (data) -> @html App.view('generic/error/unauthorized')(data) + metaTaskUpdate: => + App.Delay.set( + -> App.Event.trigger 'task:render' + 250 + 'meta-task-update' + ) + class App.ControllerPermanent extends App.Controller constructor: -> super @@ -723,13 +730,13 @@ class App.UpdateHeader extends App.Controller super # subscribe and reload data / fetch new data if triggered - @subscribeId = @genericObject.subscribe( @render ) + @subscribeId = @genericObject.subscribe(@render) release: => App[ @genericObject.constructor.className ].unsubscribe(@subscribeId) render: (genericObject) => - @el.find( '.page-header h1' ).html( genericObject.displayName() ) + @el.find('.page-header h1').html(genericObject.displayName()) class App.UpdateTastbar extends App.Controller @@ -737,15 +744,15 @@ class App.UpdateTastbar extends App.Controller super # subscribe and reload data / fetch new data if triggered - @subscribeId = @genericObject.subscribe( @update ) + @subscribeId = @genericObject.subscribe(@update) release: => App[ @genericObject.constructor.className ].unsubscribe(@subscribeId) - update: (genericObject) -> + update: (genericObject) => # update taskbar with new meta data - App.Event.trigger 'task:render' + @metaTaskUpdate() class App.ControllerWidgetPermanent extends App.Controller constructor: (params) -> diff --git a/app/assets/javascripts/app/controllers/agent_ticket_create.coffee b/app/assets/javascripts/app/controllers/agent_ticket_create.coffee index 746ea52ef..2d7b47ccc 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_create.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_create.coffee @@ -302,6 +302,9 @@ class App.TicketCreate extends App.Controller # start auto save @autosave() + # update taskbar with new meta data + @metaTaskUpdate() + localUserInfo: (e) => params = App.ControllerForm.params( $(e.target).closest('form') ) diff --git a/app/assets/javascripts/app/controllers/organization_profile.coffee b/app/assets/javascripts/app/controllers/organization_profile.coffee index 3ccd2d5f0..c0557a383 100644 --- a/app/assets/javascripts/app/controllers/organization_profile.coffee +++ b/app/assets/javascripts/app/controllers/organization_profile.coffee @@ -78,6 +78,9 @@ class Object extends App.Controller render: (organization) => + # update taskbar with new meta data + @metaTaskUpdate() + # get display data organizationData = [] for attributeName, attributeConfig of App.Organization.attributesGet('view') diff --git a/app/assets/javascripts/app/controllers/taskbar_widget.coffee b/app/assets/javascripts/app/controllers/taskbar_widget.coffee index 4f5cc7380..0470ec61a 100644 --- a/app/assets/javascripts/app/controllers/taskbar_widget.coffee +++ b/app/assets/javascripts/app/controllers/taskbar_widget.coffee @@ -22,7 +22,7 @@ class App.TaskbarWidget extends App.Controller return if !@Session.get() tasks = App.TaskManager.all() - item_list = [] + taskItems = [] for task in tasks # collect meta data of task for task bar item @@ -32,7 +32,7 @@ class App.TaskbarWidget extends App.Controller iconClass: 'loading' title: App.i18n.translateInline('Loading...') head: App.i18n.translateInline('Loading...') - worker = App.TaskManager.worker( task.key ) + worker = App.TaskManager.worker(task.key) if worker meta = worker.meta() @@ -45,14 +45,14 @@ class App.TaskbarWidget extends App.Controller item = {} item.task = task item.data = data - item_list.push item + taskItems.push item # set title if task.active @title data.title @html App.view('task_widget_tasks')( - item_list: item_list + taskItems: taskItems ) dndOptions = @@ -69,9 +69,9 @@ class App.TaskbarWidget extends App.Controller if !key throw 'No such key attributes found for task item' order.push key - App.TaskManager.reorder( order ) + App.TaskManager.reorder(order) - @el.sortable( dndOptions ) + @el.sortable(dndOptions) remove: (e, key = false, force = false) => e.preventDefault() diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.coffee index 87b35f944..9902e3cab 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.coffee @@ -208,8 +208,8 @@ class App.TicketZoom extends App.Controller objectName: 'Ticket' ) - # update current task title - App.Event.trigger 'task:render' + # update taskbar with new meta data + @metaTaskUpdate() ) @@ -278,7 +278,8 @@ class App.TicketZoom extends App.Controller render: => # update taskbar with new meta data - App.Event.trigger 'task:render' + @metaTaskUpdate() + @formEnable( @$('.submit') ) if !@renderDone diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/title.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/title.coffee index b44ef7bd8..a91075af8 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/title.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/title.coffee @@ -51,7 +51,7 @@ class App.TicketZoomTitle extends App.Controller App.TaskManager.mute(@task_key) # update taskbar with new meta data - App.Event.trigger 'task:render' + @metaTaskUpdate() release: => App.Ticket.unsubscribe(@subscribeId) diff --git a/app/assets/javascripts/app/controllers/user_profile.coffee b/app/assets/javascripts/app/controllers/user_profile.coffee index 815c54823..bc1c4897f 100644 --- a/app/assets/javascripts/app/controllers/user_profile.coffee +++ b/app/assets/javascripts/app/controllers/user_profile.coffee @@ -81,6 +81,9 @@ class Object extends App.Controller render: (user) => + # update taskbar with new meta data + @metaTaskUpdate() + # get display data userData = [] for attributeName, attributeConfig of App.User.attributesGet('view') diff --git a/app/assets/javascripts/app/lib/app_post/task_manager.coffee b/app/assets/javascripts/app/lib/app_post/task_manager.coffee index 009805abc..b42ab1523 100644 --- a/app/assets/javascripts/app/lib/app_post/task_manager.coffee +++ b/app/assets/javascripts/app/lib/app_post/task_manager.coffee @@ -64,7 +64,7 @@ class App.TaskManager _instance ?= new _taskManagerSingleton _instance.TaskbarId() -class _taskManagerSingleton extends Spine.Module +class _taskManagerSingleton extends App.Controller @include App.LogInclude constructor: (params = {}) -> @@ -217,7 +217,7 @@ class _taskManagerSingleton extends Spine.Module @startController(params) if !params.init - App.Event.trigger 'task:render' + @metaTaskUpdate() startController: (params) => @@ -324,7 +324,7 @@ class _taskManagerSingleton extends Spine.Module # rerender taskbar if rerender - App.Event.trigger 'task:render' + @metaTaskUpdate() # destroy in backend storage @taskDestroy(task) @@ -387,7 +387,7 @@ class _taskManagerSingleton extends Spine.Module App.Taskbar.deleteAll() # rerender task bar - App.Event.trigger 'task:render' + @metaTaskUpdate() nextTaskUrl: => @@ -418,7 +418,7 @@ class _taskManagerSingleton extends Spine.Module taskUpdate: (task) -> #@log 'notice', "UPDATE task #{task.id}", task @tasksToUpdate[ task.key ] = 'toUpdate' - App.Event.trigger 'task:render' + @metaTaskUpdate() taskUpdateLoop: => return if @offlineModus diff --git a/app/assets/javascripts/app/views/task_widget_tasks.jst.eco b/app/assets/javascripts/app/views/task_widget_tasks.jst.eco index fa1456bb6..050af9961 100644 --- a/app/assets/javascripts/app/views/task_widget_tasks.jst.eco +++ b/app/assets/javascripts/app/views/task_widget_tasks.jst.eco @@ -1,4 +1,4 @@ -<% for item in @item_list: %> +<% for item in @taskItems: %>