From c78ce77410e5391f120bbcc86b1646f4183c8d4f Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Wed, 10 Dec 2014 10:41:45 +0100 Subject: [PATCH] SONAR-5718 Fix scrolling between issues --- .../main/coffee/issues/component-viewer/main.coffee | 3 +-- .../main/coffee/issues/workspace-list-view.coffee | 13 ++++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/server/sonar-web/src/main/coffee/issues/component-viewer/main.coffee b/server/sonar-web/src/main/coffee/issues/component-viewer/main.coffee index 098e878aa45..2b0be2c80b3 100644 --- a/server/sonar-web/src/main/coffee/issues/component-viewer/main.coffee +++ b/server/sonar-web/src/main/coffee/issues/component-viewer/main.coffee @@ -91,8 +91,7 @@ define [ selected = @options.app.state.get 'selectedIndex' selectedIssue = @options.app.issues.at selected if selectedIssue.get('component') == @model.get('key') - selectedKey = selectedIssue.get 'key' - @scrollToIssue selectedKey + @scrollToLine selectedIssue.get('line') else @unbindShortcuts() @options.app.controller.showComponentViewer selectedIssue diff --git a/server/sonar-web/src/main/coffee/issues/workspace-list-view.coffee b/server/sonar-web/src/main/coffee/issues/workspace-list-view.coffee index e0fd474ce63..ac346acc243 100644 --- a/server/sonar-web/src/main/coffee/issues/workspace-list-view.coffee +++ b/server/sonar-web/src/main/coffee/issues/workspace-list-view.coffee @@ -12,7 +12,8 @@ define [ $ = jQuery - TOP_OFFSET = 72 + TOP_OFFSET = 43 + COMPONENT_HEIGHT = 29 BOTTOM_OFFSET = 10 @@ -124,14 +125,16 @@ define [ selectedIssue = @collection.at @options.app.state.get 'selectedIndex' return unless selectedIssue? selectedIssueView = @children.findByModel selectedIssue - viewTop = selectedIssueView.$el.offset().top - viewBottom = viewTop + selectedIssueView.$el.outerHeight() + viewTop = selectedIssueView.$el.offset().top - TOP_OFFSET + if selectedIssueView.$el.prev().is('.issues-workspace-list-component') + viewTop -= COMPONENT_HEIGHT + viewBottom = selectedIssueView.$el.offset().top + selectedIssueView.$el.outerHeight() + BOTTOM_OFFSET windowTop = $(window).scrollTop() windowBottom = windowTop + $(window).height() if viewTop < windowTop - $(window).scrollTop viewTop - TOP_OFFSET + $(window).scrollTop viewTop if viewBottom > windowBottom - $(window).scrollTop $(window).scrollTop() - windowBottom + viewBottom + BOTTOM_OFFSET + $(window).scrollTop $(window).scrollTop() - windowBottom + viewBottom appendHtml: (compositeView, itemView, index) -> -- 2.39.5