Do timestamp update of task on task shown.
This commit is contained in:
parent
71bb80f95d
commit
f4c411db19
3 changed files with 165 additions and 162 deletions
|
@ -259,14 +259,16 @@ class App.Controller extends Spine.Controller
|
|||
|
||||
frontendTimeUpdate: =>
|
||||
update = =>
|
||||
ui = @
|
||||
$('.humanTimeFromNow').each( ->
|
||||
item = $(@)
|
||||
currentVal = item.text()
|
||||
ui.frontendTimeUpdateItem(item, currentVal)
|
||||
)
|
||||
@frontendTimeUpdateElement($('.humanTimeFromNow'))
|
||||
App.Interval.set(update, 61000, 'frontendTimeUpdate', 'ui')
|
||||
|
||||
frontendTimeUpdateElement: (el) =>
|
||||
ui = @
|
||||
el.find('.humanTimeFromNow').each( ->
|
||||
item = $(@)
|
||||
ui.frontendTimeUpdateItem(item, item.text())
|
||||
)
|
||||
|
||||
frontendTimeUpdateItem: (item, currentVal) =>
|
||||
timestamp = item.data('time')
|
||||
time = @humanTime(timestamp, item.hasClass('escalation'))
|
||||
|
@ -305,13 +307,11 @@ class App.Controller extends Spine.Controller
|
|||
content: ->
|
||||
ticketId = $(@).data('id')
|
||||
ticket = App.Ticket.fullLocal(ticketId)
|
||||
html = App.view('popover/ticket')(
|
||||
html = $(App.view('popover/ticket')(
|
||||
ticket: ticket
|
||||
)
|
||||
html = $(html)
|
||||
))
|
||||
html.find('.humanTimeFromNow').each(->
|
||||
item = $(@)
|
||||
ui.frontendTimeUpdateItem(item)
|
||||
ui.frontendTimeUpdateItem($(@))
|
||||
)
|
||||
html
|
||||
)
|
||||
|
@ -464,13 +464,11 @@ class App.Controller extends Spine.Controller
|
|||
tickets.push App.Ticket.fullLocal(ticketId)
|
||||
|
||||
# insert data
|
||||
html = App.view('popover/user_ticket_list')(
|
||||
html = $(App.view('popover/user_ticket_list')(
|
||||
tickets: tickets
|
||||
)
|
||||
html = $(html )
|
||||
))
|
||||
html.find('.humanTimeFromNow').each( ->
|
||||
item = $(@)
|
||||
ui.frontendTimeUpdateItem(item)
|
||||
ui.frontendTimeUpdateItem($(@))
|
||||
)
|
||||
html
|
||||
)
|
||||
|
|
|
@ -290,6 +290,11 @@ class _taskManagerSingleton extends App.Controller
|
|||
domKey = @domID(key)
|
||||
domStoreItem = @domStore[domKey]
|
||||
if !@$("##{domKey}").get(0) && domStoreItem && domStoreItem.el
|
||||
|
||||
# update shown times
|
||||
@frontendTimeUpdateElement(domStoreItem.el)
|
||||
|
||||
# append to dom
|
||||
@el.append(domStoreItem.el)
|
||||
@$("##{domKey}").removeClass('hide').addClass('active')
|
||||
|
||||
|
|
Loading…
Reference in a new issue