Improved humanTime helper method.

This commit is contained in:
Martin Edenhofer 2015-08-17 08:39:23 +02:00
parent 7adc2ea919
commit 6366629205

View file

@ -109,10 +109,11 @@ class App extends Spine.Controller
isHtmlEscape = true isHtmlEscape = true
timestamp = App.i18n.translateTimestamp(result) timestamp = App.i18n.translateTimestamp(result)
escalation = false escalation = false
if attribute_config.class && attribute_config.class.match 'escalation' cssClass = attribute_config.class || ''
if cssClass.match 'escalation'
escalation = true escalation = true
humanTime = App.PrettyDate.humanTime(result, escalation) humanTime = App.PrettyDate.humanTime(result, escalation)
result = "<time class=\"humanTimeFromNow #{attribute_config.class}\" data-time=\"#{result}\" data-tooltip=\"#{timestamp}\">#{humanTime}</time>" result = "<time class=\"humanTimeFromNow #{cssClass}\" data-time=\"#{result}\" data-tooltip=\"#{timestamp}\">#{humanTime}</time>"
if !isHtmlEscape && typeof result is 'string' if !isHtmlEscape && typeof result is 'string'
result = App.Utils.htmlEscape(result) result = App.Utils.htmlEscape(result)