]> source.dussan.org Git - sonarqube.git/commitdiff
New Issues Page: refactoring
authorStas Vilchik <vilchiks@gmail.com>
Tue, 4 Feb 2014 09:24:47 +0000 (15:24 +0600)
committerStas Vilchik <vilchiks@gmail.com>
Tue, 4 Feb 2014 09:24:47 +0000 (15:24 +0600)
sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue_detail_inner.hbs.erb
sonar-server/src/main/webapp/javascripts/navigator/handlebars-extensions.js
sonar-server/src/main/webapp/javascripts/navigator/issues.js
sonar-server/src/main/webapp/stylesheets/style.css

index a2fb401623b81c6dd383972789f630b0d3abf030..8409ddf70550591dc1ae39fc9781386ceeb4d6a1 100644 (file)
@@ -1,14 +1,16 @@
 <script id="issue-detail-inner-template" type="text/x-handlebars-template">
-  <div class="code-issue" data-issue-key="{{key}}" data-issue-component="{{component}}" data-issue-rule="{{rule}}">
+  <div class="code-issue code-issue-collapsed" data-issue-key="{{key}}" data-issue-component="{{component}}" data-issue-rule="{{rule}}">
     <div class="code-issue-permalink">
       <a target="_blank" href="<%= ApplicationController.root_context -%>/issue/show/{{key}}?layout=false"><img src="<%= ApplicationController.root_context -%>/images/new-window-16.gif"></a>
     </div>
 
     <div class="code-issue-name">
-      {{severityIcon severity}}&nbsp;<span class="rulename">{{ruleName}}</span>
-    </div>
+        {{severityIcon severity}}&nbsp;<a class="code-issue-toggle rulename">{{message}}</a>
 
-    <div class="code-issue-msg">{{{message}}}</div>
+        {{#if debt}}
+          <div class="code-issue-name-extra"><%= message('issue.technical_debt') -%> {{debt}}</div>
+        {{/if}}
+    </div>
 
     <div class="code-issue-details">
       <ul class="tabs">
 
       <div id="tab-issue-details">
         <ul class="code-issue-details-list">
-          <li>
-            <div class="code-issue-details-term"><%= message('severity') -%></div>
-            <div class="code-issue-details-value">
-              {{severityIcon severity}}{{capitalize severity}}
-            </div>
-          </li>
-          <li>
-            <div class="code-issue-details-term"><%= message('status') -%></div>
-            <div class="code-issue-details-value">
-              {{statusIcon status}}{{capitalize status}}
-            </div>
-          </li>
-          <li>
-            <div class="code-issue-details-term"><%= message('resolution') -%></div>
-            <div class="code-issue-details-value">
-              {{#if resolution}}
-                {{resolutionIcon resolution}}{{capitalize resolution}}
-              {{else}}
-                <%= message('unresolved') -%>
-              {{/if}}
-            </div>
-          </li>
-          {{#if actionPlanName}}
-            <li>
-              <div class="code-issue-details-term"><%= message('issue_filter.header.action_plan') -%></div>
-              <div class="code-issue-details-value">{{actionPlanName}}</div>
-            </li>
-          {{/if}}
           {{#if debt}}
             <li>
               <div class="code-issue-details-term"><%= message('issue.technical_debt_clear') -%></div>
               <div class="code-issue-details-value">{{author}}</div>
             </li>
           {{/if}}
-          {{# if assigneeName}}
-            <li>
-              <div class="code-issue-details-term"><%= message('assignee') -%></div>
-              <div class="code-issue-details-value">{{assigneeName}}</div>
-            </li>
-          {{/if}}
           <li>
             <div class="code-issue-details-term"><%= message('created') -%></div>
             <div class="code-issue-details-value">{{fCreationDate}}</div>
       {{/each}}
     </div>
 
-    {{#ifNotEmpty actions transitions}}
-      <ul class="code-issue-actions">
-        {{#inArray actions "comment"}}
-          <li>
-            <a id="issue-comment" class="link-action">{{translate "actions.comment" }}</a>
-          </li>
-        {{/inArray}}
+    <ul class="code-issue-actions">
+      {{#inArray actions "comment"}}
+        <li>
+          <a id="issue-comment" class="link-action">{{translate "actions.comment" }}</a>
+        </li>
+      {{/inArray}}
 
-        {{#inArray actions "assign"}}
-          <li>
+
+      <li>{{statusIcon status}}{{capitalize status}}</li>
+
+      {{#if resolution}}
+        <li>{{resolutionIcon resolution}}{{capitalize resolution}}</li>
+      {{/if}}
+
+
+      {{#ifNotEmpty transitions}}
+        <li>
+          {{#withFirst transitions}}
+            <a class="link-action issue-transition" data-transition="{{this}}">{{translate "transitions" this}}</a>
+          {{/withFirst}}
+
+          {{#ifHasExtraTransitions transitions}}
+              <div class="dropdown">
+                <a class="link-action link-more" onclick="showDropdownMenuOnElement($j(this).next('.dropdown-menu')); return false;"></a>
+                <ul style="display: none" class="dropdown-menu">
+                  {{#withoutFirst transitions}}
+                    <li>
+                      <a class="link-action issue-transition" data-transition="{{this}}">{{translate "transitions" this}}</a>
+                    </li>
+                  {{/withoutFirst}}
+                </ul>
+              </div>
+
+          {{/ifHasExtraTransitions}}
+        </li>
+      {{/ifNotEmpty}}
+
+
+      {{#inArray actions "assign"}}
+        <li>
+          {{#if assigneeName}}
+            <a id="issue-assign" class="link-action"><%= message('assigned_to') -%></a> {{assigneeName}}</li>
+          {{else}}
             <a id="issue-assign" class="link-action">{{translate "actions.assign" }}</a>
             {{#inArray actions "assign_to_me"}}
               [<a id="issue-assign-to-me" class="link-action">{{translate "actions.assign_to_me" }}</a>]
             {{/inArray}}
-          </li>
-        {{/inArray}}
+          {{/if}}
+        </li>
+      {{else}}
+        {{#if assigneeName}}
+          <li><%= message('assigned_to') -%> <strong>{{assigneeName}}</strong></li>
+        {{/if}}
+      {{/inArray}}
+
 
+      <li>
         {{#inArray actions "plan"}}
-          <li>
-            <a id="issue-plan" class="link-action">{{translate "actions.plan" }}</a>
-          </li>
+          {{#if actionPlanName}}
+            <a id="issue-plan" class="link-action"><%= message('issue.planned_for') -%></a> {{actionPlanName}}
+          {{else}}
+            <a id="issue-plan" class="link-action"><%= message('issue.do_plan') -%></a>
+          {{/if}}
+        {{else}}
+          {{#if actionPlanName}}
+            <%= message('issue.planned_for') -%> <strong>{{actionPlanName}}</strong>
+          {{/if}}
         {{/inArray}}
+      </li>
 
-        {{#withFirst transitions}}
-          <li>
-            <a class="link-action issue-transition" data-transition="{{this}}">{{translate "transitions" this}}</a>
-          </li>
-        {{/withFirst}}
 
-        {{#ifHasExtraActions actions transitions}}
-          <li>
-            <div class="dropdown">
-              <a class="link-action link-more" onclick="showDropdownMenuOnElement($j(this).next('.dropdown-menu')); return false;">More actions</a>
-              <ul style="display: none" class="dropdown-menu">
-                {{#inArray actions "set_severity"}}
-                  <li>
-                    <a id="issue-set-severity" class="link-action spacer-right">{{translate "actions.set_severity"}}</a>
-                  </li>
-                {{/inArray}}
-                {{#pluginActions actions}}
-                  <li>
-                    <a class="link-action spacer-right issue-action" data-action="{{this}}">{{translate "actions" this}}</a>
-                  </li>
-                {{/pluginActions}}
-                {{#withoutFirst transitions}}
-                  <li>
-                    <a class="link-action spacer-right issue-transition" data-transition="{{this}}">{{translate "transitions" this}}</a>
-                  </li>
-                {{/withoutFirst}}
-              </ul>
-            </div>
-          </li>
-        {{/ifHasExtraActions}}
-      </ul>
-    {{/ifNotEmpty}}
+      {{#ifHasExtraActions actions}}
+        <li>
+          <div class="dropdown">
+            <a class="link-action link-more" onclick="showDropdownMenuOnElement($j(this).next('.dropdown-menu')); return false;">More actions</a>
+            <ul style="display: none" class="dropdown-menu">
+              {{#inArray actions "set_severity"}}
+                <li>
+                  <a id="issue-set-severity" class="link-action spacer-right">{{translate "actions.set_severity"}}</a>
+                </li>
+              {{/inArray}}
+              {{#pluginActions actions}}
+                <li>
+                  <a class="link-action spacer-right issue-action" data-action="{{this}}">{{translate "actions" this}}</a>
+                </li>
+              {{/pluginActions}}
+            </ul>
+          </div>
+        </li>
+      {{/ifHasExtraActions}}
+    </ul>
 
     <div class="code-issue-form"></div>
   </div>
index 6f16b66547a48ba5d72736e0678a8d8f4d99eb0c..c66b76a3c070f43118334b929fc1f46383f5e570 100644 (file)
     }, '');
   });
 
-  Handlebars.registerHelper('ifHasExtraActions', function(actions, transitions, options) {
+  Handlebars.registerHelper('ifHasExtraTransitions', function(transitions, options) {
+    if (transitions && transitions.length > 1) {
+      return options.fn(this);
+    } else {
+      return '';
+    }
+  });
+
+  Handlebars.registerHelper('ifHasExtraActions', function(actions, options) {
     var actionsLeft = _.difference(actions, _.without(defaultActions, 'set_severity'));
-    if (actionsLeft.length > 0 || transitions.length > 1) {
+    if (actionsLeft.length > 0) {
       return options.fn(this);
     } else {
       return '';
index 71bb02c900913d5f77479502691c394693044fb3..5d39841af3af5d4a2761bc6ebb067ae76b3a6ba8 100644 (file)
@@ -782,6 +782,8 @@ jQuery(function() {
 
 
     events: {
+      'click .code-issue-toggle': 'toggleCollapsed',
+
       'click [href=#tab-issue-rule]': 'fetchRule',
 
       'click #issue-comment': 'comment',
@@ -824,6 +826,11 @@ jQuery(function() {
     },
 
 
+    toggleCollapsed: function() {
+      this.$('.code-issue').toggleClass('code-issue-collapsed');
+    },
+
+
     fetchRule: function() {
       var that = this;
       this.$('#tab-issue-rule').addClass('navigator-fetching');
index 3b3d36e771c03ee28667edc6534706916e34f492..3161c74182c2ad8edb3d1ad678026b5b9ff158ad 100644 (file)
@@ -798,11 +798,25 @@ th.operations, td.operations {
   padding: 0 0 10px 0;
 }
 
+.code-issue strong {
+  font-weight: bold;
+}
+
 .code-issue-permalink {
   float: right;
   padding: 4px 4px 0 0;
 }
 
+.code-issue-name-extra {
+  float: right;
+  padding-right: 10px;
+}
+
+.code-issue-toggle {
+  cursor: pointer;
+  text-decoration: underline;
+}
+
 .code-issue-name {
   background-color: #E4ECF3;
   margin: 0;
@@ -874,7 +888,6 @@ th.operations, td.operations {
   height: auto;
   padding: 5px 10px;
   border-bottom: 1px solid #DDD;
-  background: #E4ECF3;
 }
 
 .code-issue-details .tabs li + li {