Introduced @show and @hide to controller which are executed on show/hide of controller.
This commit is contained in:
parent
9ee8d60eb5
commit
d54b7bbfc8
5 changed files with 25 additions and 22 deletions
|
@ -104,7 +104,7 @@ class App.TicketCreate extends App.Controller
|
|||
url: =>
|
||||
'#ticket/create/id/' + @id
|
||||
|
||||
activate: =>
|
||||
show: =>
|
||||
@navupdate '#'
|
||||
|
||||
changed: =>
|
||||
|
|
|
@ -31,7 +31,7 @@ class App.OrganizationZoom extends App.Controller
|
|||
url: =>
|
||||
'#organization/zoom/' + @organization_id
|
||||
|
||||
activate: =>
|
||||
show: =>
|
||||
App.OnlineNotification.seen( 'Organization', @organization_id )
|
||||
@navupdate '#'
|
||||
|
||||
|
|
|
@ -40,9 +40,6 @@ class App.TicketZoom extends App.Controller
|
|||
@delay( update, 1800, 'ticket-zoom-' + @ticket_id )
|
||||
)
|
||||
|
||||
@bind "task:hide", @onHide
|
||||
@bind "task:show", @onShow
|
||||
|
||||
meta: =>
|
||||
meta =
|
||||
url: @url()
|
||||
|
@ -58,9 +55,15 @@ class App.TicketZoom extends App.Controller
|
|||
url: =>
|
||||
'#ticket/zoom/' + @ticket_id
|
||||
|
||||
activate: =>
|
||||
show: =>
|
||||
App.OnlineNotification.seen( 'Ticket', @ticket_id )
|
||||
@navupdate '#'
|
||||
if @scrollHeader
|
||||
@scrollHeader.continue()
|
||||
|
||||
hide: =>
|
||||
if @scrollHeader
|
||||
@scrollHeader.pause()
|
||||
|
||||
changed: =>
|
||||
formCurrent = @formParam( @el.find('.edit') )
|
||||
|
@ -407,14 +410,6 @@ class App.TicketZoom extends App.Controller
|
|||
forceHeight: false
|
||||
holder: @main.get(0)
|
||||
|
||||
onShow: =>
|
||||
if @scrollHeader
|
||||
@scrollHeader.continue()
|
||||
|
||||
onHide: =>
|
||||
if @scrollHeader
|
||||
@scrollHeader.pause()
|
||||
|
||||
autosaveStop: =>
|
||||
@autosaveLast = {}
|
||||
@clearInterval( 'autosave' )
|
||||
|
|
|
@ -30,7 +30,7 @@ class App.UserZoom extends App.Controller
|
|||
url: =>
|
||||
'#user/zoom/' + @user_id
|
||||
|
||||
activate: =>
|
||||
show: =>
|
||||
App.OnlineNotification.seen( 'User', @user_id )
|
||||
@navupdate '#'
|
||||
|
||||
|
|
|
@ -206,12 +206,8 @@ class _taskManagerSingleton extends App.Controller
|
|||
|
||||
# return if controller is already started
|
||||
if @workersStarted[key]
|
||||
|
||||
# activate existing controller
|
||||
worker = @worker( key )
|
||||
if worker && worker.activate && !to_not_show
|
||||
worker.activate(params_app)
|
||||
App.Event.trigger('ui:rerender:task')
|
||||
if !to_not_show
|
||||
@showController( key, params_app )
|
||||
return
|
||||
|
||||
@workersStarted[key] = true
|
||||
|
@ -222,10 +218,22 @@ class _taskManagerSingleton extends App.Controller
|
|||
|
||||
# activate controller
|
||||
if !to_not_show
|
||||
a.activate(params_app)
|
||||
@showController( key, params_app )
|
||||
|
||||
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 ) =>
|
||||
for task in @allTasks
|
||||
if task.key is key
|
||||
|
|
Loading…
Reference in a new issue