From cf20e4f4a5e3dacc3870252c16bba70658683e52 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 14 Sep 2015 20:18:21 +0200 Subject: [PATCH] Improved styling performance for IE. --- .../app/controllers/ticket_zoom.js.coffee | 34 +++++++++++++------ .../ticket_zoom/article_view.js.coffee | 8 +++-- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee index cf8bd7ce2..1e210c3a7 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee @@ -98,23 +98,31 @@ class App.TicketZoom extends App.Controller if @activeState @scrollToBottom() return - @activeState = true + # start autosave @autosaveStart() - App.Event.trigger('ui::ticket::shown', { ticket_id: @ticket_id } ) - # inital load of highlights if @highligher && !@highlighed @highlighed = true @highligher.loadHighlights() - @positionPageHeaderStart() + if !@shown + + # trigger shown to article + App.Event.trigger('ui::ticket::shown', { ticket_id: @ticket_id } ) + + # observe content header position + @positionPageHeaderStart() hide: => @activeState = false + + # stop observing content header position @positionPageHeaderStop() + + # stop autosave @autosaveStop() changed: => @@ -352,15 +360,18 @@ class App.TicketZoom extends App.Controller @scrollTo( 0, offset ) @delay( scrollTo, 100, false ) - @scrollToBottom() - - @positionPageHeaderStart() - @ticketLastAttributes = @ticket.attributes() - # trigger shown - if @activeState - App.Event.trigger('ui::ticket::shown', { ticket_id: @ticket.id } ) + if @shown + + # scroll to end of page + @scrollToBottom() + + # observe content header position + @positionPageHeaderStart() + + # trigger shown if init shown render + App.Event.trigger('ui::ticket::shown', { ticket_id: @ticket_id } ) scrollToBottom: => @main.scrollTop( @main.prop('scrollHeight') ) @@ -636,6 +647,7 @@ class TicketZoomRouter extends App.ControllerPermanent ticket_id: params.ticket_id article_id: params.article_id nav: params.nav + shown: true App.TaskManager.execute( key: 'Ticket-' + @ticket_id 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 845371ab1..798ec1755 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 @@ -38,12 +38,14 @@ class ArticleViewItem extends App.Controller @render() - # set article type and expand text area + # set expand of text area only once @bind( 'ui::ticket::shown' (data) => - if data.ticket_id.toString() is @ticket.id.toString() - @setSeeMore() + if !@shown + if data.ticket_id.toString() is @ticket.id.toString() + @setSeeMore() + @shown = true ) # subscribe to changes