Reduced dom changes, improved performance.
This commit is contained in:
parent
592b014508
commit
df3addd915
20 changed files with 27 additions and 38 deletions
|
@ -210,7 +210,7 @@ class App.Controller extends Spine.Controller
|
||||||
# console.log('rewrite frontendTimeUpdate', this, $(this).hasClass('escalation'))
|
# console.log('rewrite frontendTimeUpdate', this, $(this).hasClass('escalation'))
|
||||||
ui.frontendTimeUpdateItem(item)
|
ui.frontendTimeUpdateItem(item)
|
||||||
)
|
)
|
||||||
App.Interval.set( update, 30000, 'frontendTimeUpdate', 'ui' )
|
App.Interval.set( update, 61000, 'frontendTimeUpdate', 'ui' )
|
||||||
|
|
||||||
frontendTimeUpdateItem: (item) =>
|
frontendTimeUpdateItem: (item) =>
|
||||||
timestamp = item.data('time')
|
timestamp = item.data('time')
|
||||||
|
|
|
@ -401,9 +401,6 @@ class App.GenericHistory extends App.ControllerModal
|
||||||
# enable user popups
|
# enable user popups
|
||||||
@userPopups()
|
@userPopups()
|
||||||
|
|
||||||
# show frontend times
|
|
||||||
@delay( @frontendTimeUpdate, 800, 'ui-time-update' )
|
|
||||||
|
|
||||||
sortorder: =>
|
sortorder: =>
|
||||||
@items = @items.reverse()
|
@items = @items.reverse()
|
||||||
|
|
||||||
|
|
|
@ -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
|
table
|
||||||
|
|
|
@ -51,9 +51,6 @@ class App.DashboardActivityStream extends App.Controller
|
||||||
@$('.activity-entries').remove()
|
@$('.activity-entries').remove()
|
||||||
@el.append html
|
@el.append html
|
||||||
|
|
||||||
# update time
|
|
||||||
@frontendTimeUpdate()
|
|
||||||
|
|
||||||
renderItem: (item) ->
|
renderItem: (item) ->
|
||||||
html = $(App.view('dashboard/activity_stream')(
|
html = $(App.view('dashboard/activity_stream')(
|
||||||
item: item
|
item: item
|
||||||
|
|
|
@ -42,9 +42,6 @@ class Index extends App.ControllerContent
|
||||||
sessions: data.sessions
|
sessions: data.sessions
|
||||||
)
|
)
|
||||||
|
|
||||||
# show frontend times
|
|
||||||
@frontendTimeUpdate()
|
|
||||||
|
|
||||||
destroy: (e) ->
|
destroy: (e) ->
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
sessionId = $( e.target ).closest('a').data('session-id')
|
sessionId = $( e.target ).closest('a').data('session-id')
|
||||||
|
|
|
@ -321,9 +321,6 @@ class Table extends App.Controller
|
||||||
# start organization popups
|
# start organization popups
|
||||||
@organizationPopups()
|
@organizationPopups()
|
||||||
|
|
||||||
# show frontend times
|
|
||||||
@frontendTimeUpdate()
|
|
||||||
|
|
||||||
# start bulk action observ
|
# start bulk action observ
|
||||||
@el.find('.bulkAction').append( @bulk_form() )
|
@el.find('.bulkAction').append( @bulk_form() )
|
||||||
if @el.find('.table-overview').find('input[name="bulk"]:checked').length isnt 0
|
if @el.find('.table-overview').find('input[name="bulk"]:checked').length isnt 0
|
||||||
|
|
|
@ -112,9 +112,6 @@ class ArticleViewItem extends App.Controller
|
||||||
article: @article
|
article: @article
|
||||||
)
|
)
|
||||||
|
|
||||||
# show frontend times
|
|
||||||
@frontendTimeUpdate()
|
|
||||||
|
|
||||||
# set see more option
|
# set see more option
|
||||||
@setSeeMore()
|
@setSeeMore()
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,5 @@ class App.TicketZoomMeta extends App.Controller
|
||||||
isCustomer: @isRole('Customer')
|
isCustomer: @isRole('Customer')
|
||||||
)
|
)
|
||||||
|
|
||||||
# show frontend times
|
|
||||||
@frontendTimeUpdate()
|
|
||||||
|
|
||||||
release: =>
|
release: =>
|
||||||
App.Ticket.unsubscribe( @subscribeId )
|
App.Ticket.unsubscribe( @subscribeId )
|
|
@ -130,9 +130,6 @@ class App.OnlineNotificationWidget extends App.Controller
|
||||||
$( App.view('widget/online_notification_content')(items: items) )
|
$( App.view('widget/online_notification_content')(items: items) )
|
||||||
)
|
)
|
||||||
|
|
||||||
# show frontend times
|
|
||||||
@frontendTimeUpdate()
|
|
||||||
|
|
||||||
createContainer: =>
|
createContainer: =>
|
||||||
@removeContainer()
|
@removeContainer()
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,6 @@ class TicketStatsList extends App.Controller
|
||||||
limit: @limit
|
limit: @limit
|
||||||
)
|
)
|
||||||
|
|
||||||
@frontendTimeUpdate()
|
|
||||||
@ticketPopups()
|
@ticketPopups()
|
||||||
|
|
||||||
showAll: (e) =>
|
showAll: (e) =>
|
||||||
|
|
|
@ -107,7 +107,12 @@ class App extends Spine.Controller
|
||||||
# use pretty time for datetime
|
# use pretty time for datetime
|
||||||
else if attribute_config.tag is 'datetime'
|
else if attribute_config.tag is 'datetime'
|
||||||
isHtmlEscape = true
|
isHtmlEscape = true
|
||||||
result = "<span class=\"humanTimeFromNow #{attribute_config.class}\" data-time=\"#{result}\">?</span>"
|
timestamp = App.i18n.translateTimestamp(result)
|
||||||
|
escalation = undefined
|
||||||
|
if attribute_config.class is 'escalation'
|
||||||
|
escalation
|
||||||
|
humanTime = App.PrettyDate.humanTime(result, escalation)
|
||||||
|
result = "<span class=\"humanTimeFromNow #{attribute_config.class}\" data-time=\"#{result}\" data-tooltip=\"#{timestamp}\">#{humanTime}</span>"
|
||||||
#result = App.i18n.translateTimestamp(result)
|
#result = App.i18n.translateTimestamp(result)
|
||||||
|
|
||||||
if !isHtmlEscape && typeof result is 'string'
|
if !isHtmlEscape && typeof result is 'string'
|
||||||
|
@ -216,6 +221,14 @@ class App extends Spine.Controller
|
||||||
params.humanFileSize = ( size ) ->
|
params.humanFileSize = ( size ) ->
|
||||||
App.Utils.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
|
# define template
|
||||||
JST["app/views/#{name}"](params)
|
JST["app/views/#{name}"](params)
|
||||||
template
|
template
|
||||||
|
|
|
@ -21,6 +21,9 @@ class App.Run extends App.Controller
|
||||||
# create web socket connection
|
# create web socket connection
|
||||||
App.WebSocket.connect()
|
App.WebSocket.connect()
|
||||||
|
|
||||||
|
# start frontend time update
|
||||||
|
@frontendTimeUpdate()
|
||||||
|
|
||||||
# start navbars
|
# start navbars
|
||||||
@setupWidget( 'Navigations', 'nav', @el )
|
@setupWidget( 'Navigations', 'nav', @el )
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<span class="activity-text">
|
<span class="activity-text">
|
||||||
<%= @item.created_by.displayName() %> <%- @T( @item.type ) %> <%- @T( @item.object_name ) %><% if @item.title: %> (<%= @item.title %>)<% end %>
|
<%= @item.created_by.displayName() %> <%- @T( @item.type ) %> <%- @T( @item.object_name ) %><% if @item.title: %> (<%= @item.title %>)<% end %>
|
||||||
</span>
|
</span>
|
||||||
<span class="activity-time humanTimeFromNow" data-time="<%- @item.created_at %>">?</span>
|
<span class="activity-time humanTimeFromNow" data-time="<%- @item.created_at %>" data-tooltip="<%- @timestamp(@item.created_at) %>"><%- @humanTime(@item.created_at) %></span>
|
||||||
</span>
|
</span>
|
||||||
<span class="activity-icon">
|
<span class="activity-icon">
|
||||||
<span class="<%- @item.cssIcon %> icon"></span>
|
<span class="<%- @item.cssIcon %> icon"></span>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
<% for item in @items: %>
|
<% for item in @items: %>
|
||||||
<span class="user-popover" data-id="<%= item.created_by.id %>"><%= item.created_by.displayName() %></span> -
|
<span class="user-popover" data-id="<%= item.created_by.id %>"><%= item.created_by.displayName() %></span> -
|
||||||
<span class="humanTimeFromNow" data-time="<%- item.created_at %>">?</span>
|
<span class="humanTimeFromNow" data-time="<%- item.created_at %>" data-tooltip="<%- @timestamp(item.created_at) %>"><%- @humanTime(item.created_at) %></span>
|
||||||
<ul>
|
<ul>
|
||||||
<% for content in item.records: %>
|
<% for content in item.records: %>
|
||||||
<li><%- content %></li>
|
<li><%- content %></li>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="task-text">
|
<div class="task-text">
|
||||||
<a class="name ticket-popover" data-id="<%- item.id %>" href="#ticket/zoom/<%= item.id %>"><%= item.title %></a>
|
<a class="name ticket-popover" data-id="<%- item.id %>" href="#ticket/zoom/<%= item.id %>"><%= item.title %></a>
|
||||||
<div class="time humanTimeFromNow" data-time="<%- item.created_at %>"></div>
|
<div class="time humanTimeFromNow" data-time="<%- item.created_at %>" data-tooltip="<%- @timestamp(item.created_at) %>"><%- @humanTime(item.created_at) %></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="sidebar-list-item-delete js-delete" data-object="Ticket" data-object-id="<%= item.id %>" data-link-type="<%= type %>" data-type="remove">
|
<div class="sidebar-list-item-delete js-delete" data-object="Ticket" data-object-id="<%= item.id %>" data-link-type="<%= type %>" data-type="remove">
|
||||||
<svg class="icon icon-diagonal-cross"><use xlink:href="#icon-diagonal-cross" /></svg>
|
<svg class="icon icon-diagonal-cross"><use xlink:href="#icon-diagonal-cross" /></svg>
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
<td><% if session.data.user: %><%= session.data.user.displayName() %><% end %></td>
|
<td><% if session.data.user: %><%= session.data.user.displayName() %><% end %></td>
|
||||||
<td title="<%= session.data.user_agent %>"><%= session.data.user_agent %></td>
|
<td title="<%= session.data.user_agent %>"><%= session.data.user_agent %></td>
|
||||||
<td title="<%= session.data.remote_id %>"><% if session.data.geo && session.data.geo.country_name: %><%= session.data.geo.country_name %> <%= session.data.geo.city_name %><% else: %><%= session.data.remote_id %><% end %></td>
|
<td title="<%= session.data.remote_id %>"><% if session.data.geo && session.data.geo.country_name: %><%= session.data.geo.country_name %> <%= session.data.geo.city_name %><% else: %><%= session.data.remote_id %><% end %></td>
|
||||||
<td><span class="humanTimeFromNow" data-time="<%- session.created_at %>">?</span></td>
|
<td><span class="humanTimeFromNow" data-time="<%- session.created_at %>" data-tooltip="<%- @timestamp(session.created_at) %>"><%- @humanTime(session.created_at) %></span></td>
|
||||||
<td><span class="humanTimeFromNow" data-time="<%- session.updated_at %>">?</span></td>
|
<td><span class="humanTimeFromNow" data-time="<%- session.updated_at %>" data-tooltip="<%- @timestamp(session.updated_at) %>"><%- @humanTime(session.updated_at) %></span></td>
|
||||||
<td><a href="#" data-session-id="<%- session.id %>" data-type="delete" title="<%- @Ti('Delete') %>"><svg class="icon-trash" data-type="destroy"><use xlink:href="#icon-trash"></use></svg></a></td>
|
<td><a href="#" data-session-id="<%- session.id %>" data-type="delete" title="<%- @Ti('Delete') %>"><svg class="icon-trash" data-type="destroy"><use xlink:href="#icon-trash"></use></svg></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -82,4 +82,4 @@
|
||||||
|
|
||||||
<div class="js-article-actions"></div>
|
<div class="js-article-actions"></div>
|
||||||
|
|
||||||
<small class="task-subline zIndex-1"><time class="humanTimeFromNow" data-time="<%- @article.created_at %>">?</time></small>
|
<small class="task-subline zIndex-1"><time class="humanTimeFromNow" data-time="<%- @article.created_at %>" data-tooltip="<%- @timestamp(@article.created_at) %>x"><%- @humanTime(@article.created_at) %>x</time></small>
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
<small class="task-subline">
|
<small class="task-subline">
|
||||||
<%- @C('ticket_hook') %> <span class="ticket-number"><%- @ticket.number %></span> - <%- @T('created') %> <span class="humanTimeFromNow" data-time="<%- @ticket.created_at %>">?</span> <% if !@isCustomer && @ticket.escalation_time: %> - <%- @T('escalation') %> <span class="humanTimeFromNow escalation" data-time="<%- @ticket.escalation_time %>">?</span><% end %>
|
<%- @C('ticket_hook') %> <span class="ticket-number"><%- @ticket.number %></span> - <%- @T('created') %> <span class="humanTimeFromNow" data-time="<%- @ticket.created_at %>" data-tooltip="<%- @timestamp(@ticket.created_at) %>"><%- @humanTime(@ticket.created_at) %></span> <% if !@isCustomer && @ticket.escalation_time: %> - <%- @T('escalation') %> <span class="humanTimeFromNow escalation" data-time="<%- @ticket.escalation_time %>" data-tooltip="<%- @timestamp(@ticket.escalation_time) %>"><%- @humanTime(@ticket.escalation_time, true) %></span><% end %>
|
||||||
</small>
|
</small>
|
|
@ -9,7 +9,7 @@
|
||||||
<span class="activity-text">
|
<span class="activity-text">
|
||||||
<%= item.created_by.displayName() %> <%- @T( item.type ) %> <%- @T( item.object_name ) %><% if item.title: %> (<%= item.title %>)<% end %>
|
<%= item.created_by.displayName() %> <%- @T( item.type ) %> <%- @T( item.object_name ) %><% if item.title: %> (<%= item.title %>)<% end %>
|
||||||
</span>
|
</span>
|
||||||
<span class="activity-time humanTimeFromNow" data-time="<%- item.created_at %>">?</span>
|
<span class="activity-time humanTimeFromNow" data-time="<%- item.created_at %>" data-tooltip="<%- @timestamp(item.created_at) %>"><%- @humanTime(item.created_at) %></span>
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="task-text">
|
<div class="task-text">
|
||||||
<a class="name ticket-popover" data-id="<%- ticket_id %>" href="<%- ticket.uiUrl() %>"><%= ticket.title %></a>
|
<a class="name ticket-popover" data-id="<%- ticket_id %>" href="<%- ticket.uiUrl() %>"><%= ticket.title %></a>
|
||||||
<div class="time humanTimeFromNow" data-time="<%- ticket.created_at %>"></div>
|
<div class="time humanTimeFromNow" data-time="<%- ticket.created_at %>" data-tooltip="<%- @timestamp(ticket.created_at) %>"><%- @humanTime(ticket.created_at) %></div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in a new issue