aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <stasvilchik@Stas-Vilchik-iMac.local>2014-12-10 10:41:45 +0100
committerStas Vilchik <stasvilchik@Stas-Vilchik-iMac.local>2014-12-10 10:41:45 +0100
commitc78ce77410e5391f120bbcc86b1646f4183c8d4f (patch)
treea0b35142e263d29e67a280f09d1bc14475ae8952
parente7e8b644d85610c3834532abc73762c43dce15d9 (diff)
downloadsonarqube-c78ce77410e5391f120bbcc86b1646f4183c8d4f.tar.gz
sonarqube-c78ce77410e5391f120bbcc86b1646f4183c8d4f.zip
SONAR-5718 Fix scrolling between issues
-rw-r--r--server/sonar-web/src/main/coffee/issues/component-viewer/main.coffee3
-rw-r--r--server/sonar-web/src/main/coffee/issues/workspace-list-view.coffee13
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) ->