Improved update handling.

This commit is contained in:
Martin Edenhofer 2014-04-02 23:13:09 +02:00
parent f4e38884d2
commit 6c6ee15374

View file

@ -19,7 +19,7 @@ class App.TicketZoom extends App.Controller
@load(cache) @load(cache)
update = => update = =>
@fetch( @ticket_id, false ) @fetch( @ticket_id, false )
@interval( update, 300000, 'pull_check' ) @interval( update, 450000, 'pull_check' )
# fetch new data if triggered # fetch new data if triggered
@bind( @bind(
@ -173,8 +173,8 @@ class App.TicketZoom extends App.Controller
TicketTitle: => TicketTitle: =>
# show ticket title # show ticket title
new TicketTitle( new TicketTitle(
ticket: @ticket ticket: @ticket
el: @el.find('.ticket-title') el: @el.find('.ticket-title')
) )
ArticleView: => ArticleView: =>
@ -220,11 +220,12 @@ class TicketTitle extends App.Controller
constructor: -> constructor: ->
super super
@render() @subscribeId = @ticket.subscribe(@render)
@render(@ticket)
render: -> render: (ticket) =>
@html App.view('ticket_zoom/title')( @html App.view('ticket_zoom/title')(
ticket: @ticket ticket: ticket
) )
update: (e) => update: (e) =>
@ -241,26 +242,30 @@ class TicketTitle extends App.Controller
title = '' title = ''
# update title # update title
ticket = App.Ticket.retrieve( @ticket.id ) @ticket.title = title
ticket.title = title @ticket.load( title: title )
ticket.load( title: title ) @ticket.save()
ticket.save()
# update taskbar with new meta data # update taskbar with new meta data
App.Event.trigger 'task:render' App.Event.trigger 'task:render'
release: =>
App.Ticket.unsubscribe( @subscribeId )
class TicketInfo extends App.ControllerDrox class TicketInfo extends App.ControllerDrox
constructor: -> constructor: ->
super super
@render()
render: -> @subscribeId = @ticket.subscribe(@render)
@render(@ticket)
render: (ticket) =>
@html @template( @html @template(
file: 'ticket_zoom/info' file: 'ticket_zoom/info'
header: '#' + @ticket.number header: '#' + ticket.number
params: params:
ticket: @ticket ticket: ticket
) )
# start tag controller # start tag controller
@ -268,9 +273,12 @@ class TicketInfo extends App.ControllerDrox
new App.WidgetTag( new App.WidgetTag(
el: @el.find('.tag_info') el: @el.find('.tag_info')
object_type: 'Ticket' object_type: 'Ticket'
object: @ticket object: ticket
) )
release: =>
App.Ticket.unsubscribe( @subscribeId )
class Widgets extends App.Controller class Widgets extends App.Controller
constructor: -> constructor: ->
super super
@ -282,8 +290,8 @@ class Widgets extends App.Controller
# show ticket info # show ticket info
new TicketInfo( new TicketInfo(
ticket: @ticket ticket: @ticket
el: @el.find('.ticket_info') el: @el.find('.ticket_info')
) )
# start customer info controller # start customer info controller