Merge branch 'develop' of github.com:martini/zammad into develop
This commit is contained in:
commit
f530720435
11 changed files with 158 additions and 133 deletions
|
@ -264,6 +264,7 @@ class App.ControllerTable extends App.Controller
|
||||||
table = App.view('generic/table')(
|
table = App.view('generic/table')(
|
||||||
table_id: @table_id
|
table_id: @table_id
|
||||||
header: @headers
|
header: @headers
|
||||||
|
attributes: attributes
|
||||||
objects: @objects
|
objects: @objects
|
||||||
checkbox: @checkbox
|
checkbox: @checkbox
|
||||||
radio: @radio
|
radio: @radio
|
||||||
|
|
|
@ -40,9 +40,7 @@ class App.TicketZoom extends App.Controller
|
||||||
@interval(update, 1800000, 'pull_check')
|
@interval(update, 1800000, 'pull_check')
|
||||||
|
|
||||||
# fetch new data if triggered
|
# fetch new data if triggered
|
||||||
@bind(
|
@bind('Ticket:update Ticket:touch', (data) =>
|
||||||
'Ticket:update Ticket:touch'
|
|
||||||
(data) =>
|
|
||||||
|
|
||||||
# check if current ticket has changed
|
# check if current ticket has changed
|
||||||
return if data.id.toString() isnt @ticket_id.toString()
|
return if data.id.toString() isnt @ticket_id.toString()
|
||||||
|
@ -50,23 +48,15 @@ class App.TicketZoom extends App.Controller
|
||||||
# check if we already have the request queued
|
# check if we already have the request queued
|
||||||
#@log 'notice', 'TRY', @ticket_id, new Date(data.updated_at), new Date(@ticketUpdatedAtLastCall)
|
#@log 'notice', 'TRY', @ticket_id, new Date(data.updated_at), new Date(@ticketUpdatedAtLastCall)
|
||||||
update = =>
|
update = =>
|
||||||
@fetch( @ticket_id, false )
|
@fetch(@ticket_id, false)
|
||||||
if !@ticketUpdatedAtLastCall || ( new Date(data.updated_at).toString() isnt new Date(@ticketUpdatedAtLastCall).toString() )
|
if !@ticketUpdatedAtLastCall || ( new Date(data.updated_at).toString() isnt new Date(@ticketUpdatedAtLastCall).toString() )
|
||||||
@delay( update, 1200, 'ticket-zoom-' + @ticket_id )
|
@delay( update, 1200, 'ticket-zoom-' + @ticket_id )
|
||||||
)
|
)
|
||||||
|
|
||||||
# rerender view, e. g. on langauge change
|
# rerender view, e. g. on langauge change
|
||||||
@bind 'ui:rerender', =>
|
@bind('ui:rerender', =>
|
||||||
return if !@authenticate(true)
|
@fetch(@ticket_id, true)
|
||||||
|
)
|
||||||
# reset controllers state vars
|
|
||||||
@shown = false
|
|
||||||
@initDone = false
|
|
||||||
@activeState = false
|
|
||||||
@renderDone = false
|
|
||||||
|
|
||||||
# rerender view
|
|
||||||
@render()
|
|
||||||
|
|
||||||
meta: =>
|
meta: =>
|
||||||
|
|
||||||
|
@ -343,7 +333,7 @@ class App.TicketZoom extends App.Controller
|
||||||
ticket_id: @ticket.id
|
ticket_id: @ticket.id
|
||||||
)
|
)
|
||||||
|
|
||||||
@article_view = new App.TicketZoomArticleView(
|
@articleView = new App.TicketZoomArticleView(
|
||||||
ticket: @ticket
|
ticket: @ticket
|
||||||
el: @$('.ticket-article')
|
el: @$('.ticket-article')
|
||||||
ui: @
|
ui: @
|
||||||
|
@ -369,7 +359,7 @@ class App.TicketZoom extends App.Controller
|
||||||
)
|
)
|
||||||
|
|
||||||
# show article
|
# show article
|
||||||
@article_view.execute(
|
@articleView.execute(
|
||||||
ticket_article_ids: @ticket_article_ids
|
ticket_article_ids: @ticket_article_ids
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -93,9 +93,7 @@ class App.TicketZoomArticleNew extends App.Controller
|
||||||
@openTextarea(null, true)
|
@openTextarea(null, true)
|
||||||
|
|
||||||
# set article type and expand text area
|
# set article type and expand text area
|
||||||
@bind(
|
@bind('ui::ticket::setArticleType', (data) =>
|
||||||
'ui::ticket::setArticleType'
|
|
||||||
(data) =>
|
|
||||||
return if data.ticket.id isnt @ticket_id
|
return if data.ticket.id isnt @ticket_id
|
||||||
#@setArticleType(data.type.name)
|
#@setArticleType(data.type.name)
|
||||||
|
|
||||||
|
@ -111,15 +109,18 @@ class App.TicketZoomArticleNew extends App.Controller
|
||||||
)
|
)
|
||||||
|
|
||||||
# reset new article screen
|
# reset new article screen
|
||||||
@bind(
|
@bind('ui::ticket::taskReset', (data) =>
|
||||||
'ui::ticket::taskReset'
|
|
||||||
(data) =>
|
|
||||||
return if data.ticket_id isnt @ticket_id
|
return if data.ticket_id isnt @ticket_id
|
||||||
@type = 'note'
|
@type = 'note'
|
||||||
@defaults = {}
|
@defaults = {}
|
||||||
@render()
|
@render()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# rerender, e. g. on language change
|
||||||
|
@bind('ui:rerender', =>
|
||||||
|
@render()
|
||||||
|
)
|
||||||
|
|
||||||
isIE10: ->
|
isIE10: ->
|
||||||
Function('/*@cc_on return document.documentMode===10@*/')()
|
Function('/*@cc_on return document.documentMode===10@*/')()
|
||||||
|
|
||||||
|
@ -135,7 +136,7 @@ class App.TicketZoomArticleNew extends App.Controller
|
||||||
|
|
||||||
render: ->
|
render: ->
|
||||||
|
|
||||||
ticket = App.Ticket.fullLocal( @ticket_id )
|
ticket = App.Ticket.fullLocal(@ticket_id)
|
||||||
|
|
||||||
@html App.view('ticket_zoom/article_new')(
|
@html App.view('ticket_zoom/article_new')(
|
||||||
ticket: ticket
|
ticket: ticket
|
||||||
|
|
|
@ -40,9 +40,7 @@ class ArticleViewItem extends App.Controller
|
||||||
@render()
|
@render()
|
||||||
|
|
||||||
# set expand of text area only once
|
# set expand of text area only once
|
||||||
@bind(
|
@bind('ui::ticket::shown', (data) =>
|
||||||
'ui::ticket::shown'
|
|
||||||
(data) =>
|
|
||||||
return if data.ticket_id.toString() isnt @ticket.id.toString()
|
return if data.ticket_id.toString() isnt @ticket.id.toString()
|
||||||
|
|
||||||
# set highlighter
|
# set highlighter
|
||||||
|
@ -52,6 +50,11 @@ class ArticleViewItem extends App.Controller
|
||||||
@setSeeMore()
|
@setSeeMore()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# rerender, e. g. on language change
|
||||||
|
@bind('ui:rerender', =>
|
||||||
|
@render(undefined, true)
|
||||||
|
)
|
||||||
|
|
||||||
# subscribe to changes
|
# subscribe to changes
|
||||||
@subscribeId = App.TicketArticle.full(@ticket_article_id, @render, false, true)
|
@subscribeId = App.TicketArticle.full(@ticket_article_id, @render, false, true)
|
||||||
|
|
||||||
|
@ -84,7 +87,7 @@ class ArticleViewItem extends App.Controller
|
||||||
@articleAttributesLastUpdate = articleAttributesLastUpdateCheck
|
@articleAttributesLastUpdate = articleAttributesLastUpdateCheck
|
||||||
true
|
true
|
||||||
|
|
||||||
render: (article) =>
|
render: (article, force = false) =>
|
||||||
|
|
||||||
# get articles
|
# get articles
|
||||||
@article = App.TicketArticle.fullLocal( @ticket_article_id )
|
@article = App.TicketArticle.fullLocal( @ticket_article_id )
|
||||||
|
@ -103,7 +106,7 @@ class ArticleViewItem extends App.Controller
|
||||||
@el.removeClass('is-internal')
|
@el.removeClass('is-internal')
|
||||||
|
|
||||||
# check if rerender is needed
|
# check if rerender is needed
|
||||||
if !@hasChanged(@article)
|
if !force && !@hasChanged(@article)
|
||||||
@lastArticle = @article.attributes()
|
@lastArticle = @article.attributes()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,11 @@ class App.TicketZoomAttributeBar extends App.Controller
|
||||||
@subscribeId = App.Macro.subscribe(@render)
|
@subscribeId = App.Macro.subscribe(@render)
|
||||||
@render()
|
@render()
|
||||||
|
|
||||||
|
# rerender, e. g. on language change
|
||||||
|
@bind('ui:rerender', =>
|
||||||
|
@render()
|
||||||
|
)
|
||||||
|
|
||||||
release: =>
|
release: =>
|
||||||
App.Macro.unsubscribe(@subscribeId)
|
App.Macro.unsubscribe(@subscribeId)
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,20 @@
|
||||||
class App.TicketZoomMeta extends App.Controller
|
class App.TicketZoomMeta extends App.Controller
|
||||||
constructor: ->
|
constructor: ->
|
||||||
super
|
super
|
||||||
|
@render()
|
||||||
|
|
||||||
@ticket = App.Ticket.fullLocal(@ticket.id)
|
# rerender, e. g. on language change
|
||||||
@render(@ticket)
|
@bind('ui:rerender', =>
|
||||||
@subscribeId = @ticket.subscribe(@render)
|
@render()
|
||||||
|
)
|
||||||
|
|
||||||
render: (ticket) =>
|
render: (ticket) =>
|
||||||
|
if !ticket
|
||||||
|
ticket = App.Ticket.fullLocal(@ticket.id)
|
||||||
|
|
||||||
|
if !@subscribeId
|
||||||
|
@subscribeId = @ticket.subscribe(@render)
|
||||||
|
|
||||||
@html App.view('ticket_zoom/meta')(
|
@html App.view('ticket_zoom/meta')(
|
||||||
ticket: ticket
|
ticket: ticket
|
||||||
isCustomer: @isRole('Customer')
|
isCustomer: @isRole('Customer')
|
||||||
|
|
|
@ -4,12 +4,21 @@ class App.TicketZoomTitle extends App.Controller
|
||||||
|
|
||||||
constructor: ->
|
constructor: ->
|
||||||
super
|
super
|
||||||
|
@render()
|
||||||
|
|
||||||
@ticket = App.Ticket.fullLocal( @ticket.id )
|
# rerender, e. g. on language change
|
||||||
@subscribeId = @ticket.subscribe(@render)
|
@bind('ui:rerender', =>
|
||||||
@render(@ticket)
|
@render()
|
||||||
|
)
|
||||||
|
|
||||||
render: (ticket) =>
|
render: (ticket) =>
|
||||||
|
if !ticket
|
||||||
|
ticket = App.Ticket.fullLocal(@ticket.id)
|
||||||
|
|
||||||
|
if !@subscribeId
|
||||||
|
@subscribeId = @ticket.subscribe(@render)
|
||||||
|
|
||||||
|
@title = ticket.title
|
||||||
|
|
||||||
# check if render is needed
|
# check if render is needed
|
||||||
if @lastTitle && @lastTitle is ticket.title
|
if @lastTitle && @lastTitle is ticket.title
|
||||||
|
@ -30,18 +39,19 @@ class App.TicketZoomTitle extends App.Controller
|
||||||
title = $(e.target).ceg() || ''
|
title = $(e.target).ceg() || ''
|
||||||
|
|
||||||
# update title
|
# update title
|
||||||
if title isnt @ticket.title
|
if title isnt @title
|
||||||
@ticket.title = title
|
ticket = App.Ticket.find(@ticket.id)
|
||||||
|
ticket.title = title
|
||||||
|
|
||||||
# reset article - should not be resubmited on next ticket update
|
# reset article - should not be resubmited on next ticket update
|
||||||
@ticket.article = undefined
|
ticket.article = undefined
|
||||||
|
|
||||||
@ticket.save()
|
ticket.save()
|
||||||
|
|
||||||
App.TaskManager.mute( @task_key )
|
App.TaskManager.mute(@task_key)
|
||||||
|
|
||||||
# update taskbar with new meta data
|
# update taskbar with new meta data
|
||||||
App.Event.trigger 'task:render'
|
App.Event.trigger 'task:render'
|
||||||
|
|
||||||
release: =>
|
release: =>
|
||||||
App.Ticket.unsubscribe( @subscribeId )
|
App.Ticket.unsubscribe(@subscribeId)
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Widget extends App.Controller
|
||||||
$('body')
|
$('body')
|
||||||
.on 'focus.translation', '.translation', (e) ->
|
.on 'focus.translation', '.translation', (e) ->
|
||||||
element = $(e.target)
|
element = $(e.target)
|
||||||
element.data 'before', element.html()
|
element.data 'before', element.text()
|
||||||
element
|
element
|
||||||
.on 'blur.translation', '.translation', (e) =>
|
.on 'blur.translation', '.translation', (e) =>
|
||||||
console.log('blur')
|
console.log('blur')
|
||||||
|
@ -42,12 +42,7 @@ class Widget extends App.Controller
|
||||||
source = element.attr('title')
|
source = element.attr('title')
|
||||||
|
|
||||||
# get new translation
|
# get new translation
|
||||||
translation_new = element.html()
|
translation_new = element.text()
|
||||||
translation_new = ('' + translation_new)
|
|
||||||
.replace(/<.+?>/g, '')
|
|
||||||
|
|
||||||
# set new translation
|
|
||||||
element.html(translation_new)
|
|
||||||
|
|
||||||
# update translation
|
# update translation
|
||||||
return if element.data('before') is translation_new
|
return if element.data('before') is translation_new
|
||||||
|
@ -58,7 +53,7 @@ class Widget extends App.Controller
|
||||||
App.i18n.setMap(source, translation_new)
|
App.i18n.setMap(source, translation_new)
|
||||||
|
|
||||||
# replace rest in page
|
# replace rest in page
|
||||||
$(".translation[title='#{source}']").html(translation_new)
|
$(".translation[title='#{source}']").text(translation_new)
|
||||||
|
|
||||||
# update permanent translation mapString
|
# update permanent translation mapString
|
||||||
translation = App.Translation.findByAttribute('source', source)
|
translation = App.Translation.findByAttribute('source', source)
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
|
|
||||||
#= require_self
|
#= require_self
|
||||||
#= require_tree ./lib/app_init
|
#= require_tree ./lib/app_init
|
||||||
#= require ./config.coffee
|
#= require ./config.coffee
|
||||||
|
@ -10,7 +9,8 @@
|
||||||
#= require_tree ./lib/app_post
|
#= require_tree ./lib/app_post
|
||||||
|
|
||||||
class App extends Spine.Controller
|
class App extends Spine.Controller
|
||||||
@viewPrint: (object, attribute_name) ->
|
@viewPrint: (object, attribute_name, attributes) ->
|
||||||
|
if !attributes
|
||||||
attributes = {}
|
attributes = {}
|
||||||
if object.constructor.attributesGet
|
if object.constructor.attributesGet
|
||||||
attributes = object.constructor.attributesGet()
|
attributes = object.constructor.attributesGet()
|
||||||
|
@ -34,11 +34,9 @@ class App extends Spine.Controller
|
||||||
if parts[0] && parts[1] && object[ parts[0] ]
|
if parts[0] && parts[1] && object[ parts[0] ]
|
||||||
value = object[ parts[0] ][ parts[1] ]
|
value = object[ parts[0] ][ parts[1] ]
|
||||||
|
|
||||||
#console.log('Pa', attribute_name, object, attribute_config, object[attribute_name], valueRef, value)
|
|
||||||
|
|
||||||
# if we have no config, get output this way
|
# if we have no config, get output this way
|
||||||
if !attribute_config
|
if !attribute_config
|
||||||
return @viewPrintItem( value )
|
return @viewPrintItem(value)
|
||||||
|
|
||||||
# check if valueRef already exists, no lookup needed later
|
# check if valueRef already exists, no lookup needed later
|
||||||
if !valueRef
|
if !valueRef
|
||||||
|
@ -48,10 +46,10 @@ class App extends Spine.Controller
|
||||||
if object[attribute_name_without_ref]
|
if object[attribute_name_without_ref]
|
||||||
valueRef = object[attribute_name_without_ref]
|
valueRef = object[attribute_name_without_ref]
|
||||||
|
|
||||||
return @viewPrintItem( value, attribute_config, valueRef )
|
@viewPrintItem(value, attribute_config, valueRef)
|
||||||
|
|
||||||
# define print name helper
|
# define print name helper
|
||||||
@viewPrintItem: ( item, attribute_config = {}, valueRef ) ->
|
@viewPrintItem: (item, attribute_config = {}, valueRef) ->
|
||||||
return '-' if item is undefined
|
return '-' if item is undefined
|
||||||
return '-' if item is ''
|
return '-' if item is ''
|
||||||
return item if !item
|
return item if !item
|
||||||
|
@ -77,13 +75,13 @@ class App extends Spine.Controller
|
||||||
|
|
||||||
# execute callback on content
|
# execute callback on content
|
||||||
if attribute_config.callback
|
if attribute_config.callback
|
||||||
result = attribute_config.callback( result, attribute_config )
|
result = attribute_config.callback(result, attribute_config)
|
||||||
|
|
||||||
# text2html in textarea view
|
# text2html in textarea view
|
||||||
isHtmlEscape = false
|
isHtmlEscape = false
|
||||||
if attribute_config.tag is 'textarea'
|
if attribute_config.tag is 'textarea'
|
||||||
isHtmlEscape = true
|
isHtmlEscape = true
|
||||||
result = App.Utils.text2html( result )
|
result = App.Utils.text2html(result)
|
||||||
|
|
||||||
# remember, html snippets are already escaped
|
# remember, html snippets are already escaped
|
||||||
else if attribute_config.tag is 'richtext'
|
else if attribute_config.tag is 'richtext'
|
||||||
|
@ -95,9 +93,9 @@ class App extends Spine.Controller
|
||||||
result = attribute_config.options[result]
|
result = attribute_config.options[result]
|
||||||
|
|
||||||
# translate content
|
# translate content
|
||||||
if attribute_config.translate || ( isObject && item.translate && item.translate() )
|
if attribute_config.translate || (isObject && item.translate && item.translate())
|
||||||
isHtmlEscape = true
|
isHtmlEscape = true
|
||||||
result = App.i18n.translateContent( result )
|
result = App.i18n.translateContent(result)
|
||||||
|
|
||||||
# transform date
|
# transform date
|
||||||
if attribute_config.tag is 'date'
|
if attribute_config.tag is 'date'
|
||||||
|
@ -121,71 +119,71 @@ class App extends Spine.Controller
|
||||||
result
|
result
|
||||||
|
|
||||||
@view: (name) ->
|
@view: (name) ->
|
||||||
template = ( params = {} ) ->
|
template = (params = {}) ->
|
||||||
|
|
||||||
# define print name helper
|
# define print name helper
|
||||||
params.P = ( object, attribute_name ) ->
|
params.P = (object, attribute_name, attributes) ->
|
||||||
App.viewPrint( object, attribute_name )
|
App.viewPrint(object, attribute_name, attributes)
|
||||||
|
|
||||||
# define date format helper
|
# define date format helper
|
||||||
params.date = ( time ) ->
|
params.date = (time) ->
|
||||||
return '' if !time
|
return '' if !time
|
||||||
|
|
||||||
timeObject = new Date(time)
|
timeObject = new Date(time)
|
||||||
d = App.Utils.formatTime( timeObject.getDate(), 2 )
|
d = App.Utils.formatTime(timeObject.getDate(), 2)
|
||||||
m = App.Utils.formatTime( timeObject.getMonth() + 1, 2 )
|
m = App.Utils.formatTime(timeObject.getMonth() + 1, 2)
|
||||||
y = timeObject.getFullYear()
|
y = timeObject.getFullYear()
|
||||||
"#{y}-#{m}-#{d}"
|
"#{y}-#{m}-#{d}"
|
||||||
|
|
||||||
# define datetime format helper
|
# define datetime format helper
|
||||||
params.datetime = ( time ) ->
|
params.datetime = (time) ->
|
||||||
return '' if !time
|
return '' if !time
|
||||||
|
|
||||||
timeObject = new Date(time)
|
timeObject = new Date(time)
|
||||||
d = App.Utils.formatTime( timeObject.getDate(), 2 )
|
d = App.Utils.formatTime(timeObject.getDate(), 2)
|
||||||
m = App.Utils.formatTime( timeObject.getMonth() + 1, 2 )
|
m = App.Utils.formatTime(timeObject.getMonth() + 1, 2)
|
||||||
y = timeObject.getFullYear()
|
y = timeObject.getFullYear()
|
||||||
S = App.Utils.formatTime( timeObject.getSeconds(), 2 )
|
S = App.Utils.formatTime(timeObject.getSeconds(), 2)
|
||||||
M = App.Utils.formatTime( timeObject.getMinutes(), 2 )
|
M = App.Utils.formatTime(timeObject.getMinutes(), 2)
|
||||||
H = App.Utils.formatTime( timeObject.getHours(), 2 )
|
H = App.Utils.formatTime(timeObject.getHours(), 2)
|
||||||
"#{y}-#{m}-#{d} #{H}:#{M}:#{S}"
|
"#{y}-#{m}-#{d} #{H}:#{M}:#{S}"
|
||||||
|
|
||||||
# define decimal format helper
|
# define decimal format helper
|
||||||
params.decimal = ( data, positions = 2 ) ->
|
params.decimal = (data, positions = 2) ->
|
||||||
App.Utils.decimal(data, positions)
|
App.Utils.decimal(data, positions)
|
||||||
|
|
||||||
# define translation helper
|
# define translation helper
|
||||||
params.T = ( item, args... ) ->
|
params.T = (item, args...) ->
|
||||||
App.i18n.translateContent( item, args... )
|
App.i18n.translateContent(item, args...)
|
||||||
|
|
||||||
# define translation inline helper
|
# define translation inline helper
|
||||||
params.Ti = ( item, args... ) ->
|
params.Ti = (item, args...) ->
|
||||||
App.i18n.translateInline( item, args... )
|
App.i18n.translateInline(item, args...)
|
||||||
|
|
||||||
# define translation for date helper
|
# define translation for date helper
|
||||||
params.Tdate = ( item, args... ) ->
|
params.Tdate = (item, args...) ->
|
||||||
App.i18n.translateDate( item, args... )
|
App.i18n.translateDate(item, args...)
|
||||||
|
|
||||||
# define translation for timestamp helper
|
# define translation for timestamp helper
|
||||||
params.Ttimestamp = ( item, args... ) ->
|
params.Ttimestamp = (item, args...) ->
|
||||||
App.i18n.translateTimestamp( item, args... )
|
App.i18n.translateTimestamp(item, args...)
|
||||||
|
|
||||||
# define linkify helper
|
# define linkify helper
|
||||||
params.L = ( item ) ->
|
params.L = (item) ->
|
||||||
if item && typeof item is 'string'
|
if item && typeof item is 'string'
|
||||||
return App.Utils.linkify( item )
|
return App.Utils.linkify(item)
|
||||||
item
|
item
|
||||||
|
|
||||||
# define config helper
|
# define config helper
|
||||||
params.C = ( key ) ->
|
params.C = (key) ->
|
||||||
App.Config.get( key )
|
App.Config.get(key)
|
||||||
|
|
||||||
# define session helper
|
# define session helper
|
||||||
params.S = ( key ) ->
|
params.S = (key) ->
|
||||||
App.Session.get( key )
|
App.Session.get(key)
|
||||||
|
|
||||||
# define address line helper
|
# define address line helper
|
||||||
params.AddressLine = ( line ) ->
|
params.AddressLine = (line) ->
|
||||||
return '' if !line
|
return '' if !line
|
||||||
items = emailAddresses.parseAddressList(line)
|
items = emailAddresses.parseAddressList(line)
|
||||||
|
|
||||||
|
@ -202,15 +200,14 @@ class App extends Spine.Controller
|
||||||
result = result + App.Utils.htmlEscape(item.name) + ' '
|
result = result + App.Utils.htmlEscape(item.name) + ' '
|
||||||
if item.address
|
if item.address
|
||||||
result = result + " <span class=\"text-muted\"><#{App.Utils.htmlEscape(item.address)}></span>"
|
result = result + " <span class=\"text-muted\"><#{App.Utils.htmlEscape(item.address)}></span>"
|
||||||
|
|
||||||
result
|
result
|
||||||
|
|
||||||
# define file size helper
|
# define file size helper
|
||||||
params.humanFileSize = ( size ) ->
|
params.humanFileSize = (size) ->
|
||||||
App.Utils.humanFileSize(size)
|
App.Utils.humanFileSize(size)
|
||||||
|
|
||||||
# define pretty/human time helper
|
# define pretty/human time helper
|
||||||
params.humanTime = ( time, escalation = false, cssClass = '') ->
|
params.humanTime = (time, escalation = false, cssClass = '') ->
|
||||||
timestamp = App.i18n.translateTimestamp(time)
|
timestamp = App.i18n.translateTimestamp(time)
|
||||||
if escalation
|
if escalation
|
||||||
cssClass += ' escalation'
|
cssClass += ' escalation'
|
||||||
|
@ -222,7 +219,7 @@ class App extends Spine.Controller
|
||||||
App.Utils.icon(name, className)
|
App.Utils.icon(name, className)
|
||||||
|
|
||||||
# define richtext helper
|
# define richtext helper
|
||||||
params.RichText = ( string ) ->
|
params.RichText = (string) ->
|
||||||
if string.match(/@T\('/)
|
if string.match(/@T\('/)
|
||||||
string = string.replace(/@T\('(.+?)'\)/g, (match, capture) ->
|
string = string.replace(/@T\('(.+?)'\)/g, (match, capture) ->
|
||||||
App.i18n.translateContent(capture)
|
App.i18n.translateContent(capture)
|
||||||
|
|
|
@ -27,6 +27,11 @@ class App.Log
|
||||||
_instance ?= new _Singleton
|
_instance ?= new _Singleton
|
||||||
_instance.config( type, regex )
|
_instance.config( type, regex )
|
||||||
|
|
||||||
|
@timeTrack: (message) ->
|
||||||
|
if _instance == undefined
|
||||||
|
_instance ?= new _Singleton
|
||||||
|
_instance.timeTrack(message)
|
||||||
|
|
||||||
class _Singleton
|
class _Singleton
|
||||||
constructor: ->
|
constructor: ->
|
||||||
@moduleColorsMap = {}
|
@moduleColorsMap = {}
|
||||||
|
@ -116,3 +121,13 @@ class _Singleton
|
||||||
@hue += goldenRatio
|
@hue += goldenRatio
|
||||||
@hue = @hue % 1
|
@hue = @hue % 1
|
||||||
@hue * 360
|
@hue * 360
|
||||||
|
|
||||||
|
timeTrack: (message) =>
|
||||||
|
currentTime = new Date().getTime()
|
||||||
|
if !@lastTime
|
||||||
|
@lastTime = currentTime
|
||||||
|
console.log('timeTrack start', message)
|
||||||
|
else
|
||||||
|
diff = currentTime - @lastTime
|
||||||
|
@lastTime = currentTime
|
||||||
|
console.log('timeTrack start', message, diff)
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
<% groupLast = '' %>
|
<% groupLast = '' %>
|
||||||
<% for object in @objects: %>
|
<% for object in @objects: %>
|
||||||
<% if @groupBy: %>
|
<% if @groupBy: %>
|
||||||
<% groupByName = @P( object, @groupBy ) %>
|
<% groupByName = @P( object, @groupBy, @attributes ) %>
|
||||||
<% if groupLast isnt groupByName: %>
|
<% if groupLast isnt groupByName: %>
|
||||||
<tr class=""><td colspan="<%= length %>"><b><%= groupByName %></b></td></tr>
|
<tr class=""><td colspan="<%= length %>"><b><%= groupByName %></b></td></tr>
|
||||||
<% groupLast = groupByName %>
|
<% groupLast = groupByName %>
|
||||||
|
@ -68,7 +68,7 @@
|
||||||
</td>
|
</td>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% for item in @header: %>
|
<% for item in @header: %>
|
||||||
<% value = @P( object, item.name ) %>
|
<% value = @P( object, item.name, @attributes ) %>
|
||||||
<% if @callbacks: %>
|
<% if @callbacks: %>
|
||||||
<% if item.name.substr(item.name.length-3, item.name.length) is '_id' && object[ item.name.substr(0, item.name.length-3) ]: %>
|
<% if item.name.substr(item.name.length-3, item.name.length) is '_id' && object[ item.name.substr(0, item.name.length-3) ]: %>
|
||||||
<% refObject = object[ item.name.substr(0, item.name.length-3) ] %>
|
<% refObject = object[ item.name.substr(0, item.name.length-3) ] %>
|
||||||
|
|
Loading…
Reference in a new issue