Maintenance: update <time> tag rendering to match HTML specs
This commit is contained in:
parent
4d17b78181
commit
e953090dc7
4 changed files with 5 additions and 10 deletions
|
@ -281,11 +281,6 @@ class App.Controller extends Spine.Controller
|
|||
return true if @Session.get()
|
||||
false
|
||||
|
||||
frontendTime: (timestamp, row = {}) ->
|
||||
if !row['subclass']
|
||||
row['subclass'] = ''
|
||||
"<span class=\"humanTimeFromNow #{row.subclass}\" data-time=\"#{timestamp}\">?</span>"
|
||||
|
||||
frontendTimeUpdate: =>
|
||||
update = =>
|
||||
@frontendTimeUpdateElement($('#app'))
|
||||
|
@ -299,7 +294,7 @@ class App.Controller extends Spine.Controller
|
|||
)
|
||||
|
||||
frontendTimeUpdateItem: (item, currentVal) =>
|
||||
timestamp = item.data('time')
|
||||
timestamp = item.attr('datetime')
|
||||
time = @humanTime(timestamp, item.hasClass('escalation'))
|
||||
|
||||
# only do dom updates on changes
|
||||
|
|
|
@ -140,7 +140,7 @@ class App extends Spine.Controller
|
|||
humanTime = ''
|
||||
if !table
|
||||
humanTime = App.PrettyDate.humanTime(resultLocal, escalation)
|
||||
resultLocal = "<time class=\"humanTimeFromNow #{cssClass}\" data-time=\"#{resultLocal}\" title=\"#{timestamp}\">#{humanTime}</time>"
|
||||
resultLocal = "<time class=\"humanTimeFromNow #{cssClass}\" datetime=\"#{resultLocal}\" title=\"#{timestamp}\">#{humanTime}</time>"
|
||||
|
||||
if !isHtmlEscape && typeof resultLocal is 'string'
|
||||
resultLocal = App.Utils.htmlEscape(resultLocal)
|
||||
|
|
|
@ -135,7 +135,7 @@ App.ViewHelpers =
|
|||
if escalation
|
||||
cssClass += ' escalation'
|
||||
humanTime = App.PrettyDate.humanTime(time, escalation)
|
||||
"<time class=\"humanTimeFromNow #{cssClass}\" data-time=\"#{time}\" title=\"#{timestamp}\">#{humanTime}</time>"
|
||||
"<time class=\"humanTimeFromNow #{cssClass}\" datetime=\"#{time}\" title=\"#{timestamp}\">#{humanTime}</time>"
|
||||
|
||||
# Why not just use `Icon: App.Utils.icon`?
|
||||
# Because App.Utils isn't loaded until after this file.
|
||||
|
|
|
@ -44,7 +44,7 @@ test( "model ui basic tests", function() {
|
|||
equal( App.viewPrint( ticket, 'state' ), 'open')
|
||||
equal( App.viewPrint( ticket, 'state_id' ), 'open')
|
||||
equal( App.viewPrint( ticket, 'not_existing' ), '-')
|
||||
equal( App.viewPrint( ticket, 'updated_at' ), '<time class="humanTimeFromNow " data-time="2014-11-07T23:43:08.000Z" title="11/07/2014 23:43">11/07/2014</time>')
|
||||
equal( App.viewPrint( ticket, 'updated_at' ), '<time class="humanTimeFromNow " datetime="2014-11-07T23:43:08.000Z" title="11/07/2014 23:43">11/07/2014</time>')
|
||||
equal( App.viewPrint( ticket, 'date' ), '02/07/2015')
|
||||
equal( App.viewPrint( ticket, 'textarea' ), '<div>some new</div><div>line</div>')
|
||||
|
||||
|
@ -55,7 +55,7 @@ test( "model ui basic tests", function() {
|
|||
equal( App.viewPrint( ticket, 'state' ), 'offen')
|
||||
equal( App.viewPrint( ticket, 'state_id' ), 'offen')
|
||||
equal( App.viewPrint( ticket, 'not_existing' ), '-')
|
||||
equal( App.viewPrint( ticket, 'updated_at' ), '<time class="humanTimeFromNow " data-time="2014-11-07T23:43:08.000Z" title="07.11.2014 23:43">07.11.2014</time>')
|
||||
equal( App.viewPrint( ticket, 'updated_at' ), '<time class="humanTimeFromNow " datetime="2014-11-07T23:43:08.000Z" title="07.11.2014 23:43">07.11.2014</time>')
|
||||
equal( App.viewPrint( ticket, 'date' ), '07.02.2015')
|
||||
equal( App.viewPrint( ticket, 'textarea' ), '<div>some new</div><div>line</div>')
|
||||
|
||||
|
|
Loading…
Reference in a new issue