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: =>
|
frontendTimeUpdate: =>
|
||||||
update = =>
|
update = =>
|
||||||
ui = @
|
@frontendTimeUpdateElement($('.humanTimeFromNow'))
|
||||||
$('.humanTimeFromNow').each( ->
|
|
||||||
item = $(@)
|
|
||||||
currentVal = item.text()
|
|
||||||
ui.frontendTimeUpdateItem(item, currentVal)
|
|
||||||
)
|
|
||||||
App.Interval.set(update, 61000, 'frontendTimeUpdate', 'ui')
|
App.Interval.set(update, 61000, 'frontendTimeUpdate', 'ui')
|
||||||
|
|
||||||
|
frontendTimeUpdateElement: (el) =>
|
||||||
|
ui = @
|
||||||
|
el.find('.humanTimeFromNow').each( ->
|
||||||
|
item = $(@)
|
||||||
|
ui.frontendTimeUpdateItem(item, item.text())
|
||||||
|
)
|
||||||
|
|
||||||
frontendTimeUpdateItem: (item, currentVal) =>
|
frontendTimeUpdateItem: (item, currentVal) =>
|
||||||
timestamp = item.data('time')
|
timestamp = item.data('time')
|
||||||
time = @humanTime(timestamp, item.hasClass('escalation'))
|
time = @humanTime(timestamp, item.hasClass('escalation'))
|
||||||
|
@ -305,13 +307,11 @@ class App.Controller extends Spine.Controller
|
||||||
content: ->
|
content: ->
|
||||||
ticketId = $(@).data('id')
|
ticketId = $(@).data('id')
|
||||||
ticket = App.Ticket.fullLocal(ticketId)
|
ticket = App.Ticket.fullLocal(ticketId)
|
||||||
html = App.view('popover/ticket')(
|
html = $(App.view('popover/ticket')(
|
||||||
ticket: ticket
|
ticket: ticket
|
||||||
)
|
))
|
||||||
html = $(html)
|
|
||||||
html.find('.humanTimeFromNow').each(->
|
html.find('.humanTimeFromNow').each(->
|
||||||
item = $(@)
|
ui.frontendTimeUpdateItem($(@))
|
||||||
ui.frontendTimeUpdateItem(item)
|
|
||||||
)
|
)
|
||||||
html
|
html
|
||||||
)
|
)
|
||||||
|
@ -464,13 +464,11 @@ class App.Controller extends Spine.Controller
|
||||||
tickets.push App.Ticket.fullLocal(ticketId)
|
tickets.push App.Ticket.fullLocal(ticketId)
|
||||||
|
|
||||||
# insert data
|
# insert data
|
||||||
html = App.view('popover/user_ticket_list')(
|
html = $(App.view('popover/user_ticket_list')(
|
||||||
tickets: tickets
|
tickets: tickets
|
||||||
)
|
))
|
||||||
html = $(html )
|
|
||||||
html.find('.humanTimeFromNow').each( ->
|
html.find('.humanTimeFromNow').each( ->
|
||||||
item = $(@)
|
ui.frontendTimeUpdateItem($(@))
|
||||||
ui.frontendTimeUpdateItem(item)
|
|
||||||
)
|
)
|
||||||
html
|
html
|
||||||
)
|
)
|
||||||
|
|
|
@ -290,6 +290,11 @@ class _taskManagerSingleton extends App.Controller
|
||||||
domKey = @domID(key)
|
domKey = @domID(key)
|
||||||
domStoreItem = @domStore[domKey]
|
domStoreItem = @domStore[domKey]
|
||||||
if !@$("##{domKey}").get(0) && domStoreItem && domStoreItem.el
|
if !@$("##{domKey}").get(0) && domStoreItem && domStoreItem.el
|
||||||
|
|
||||||
|
# update shown times
|
||||||
|
@frontendTimeUpdateElement(domStoreItem.el)
|
||||||
|
|
||||||
|
# append to dom
|
||||||
@el.append(domStoreItem.el)
|
@el.append(domStoreItem.el)
|
||||||
@$("##{domKey}").removeClass('hide').addClass('active')
|
@$("##{domKey}").removeClass('hide').addClass('active')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue