diff --git a/app/assets/javascripts/app/controllers/_application_controller.js.coffee b/app/assets/javascripts/app/controllers/_application_controller.js.coffee index 5bbb9ac4f..f531f504f 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.js.coffee @@ -210,7 +210,7 @@ class App.Controller extends Spine.Controller # console.log('rewrite frontendTimeUpdate', this, $(this).hasClass('escalation')) ui.frontendTimeUpdateItem(item) ) - App.Interval.set( update, 30000, 'frontendTimeUpdate', 'ui' ) + App.Interval.set( update, 61000, 'frontendTimeUpdate', 'ui' ) frontendTimeUpdateItem: (item) => timestamp = item.data('time') diff --git a/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee index d2b8fba67..0dfa0912b 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee @@ -401,9 +401,6 @@ class App.GenericHistory extends App.ControllerModal # enable user popups @userPopups() - # show frontend times - @delay( @frontendTimeUpdate, 800, 'ui-time-update' ) - sortorder: => @items = @items.reverse() diff --git a/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee index dd68029d8..1acd639d6 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_table.js.coffee @@ -274,9 +274,4 @@ class App.ControllerTable extends App.Controller ) ) - time = => - @frontendTimeUpdate() - @delay(time, 80) # to show time immediately for normal tables - @delay(time, 280) # to show time immediately for tables in modal dialog - table diff --git a/app/assets/javascripts/app/controllers/_dashboard/activity_stream.js.coffee b/app/assets/javascripts/app/controllers/_dashboard/activity_stream.js.coffee index 7e49d6792..9455f3b63 100644 --- a/app/assets/javascripts/app/controllers/_dashboard/activity_stream.js.coffee +++ b/app/assets/javascripts/app/controllers/_dashboard/activity_stream.js.coffee @@ -51,9 +51,6 @@ class App.DashboardActivityStream extends App.Controller @$('.activity-entries').remove() @el.append html - # update time - @frontendTimeUpdate() - renderItem: (item) -> html = $(App.view('dashboard/activity_stream')( item: item diff --git a/app/assets/javascripts/app/controllers/session.js.coffee b/app/assets/javascripts/app/controllers/session.js.coffee index a52e9198f..b208ee116 100644 --- a/app/assets/javascripts/app/controllers/session.js.coffee +++ b/app/assets/javascripts/app/controllers/session.js.coffee @@ -42,9 +42,6 @@ class Index extends App.ControllerContent sessions: data.sessions ) - # show frontend times - @frontendTimeUpdate() - destroy: (e) -> e.preventDefault() sessionId = $( e.target ).closest('a').data('session-id') diff --git a/app/assets/javascripts/app/controllers/ticket_overview.js.coffee b/app/assets/javascripts/app/controllers/ticket_overview.js.coffee index b7e62c5de..b48221797 100644 --- a/app/assets/javascripts/app/controllers/ticket_overview.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_overview.js.coffee @@ -321,9 +321,6 @@ class Table extends App.Controller # start organization popups @organizationPopups() - # show frontend times - @frontendTimeUpdate() - # start bulk action observ @el.find('.bulkAction').append( @bulk_form() ) if @el.find('.table-overview').find('input[name="bulk"]:checked').length isnt 0 diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_view.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_view.js.coffee index dc7172f67..845371ab1 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/article_view.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_view.js.coffee @@ -112,9 +112,6 @@ class ArticleViewItem extends App.Controller article: @article ) - # show frontend times - @frontendTimeUpdate() - # set see more option @setSeeMore() diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/meta.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/meta.js.coffee index cbc3865ea..613171847 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/meta.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/meta.js.coffee @@ -12,8 +12,5 @@ class App.TicketZoomMeta extends App.Controller isCustomer: @isRole('Customer') ) - # show frontend times - @frontendTimeUpdate() - release: => App.Ticket.unsubscribe( @subscribeId ) \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee b/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee index 971131515..5613532d0 100644 --- a/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee +++ b/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee @@ -130,9 +130,6 @@ class App.OnlineNotificationWidget extends App.Controller $( App.view('widget/online_notification_content')(items: items) ) ) - # show frontend times - @frontendTimeUpdate() - createContainer: => @removeContainer() diff --git a/app/assets/javascripts/app/controllers/widget/ticket_stats.js.coffee b/app/assets/javascripts/app/controllers/widget/ticket_stats.js.coffee index 34f4fac04..c838c47cf 100644 --- a/app/assets/javascripts/app/controllers/widget/ticket_stats.js.coffee +++ b/app/assets/javascripts/app/controllers/widget/ticket_stats.js.coffee @@ -144,7 +144,6 @@ class TicketStatsList extends App.Controller limit: @limit ) - @frontendTimeUpdate() @ticketPopups() showAll: (e) => diff --git a/app/assets/javascripts/app/index.js.coffee b/app/assets/javascripts/app/index.js.coffee index 36fcebebf..c4046e373 100644 --- a/app/assets/javascripts/app/index.js.coffee +++ b/app/assets/javascripts/app/index.js.coffee @@ -107,7 +107,12 @@ class App extends Spine.Controller # use pretty time for datetime else if attribute_config.tag is 'datetime' isHtmlEscape = true - result = "?" + timestamp = App.i18n.translateTimestamp(result) + escalation = undefined + if attribute_config.class is 'escalation' + escalation + humanTime = App.PrettyDate.humanTime(result, escalation) + result = "#{humanTime}" #result = App.i18n.translateTimestamp(result) if !isHtmlEscape && typeof result is 'string' @@ -216,6 +221,14 @@ class App extends Spine.Controller params.humanFileSize = ( size ) -> App.Utils.humanFileSize(size) + # define pretty/human time helper + params.humanTime = ( time, escalation ) -> + App.PrettyDate.humanTime(time, escalation) + + # define pretty/human time helper + params.timestamp = ( time ) -> + App.i18n.translateTimestamp(time) + # define template JST["app/views/#{name}"](params) template diff --git a/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee b/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee index 89cacaa2f..ef9c813a1 100644 --- a/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/interface_handle.js.coffee @@ -21,6 +21,9 @@ class App.Run extends App.Controller # create web socket connection App.WebSocket.connect() + # start frontend time update + @frontendTimeUpdate() + # start navbars @setupWidget( 'Navigations', 'nav', @el ) diff --git a/app/assets/javascripts/app/views/dashboard/activity_stream.jst.eco b/app/assets/javascripts/app/views/dashboard/activity_stream.jst.eco index 123b0fbe5..af16e255f 100644 --- a/app/assets/javascripts/app/views/dashboard/activity_stream.jst.eco +++ b/app/assets/javascripts/app/views/dashboard/activity_stream.jst.eco @@ -5,7 +5,7 @@ <%= @item.created_by.displayName() %> <%- @T( @item.type ) %> <%- @T( @item.object_name ) %><% if @item.title: %> (<%= @item.title %>)<% end %> - ? + <%- @humanTime(@item.created_at) %> diff --git a/app/assets/javascripts/app/views/generic/history.jst.eco b/app/assets/javascripts/app/views/generic/history.jst.eco index e1b3b8409..281923ec8 100644 --- a/app/assets/javascripts/app/views/generic/history.jst.eco +++ b/app/assets/javascripts/app/views/generic/history.jst.eco @@ -5,7 +5,7 @@ <% for item in @items: %> <%= item.created_by.displayName() %> - - ? + <%- @humanTime(item.created_at) %>