Improved showing time after ticket popover is shown.

This commit is contained in:
Martin Edenhofer 2015-02-08 15:10:48 +01:00
parent 9a80a313ac
commit 7a1749065c

View file

@ -206,14 +206,18 @@ class App.Controller extends Spine.Controller
update = => update = =>
ui = @ ui = @
$('.humanTimeFromNow').each( -> $('.humanTimeFromNow').each( ->
item = $(this)
# console.log('rewrite frontendTimeUpdate', this, $(this).hasClass('escalation')) # console.log('rewrite frontendTimeUpdate', this, $(this).hasClass('escalation'))
timestamp = $(this).data('time') ui.frontendTimeUpdateItem(item)
time = ui.humanTime( timestamp, $(this).hasClass('escalation') )
$(this).attr( 'data-tooltip', App.i18n.translateTimestamp(timestamp) )
$(this).html( time )
) )
App.Interval.set( update, 30000, 'frontendTimeUpdate', 'ui' ) App.Interval.set( update, 30000, 'frontendTimeUpdate', 'ui' )
frontendTimeUpdateItem: (item) =>
timestamp = item.data('time')
time = @humanTime( timestamp, item.hasClass('escalation') )
item.attr( 'data-tooltip', App.i18n.translateTimestamp(timestamp) )
item.html( time )
ticketPopups: (position = 'right') -> ticketPopups: (position = 'right') ->
# open ticket in new task if curent user agent # open ticket in new task if curent user agent
@ -243,10 +247,15 @@ class App.Controller extends Spine.Controller
content: -> content: ->
ticket_id = $(@).data('id') ticket_id = $(@).data('id')
ticket = App.Ticket.fullLocal( ticket_id ) ticket = App.Ticket.fullLocal( ticket_id )
ticket.humanTime = ui.humanTime(ticket.created_at) html = App.view('popover/ticket')(
App.view('popover/ticket')(
ticket: ticket ticket: ticket
) )
html = $( html )
html.find('.humanTimeFromNow').each( ->
item = $(this)
ui.frontendTimeUpdateItem(item)
)
html
) )
ticketPopupsDestroy: => ticketPopupsDestroy: =>