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