Introduced @show and @hide to controller which are executed on show/hide of controller.

This commit is contained in:
Martin Edenhofer 2014-11-01 14:04:22 +01:00
parent 9ee8d60eb5
commit d54b7bbfc8
5 changed files with 25 additions and 22 deletions

View file

@ -104,7 +104,7 @@ class App.TicketCreate extends App.Controller
url: => url: =>
'#ticket/create/id/' + @id '#ticket/create/id/' + @id
activate: => show: =>
@navupdate '#' @navupdate '#'
changed: => changed: =>

View file

@ -31,7 +31,7 @@ class App.OrganizationZoom extends App.Controller
url: => url: =>
'#organization/zoom/' + @organization_id '#organization/zoom/' + @organization_id
activate: => show: =>
App.OnlineNotification.seen( 'Organization', @organization_id ) App.OnlineNotification.seen( 'Organization', @organization_id )
@navupdate '#' @navupdate '#'

View file

@ -40,9 +40,6 @@ class App.TicketZoom extends App.Controller
@delay( update, 1800, 'ticket-zoom-' + @ticket_id ) @delay( update, 1800, 'ticket-zoom-' + @ticket_id )
) )
@bind "task:hide", @onHide
@bind "task:show", @onShow
meta: => meta: =>
meta = meta =
url: @url() url: @url()
@ -58,9 +55,15 @@ class App.TicketZoom extends App.Controller
url: => url: =>
'#ticket/zoom/' + @ticket_id '#ticket/zoom/' + @ticket_id
activate: => show: =>
App.OnlineNotification.seen( 'Ticket', @ticket_id ) App.OnlineNotification.seen( 'Ticket', @ticket_id )
@navupdate '#' @navupdate '#'
if @scrollHeader
@scrollHeader.continue()
hide: =>
if @scrollHeader
@scrollHeader.pause()
changed: => changed: =>
formCurrent = @formParam( @el.find('.edit') ) formCurrent = @formParam( @el.find('.edit') )
@ -407,14 +410,6 @@ class App.TicketZoom extends App.Controller
forceHeight: false forceHeight: false
holder: @main.get(0) holder: @main.get(0)
onShow: =>
if @scrollHeader
@scrollHeader.continue()
onHide: =>
if @scrollHeader
@scrollHeader.pause()
autosaveStop: => autosaveStop: =>
@autosaveLast = {} @autosaveLast = {}
@clearInterval( 'autosave' ) @clearInterval( 'autosave' )

View file

@ -30,7 +30,7 @@ class App.UserZoom extends App.Controller
url: => url: =>
'#user/zoom/' + @user_id '#user/zoom/' + @user_id
activate: => show: =>
App.OnlineNotification.seen( 'User', @user_id ) App.OnlineNotification.seen( 'User', @user_id )
@navupdate '#' @navupdate '#'

View file

@ -206,12 +206,8 @@ class _taskManagerSingleton extends App.Controller
# return if controller is already started # return if controller is already started
if @workersStarted[key] if @workersStarted[key]
if !to_not_show
# activate existing controller @showController( key, params_app )
worker = @worker( key )
if worker && worker.activate && !to_not_show
worker.activate(params_app)
App.Event.trigger('ui:rerender:task')
return return
@workersStarted[key] = true @workersStarted[key] = true
@ -222,10 +218,22 @@ class _taskManagerSingleton extends App.Controller
# activate controller # activate controller
if !to_not_show if !to_not_show
a.activate(params_app) @showController( key, params_app )
return a return a
showController: ( thisKey, params_app ) =>
for key of @workersStarted
controller = @workers[ key ]
if controller
if key is thisKey
if controller.show
controller.show(params_app)
App.Event.trigger('ui:rerender:task')
else
if controller.hide
controller.hide()
get: ( key ) => get: ( key ) =>
for task in @allTasks for task in @allTasks
if task.key is key if task.key is key