]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5877 Improve consistency of scm tooltips
authorStas Vilchik <stasvilchik@Stas-Vilchik-iMac.local>
Wed, 10 Dec 2014 09:18:27 +0000 (10:18 +0100)
committerStas Vilchik <stasvilchik@Stas-Vilchik-iMac.local>
Wed, 10 Dec 2014 09:18:27 +0000 (10:18 +0100)
server/sonar-web/src/main/coffee/component-viewer/source.coffee
server/sonar-web/src/main/hbs/component-viewer/cw-source.hbs
server/sonar-web/src/main/hbs/source-viewer/source-viewer-scm-popup.hbs
server/sonar-web/src/main/hbs/source-viewer/source-viewer.hbs

index 2b1cc7c3de47aa9d1cd749278fd55a09f8fb6653..42ae5c0571980d33fb98b372301b6cc4dc1e526b 100644 (file)
@@ -1,6 +1,7 @@
 define [
   'backbone.marionette'
   'templates/component-viewer'
+  'source-viewer/popups/scm-popup'
   'component-viewer/coverage-popup'
   'component-viewer/duplication-popup'
   'component-viewer/time-changes-popup'
@@ -11,6 +12,7 @@ define [
 ], (
   Marionette
   Templates
+  SCMPopupView
   CoveragePopupView
   DuplicationPopupView
   TimeChangesPopupView
@@ -41,6 +43,8 @@ define [
 
       'click .js-line-actions': 'highlightLine'
 
+      'click .source-line-scm': 'showSCMPopup'
+
       'click .source-line-covered': 'showCoveragePopup'
       'click .source-line-partially-covered': 'showCoveragePopup'
       'click .source-line-uncovered': 'showCoveragePopup'
@@ -205,6 +209,19 @@ define [
       row.toggleClass 'component-viewer-header-full'
 
 
+    showSCMPopup: (e) ->
+      e.stopPropagation()
+      $('body').click()
+      line = +$(e.currentTarget).closest('[data-line-number]').data 'line-number'
+      row = _.findWhere @options.main.source.get('formattedSource'), lineNumber: line
+      popup = new SCMPopupView
+        triggerEl: $(e.currentTarget)
+        model: new Backbone.Model
+          scmAuthor: row.scm.author
+          scmDate: row.scm.date
+      popup.render()
+
+
     showCoveragePopup: (e) ->
       e.stopPropagation()
       $('body').click()
index 503605dcdddaf33b5b14fe3f16792468547be02c..dbb80fcf7cf8adbd7556a6a1d729c179da6daf6e 100644 (file)
@@ -54,7 +54,7 @@
               <td class="source-meta {{#if scm}}source-line-scm{{/if}}">
                 {{#if scm}}
                   {{#ifSCMChanged ../../../../source ../../../lineNumber}}
-                    <div class="source-line-scm-inner" title="{{scm.author}}&#013;{{dt scm.date}}" data-author="{{scm.author}}"></div>
+                    <div class="source-line-scm-inner" data-author="{{scm.author}}"></div>
                   {{/ifSCMChanged}}
                 {{/if}}
               </td>
index 9eef858a15ffb9dcd8235140922a2be0a3de2a35..768ea72341dd8ff46dbf800139c053fc03d854b3 100644 (file)
@@ -5,9 +5,11 @@
   <div class="bubble-popup-section">
     {{dt scmDate}}
   </div>
-  <div class="bubble-popup-section">
-    {{scmRevision}}
-  </div>
+  {{#if scmRevision}}
+    <div class="bubble-popup-section">
+      {{scmRevision}}
+    </div>
+  {{/if}}
 </div>
 
 <div class="bubble-popup-arrow"></div>
index 51c77b080d702393752085cae0e835dee09a7899..c58e2a4ad8317ef67bff4a3b99016a002a2cd5c5 100644 (file)
@@ -9,7 +9,7 @@
 
       <td class="source-meta source-line-scm" {{#if line}}data-line-number="{{line}}"{{/if}}>
         {{#ifSCMChanged2 ../source line}}
-          <div class="source-line-scm-inner" title="{{scmAuthor}} {{scmDate}}" data-author="{{scmAuthor}}"></div>
+          <div class="source-line-scm-inner" data-author="{{scmAuthor}}"></div>
         {{/ifSCMChanged2}}
       </td>