From f0b37a4fa90387e14a9d132b446de5106203cd93 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 2 Dec 2015 00:33:29 +0100 Subject: [PATCH] Reduced dom operations. --- .../app/controllers/ticket_zoom.coffee | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.coffee index 987b7ca7f..a5829b281 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.coffee @@ -336,14 +336,13 @@ class App.TicketZoom extends App.Controller ) @articleView = new App.TicketZoomArticleView( - ticket: @ticket - el: elLocal.find('.ticket-article') - ui: @ - highligher: @highligher + ticket: @ticket + el: elLocal.find('.ticket-article') + ui: @ + highligher: @highligher + ticket_article_ids: @ticket_article_ids ) - @html elLocal - # rerender whole sidebar if customer or organization has changed if @ticketLastAttributes.customer_id isnt @ticket.customer_id || @ticketLastAttributes.organization_id isnt @ticket.organization_id new App.WidgetAvatar( @@ -351,8 +350,12 @@ class App.TicketZoom extends App.Controller user_id: @ticket.customer_id size: 50 ) + if elLocal + el = elLocal + else + el = @el @sidebar = new App.TicketZoomSidebar( - el: @$('.tabsSidebar') + el: el.find('.tabsSidebar') sidebarState: @sidebarState ticket: @ticket taskGet: @taskGet @@ -362,10 +365,15 @@ class App.TicketZoom extends App.Controller formMeta: @formMeta ) + # render init page + if elLocal + @html elLocal + # show article - @articleView.execute( - ticket_article_ids: @ticket_article_ids - ) + else + @articleView.execute( + ticket_article_ids: @ticket_article_ids + ) # scroll to article if given if @article_id && document.getElementById( 'article-' + @article_id )