diff --git a/app/assets/javascripts/app/controllers/_profile/language.js.coffee b/app/assets/javascripts/app/controllers/_profile/language.js.coffee index 70aae6ec2..6a4869c8c 100644 --- a/app/assets/javascripts/app/controllers/_profile/language.js.coffee +++ b/app/assets/javascripts/app/controllers/_profile/language.js.coffee @@ -50,7 +50,6 @@ class Index extends App.Controller => App.i18n.set( @locale ) App.Event.trigger( 'ui:rerender' ) - App.Event.trigger( 'ui:page:rerender' ) @notify( type: 'success' msg: App.i18n.translateContent( 'Successfully!' ) diff --git a/app/assets/javascripts/app/controllers/_profile/notification.js.coffee b/app/assets/javascripts/app/controllers/_profile/notification.js.coffee index 25e0159d1..112707ba7 100644 --- a/app/assets/javascripts/app/controllers/_profile/notification.js.coffee +++ b/app/assets/javascripts/app/controllers/_profile/notification.js.coffee @@ -129,7 +129,6 @@ class Index extends App.Controller App.Session.get( 'id' ), => App.Event.trigger( 'ui:rerender' ) - App.Event.trigger( 'ui:page:rerender' ) @notify( type: 'success' msg: App.i18n.translateContent( 'Successfully!' ) diff --git a/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee b/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee index b993aa514..5241b747d 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee @@ -37,6 +37,11 @@ class App.TicketCreate extends App.Controller @log 'notice', 'error', defaults @render(defaults) + # rerender view, e. g. on langauge change + @bind 'ui:rerender', => + return if !@authenticate(true) + @render() + changeFormType: (e) => type = $(e.target).data('type') if !type diff --git a/app/assets/javascripts/app/controllers/dashboard.js.coffee b/app/assets/javascripts/app/controllers/dashboard.js.coffee index 6a69bb761..5c933c2e6 100644 --- a/app/assets/javascripts/app/controllers/dashboard.js.coffee +++ b/app/assets/javascripts/app/controllers/dashboard.js.coffee @@ -53,6 +53,11 @@ class App.Dashboard extends App.Controller # render page @render() + # rerender view, e. g. on langauge change + @bind 'ui:rerender', => + return if !@authenticate(true) + @render() + render: -> @html App.view('dashboard')( @@ -83,7 +88,7 @@ class App.Dashboard extends App.Controller renderWidgetClockFace: (time) => canvas = @el.find 'canvas' - ctx = canvas.get(0).getContext '2d' + ctx = canvas.get(0).getContext '2d' radius = 26 @el.find('.time.stat-widget .stat-amount').text time diff --git a/app/assets/javascripts/app/controllers/navigation.js.coffee b/app/assets/javascripts/app/controllers/navigation.js.coffee index 58cb9c5f2..90e33563d 100644 --- a/app/assets/javascripts/app/controllers/navigation.js.coffee +++ b/app/assets/javascripts/app/controllers/navigation.js.coffee @@ -5,7 +5,7 @@ class App.Navigation extends App.Controller super @render() - # rerender view + # rerender view, e. g. on langauge change @bind 'ui:rerender', (data) => @renderMenu() @renderPersonal() diff --git a/app/assets/javascripts/app/controllers/organization_profile.js.coffee b/app/assets/javascripts/app/controllers/organization_profile.js.coffee index 9e0449e6b..390ed6b66 100644 --- a/app/assets/javascripts/app/controllers/organization_profile.js.coffee +++ b/app/assets/javascripts/app/controllers/organization_profile.js.coffee @@ -7,11 +7,14 @@ class App.OrganizationProfile extends App.Controller App.TaskManager.remove( @task_key ) return - @navupdate '#' - # fetch new data if needed App.Organization.full( @organization_id, @render ) + # rerender view, e. g. on langauge change + @bind 'ui:rerender', => + return if !@authenticate(true) + @render( App.Organization.fullLocal( @organization_id ) ) + meta: => meta = url: @url() diff --git a/app/assets/javascripts/app/controllers/ticket_overview.js.coffee b/app/assets/javascripts/app/controllers/ticket_overview.js.coffee index 9d2997eb5..91e0dd767 100644 --- a/app/assets/javascripts/app/controllers/ticket_overview.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_overview.js.coffee @@ -102,6 +102,11 @@ class Table extends App.Controller @bind 'ticket_overview_local', => @render(true) + # rerender view, e. g. on langauge change + @bind 'ui:rerender', => + return if !@authenticate(true) + @render() + update: (params) => for key, value of params @[key] = value diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee index 54dbaae29..64114788c 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee @@ -53,6 +53,11 @@ class App.TicketZoom extends App.Controller @delay( update, 1800, 'ticket-zoom-' + @ticket_id ) ) + # rerender view, e. g. on langauge change + @bind 'ui:rerender', => + return if !@authenticate(true) + @render(true) + meta: => # default attributes @@ -239,7 +244,7 @@ class App.TicketZoom extends App.Controller App.Event.trigger 'task:render' @formEnable( @$('.submit') ) - if !@renderDone + if force || !@renderDone @renderDone = true @html App.view('ticket_zoom')( ticket: @ticket diff --git a/app/assets/javascripts/app/controllers/user_profile.js.coffee b/app/assets/javascripts/app/controllers/user_profile.js.coffee index d8896a41a..f5826e88b 100644 --- a/app/assets/javascripts/app/controllers/user_profile.js.coffee +++ b/app/assets/javascripts/app/controllers/user_profile.js.coffee @@ -7,11 +7,14 @@ class App.UserProfile extends App.Controller App.TaskManager.remove( @task_key ) return - @navupdate '#' - # fetch new data if needed @subscribeId = App.User.full( @user_id, @render ) + # rerender view, e. g. on langauge change + @bind 'ui:rerender', => + return if !@authenticate(true) + @render( App.User.fullLocal( @user_id ) ) + release: => App.User.unsubscribe(@subscribeId) diff --git a/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee b/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee index df50eba05..1d896b6b0 100644 --- a/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee @@ -91,13 +91,6 @@ class App.Content extends App.Controller new callback( params ) controller( params ) - # rerender view on ui:rerender event - App.Event.bind( - 'ui:page:rerender', => - controller( params ) - 'page' - ) - # scroll to top / remember last screen position # @scrollTo( 0, 0, 100 ) ) diff --git a/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee b/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee index 088af5e25..2c662b75d 100644 --- a/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee @@ -68,19 +68,13 @@ class _taskManagerSingleton extends Spine.Module @el = params.el else @el = $('#app') - @offlineModus = params.offlineModus - @workers = {} - @workersStarted = {} - @allTasks = [] - @tasksToUpdate = {} - @activeTaskHistory = [] + @offlineModus = params.offlineModus @tasksInitial() # render on login App.Event.bind( 'auth:login' => - @reset() @tasksInitial() 'task' ) @@ -96,6 +90,14 @@ class _taskManagerSingleton extends Spine.Module # send updates to server App.Interval.set( @taskUpdateLoop, 2500, 'check_update_to_server_pending', 'task' ) + init: -> + @workers = {} + @workersStarted = {} + @tasksStarted = {} + @allTasks = [] + @tasksToUpdate = {} + @activeTaskHistory = [] + all: -> # sort by prio @@ -125,6 +127,12 @@ class _taskManagerSingleton extends Spine.Module # input validation params.key = App.Utils.htmlAttributeCleanup(params.key) + # remember started task / prevent to open task twice + createNewTask = true + if @tasksStarted[params.key] + createNewTask = false + @tasksStarted[params.key] = true + # if we have init task startups, let the controller know this if params.init params.params.init = true @@ -138,13 +146,14 @@ class _taskManagerSingleton extends Spine.Module if params.show @activeTaskHistory.push _.clone(params) - # create new task if not exists + # check if task already exists in storage / e. g. from last session task = @get( params.key ) + #console.log 'debug', 'execute', params, 'task', task # create new online task if not exists and if not persistent - if !task && !params.persistent - @log 'debug', 'add, create new taskbar in backend' + if !task && createNewTask && !params.persistent + #console.log 'debug', 'add, create new taskbar in backend' task = new App.Taskbar task.load( key: params.key @@ -286,6 +295,10 @@ class _taskManagerSingleton extends Spine.Module # remove task certain task from tasks remove: ( key ) => + + # remember started task + delete @tasksStarted[key] + task = @get( key ) return if !task @@ -337,6 +350,7 @@ class _taskManagerSingleton extends Spine.Module delete @workersStarted[ key ] delete @workers[ key ] + delete @tasksStarted[ key ] # reset while tasks reset: => @@ -350,9 +364,7 @@ class _taskManagerSingleton extends Spine.Module @release(key) # clear instance vars - @tasksToUpdate = {} - @allTasks = [] - @activeTaskHistory = [] + @init() # clear in mem tasks App.Taskbar.deleteAll() @@ -434,10 +446,10 @@ class _taskManagerSingleton extends Spine.Module return tasksInitial: => + @init() # set taskbar collection stored in database - tasks = App.Taskbar.all() - @allTasks = [] + tasks = App.Taskbar.all() for task in tasks @allTasks.push task.attributes() diff --git a/app/assets/javascripts/app/views/dashboard.jst.eco b/app/assets/javascripts/app/views/dashboard.jst.eco index 07d1f6902..d1c962f43 100644 --- a/app/assets/javascripts/app/views/dashboard.jst.eco +++ b/app/assets/javascripts/app/views/dashboard.jst.eco @@ -1,8 +1,8 @@