]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5718 Select issue by mouse
authorStas Vilchik <vilchiks@gmail.com>
Fri, 7 Nov 2014 09:21:41 +0000 (10:21 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Fri, 7 Nov 2014 09:21:48 +0000 (10:21 +0100)
server/sonar-web/src/main/coffee/issues/component-viewer/main.coffee
server/sonar-web/src/main/coffee/issues/workspace-list-item-view.coffee

index 211fa09d17b3d8a06493581165eb6c9537cc1142..4534e3036cead46a89a28b079bbf4eb0bc90d504 100644 (file)
@@ -32,6 +32,7 @@ define [
     events:
       'click .js-close-component-viewer': 'closeComponentViewer'
       'click .sym': 'highlightUsages'
+      'click .code-issue': 'selectIssue'
 
 
     initialize: (options) ->
@@ -170,6 +171,13 @@ define [
       if selectedIssueView.length > 0 then selectedIssueView else null
 
 
+    selectIssue: (e) ->
+      key = $(e.currentTarget).data 'issue-key'
+      issue = @issues.find (issue) -> issue.get('key') == key
+      index = @options.app.issues.indexOf issue
+      @options.app.state.set selectedIndex: index
+
+
     scrollToIssue: (key) ->
       el = @$("[data-issue-key='#{key}']")
       if el.length > 0
index ce2579232141303feb8a29e0565e6c0d9e7b4844..dff3404568d7ebe0d31c643ba4c61eb3d12156b9 100644 (file)
@@ -15,6 +15,7 @@ define [
 
 
     events:
+      'click': 'selectCurrent'
       'click .js-issues-to-source': 'openComponentViewer'
 
 
@@ -33,6 +34,10 @@ define [
       @$el.toggleClass 'selected', selected
 
 
+    selectCurrent: ->
+      @options.app.state.set selectedIndex: @options.index
+
+
     onClose: ->
       @issueBoxView?.close()