]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5007 Refactor coding rules list & details
authorStas Vilchik <vilchiks@gmail.com>
Mon, 17 Mar 2014 11:53:58 +0000 (17:53 +0600)
committerStas Vilchik <vilchiks@gmail.com>
Mon, 17 Mar 2014 11:54:10 +0000 (17:54 +0600)
sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_detail_template.hbs.erb
sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_list_item_template.hbs.erb
sonar-server/src/main/webapp/javascripts/coding-rules/mockjax.coffee
sonar-server/src/main/webapp/javascripts/coding-rules/mockjax.js
sonar-server/src/main/webapp/stylesheets/coding-rules.css
sonar-server/src/main/webapp/stylesheets/coding-rules.less

index 621f7a4399db7ce5efe7884ee0cd2bc3fe0a9031..d0abf0748a16885ad4e44e131cffbeeb244cf0ba 100644 (file)
@@ -1,15 +1,16 @@
 <script id="coding-rules-detail-template" type="text/x-handlebars-template">
-  <h3 class="coding-rules-detail-header">
-    {{#notEq status 'READY'}}
-      <span class="coding-rules-detail-status">{{status}}</span>
-    {{/notEq}}
-    <span class="coding-rules-detail-key">{{key}}</span> : {{name}}
-  </h3>
+  <h3 class="coding-rules-detail-header">{{name}}</h3>
 
   <ul class="coding-rules-detail-properties">
     <li class="coding-rules-detail-property">{{severityIcon severity}} {{t "severity" severity}}</li>
-    <li class="coding-rules-detail-property"><i class="icon-lang"></i> {{language}}</li>
-    <li class="coding-rules-detail-property"><i class="icon-calendar"></i> {{fCreationDate}}</li>
+    <li class="coding-rules-detail-property">
+      <span class="coding-rules-detail-status">{{language}}</span>
+    </li>
+    {{#notEq status 'READY'}}
+      <li class="coding-rules-detail-property">
+        <span class="coding-rules-detail-status">{{status}}</span>
+      </li>
+    {{/notEq}}
     <li class="coding-rules-detail-property coding-rules-detail-tag-list">
       <i class="icon-tags"></i>
       {{join tags ', '}}
@@ -19,6 +20,9 @@
       <input class="coding-rules-detail-tag-input" type="text" value="{{join tags ','}}">
       <a class="link-action coding-rules-detail-tag-edit-done">{{t 'done'}}</a>
     </li>
+    <li class="coding-rules-detail-property">{{t 'coding_rules.available_since'}} {{fCreationDate}}</li>
+    <li class="coding-rules-detail-property">{{t 'coding_rules.repository'}} {{repository}}</li>
+    <li class="coding-rules-detail-property">{{t 'coding_rules.key'}} {{key}}</li>
   </ul>
 
   <div class="coding-rules-detail-description rule-desc">{{{description}}}</div>
     </div>
   </div>
 
-  <table class="data zebra coding-rules-detail-parameters">
-    <thead>
-      <tr>
-        <th>{{t 'coding_rules.parameters.key'}}</th>
-        <th>{{t 'coding_rules.parameters.default_value'}}</th>
-        <th>{{t 'coding_rules.parameters.description'}}</th>
-      </tr>
-    </thead>
-    <tbody>
+
+  {{#if parameters}}
+    <h3 class="coding-rules-detail-title">{{t 'coding_rules.parameters'}}</h3>
+    <ul class="coding-rules-detail-parameters">
       {{#each parameters}}
-        <tr class="coding-rules-detail-parameter">
-          <td>{{key}}</td>
-          <td>{{#if default}}{{default}}{{else}}—{{/if}}</td>
-          <td>{{description}}</td>
-        </tr>
+        <li class="coding-rules-detail-parameter">
+          <h3 class="coding-rules-detail-parameter-name">{{key}}</h3>
+          <div class="coding-rules-detail-parameter-description">
+            {{description}}
+
+            {{#if default}}
+              <div>{{t 'coding_rules.parameters.default_value'}} {{default}}</div>
+            {{/if}}
+          </div>
+        </li>
       {{/each}}
-    </tbody>
-  </table>
+    </ul>
+  {{/if}}
 
 
   {{!--
index df21c196d5f040b0be1c1073216d783c3b37b541..22f6ce7a0190784bb5bf11b7beaac46705359449 100644 (file)
@@ -2,9 +2,11 @@
   <div class="line line-small">
     {{#if qualityProfile}}
       <i class="icon-quality-profile"></i>&nbsp;{{qualityProfileName}}&nbsp;
+      {{severityIcon severity}}{{t "severity" severity}}&nbsp;
     {{/if}}
-    {{severityIcon severity}}{{t "severity" severity}}&nbsp;
-    <i class="icon-lang"></i>&nbsp;{{language}}
+    <span class="coding-rules-detail-status">{{language}}</span>
+
+    <div class="line-right">{{#notEq status 'READY'}}{{status}}{{/notEq}}</div>
   </div>
   <div class="line line-nowrap" title="{{name}}">{{name}}</div>
 </script>
index 0b79a6bb09ad1875e373595d15d548daf93efe13..e3bf41d9fbe420019c3715127bf24fce34485328 100644 (file)
@@ -61,16 +61,21 @@ define ['jquery.mockjax'], ->
         'severity.INFO': 'Info'
 
         'coding_rules.activate_quality_profile': 'Activate Quality Profile'
+        'coding_rules.available_since': 'Available Since'
         'coding_rules.bulk_change': 'Bulk Change'
         'coding_rules.extend_description': 'Extend Description'
         'coding_rules.deactivate_quality_profile': 'Deactivate'
         'coding_rules.found': 'Found'
+        'coding_rules.key': 'Key:'
         'coding_rules.new_search': 'New Search'
         'coding_rules.no_results': 'No Coding Rules'
         'coding_rules.order': 'Order'
         'coding_rules.ordered_by': 'Ordered By'
         'coding_rules.page': 'Coding Rules'
+        'coding_rules.parameters': 'Parameters'
+        'coding_rules.parameters.default_value': 'Default Value:'
         'coding_rules.quality_profiles': 'Quality Profiles'
+        'coding_rules.repository': 'Repository:'
         'coding_rules._rules': 'rule(s)'
         'coding_rules.select_tag': 'Select Tag'
 
@@ -92,10 +97,6 @@ define ['jquery.mockjax'], ->
         'coding_rules.filters.status': 'Status'
         'coding_rules.filters.tag': 'Tag'
 
-        'coding_rules.parameters.key': 'Key'
-        'coding_rules.parameters.default_value': 'Default Value'
-        'coding_rules.parameters.description': 'Description'
-
         'coding_rules.sort.creation_date': 'Creation Date'
         'coding_rules.sort.name': 'Name'
 
@@ -109,26 +110,31 @@ define ['jquery.mockjax'], ->
           name: 'Array designators "[]" should be located after the type in method signatures'
           language: 'Java'
           severity: 'MAJOR'
+          status: 'DEPRECATED'
         },
         {
           name: 'Avoid Array Loops'
           language: 'Java'
           severity: 'CRITICAL'
+          status: 'READY'
         },
         {
           name: 'Bad practice - Abstract class defines covariant compareTo() method'
           language: 'Java'
           severity: 'MAJOR'
+          status: 'READY'
         },
         {
           name: 'Correctness - Use of class without a hashCode() method in a hashed data structure'
           language: 'Java'
           severity: 'MINOR'
+          status: 'BETA'
         },
         {
           name: 'Useless Operation On Immutable'
           language: 'Java'
           severity: 'MAJOR'
+          status: 'READY'
         }
       ]
       paging:
index 623c2a80ca9dc18462e2d0f698b2e80009931290..44442353b375babd2483d2f952690e936b714faf 100644 (file)
           'severity.MINOR': 'Minor',
           'severity.INFO': 'Info',
           'coding_rules.activate_quality_profile': 'Activate Quality Profile',
+          'coding_rules.available_since': 'Available Since',
           'coding_rules.bulk_change': 'Bulk Change',
           'coding_rules.extend_description': 'Extend Description',
           'coding_rules.deactivate_quality_profile': 'Deactivate',
           'coding_rules.found': 'Found',
+          'coding_rules.key': 'Key:',
           'coding_rules.new_search': 'New Search',
           'coding_rules.no_results': 'No Coding Rules',
           'coding_rules.order': 'Order',
           'coding_rules.ordered_by': 'Ordered By',
           'coding_rules.page': 'Coding Rules',
+          'coding_rules.parameters': 'Parameters',
+          'coding_rules.parameters.default_value': 'Default Value:',
           'coding_rules.quality_profiles': 'Quality Profiles',
+          'coding_rules.repository': 'Repository:',
           'coding_rules._rules': 'rule(s)',
           'coding_rules.select_tag': 'Select Tag',
           'coding_rules.filters.availableSince': 'Available Since',
           'coding_rules.filters.severity': 'Severity',
           'coding_rules.filters.status': 'Status',
           'coding_rules.filters.tag': 'Tag',
-          'coding_rules.parameters.key': 'Key',
-          'coding_rules.parameters.default_value': 'Default Value',
-          'coding_rules.parameters.description': 'Description',
           'coding_rules.sort.creation_date': 'Creation Date',
           'coding_rules.sort.name': 'Name'
         }
           {
             name: 'Array designators "[]" should be located after the type in method signatures',
             language: 'Java',
-            severity: 'MAJOR'
+            severity: 'MAJOR',
+            status: 'DEPRECATED'
           }, {
             name: 'Avoid Array Loops',
             language: 'Java',
-            severity: 'CRITICAL'
+            severity: 'CRITICAL',
+            status: 'READY'
           }, {
             name: 'Bad practice - Abstract class defines covariant compareTo() method',
             language: 'Java',
-            severity: 'MAJOR'
+            severity: 'MAJOR',
+            status: 'READY'
           }, {
             name: 'Correctness - Use of class without a hashCode() method in a hashed data structure',
             language: 'Java',
-            severity: 'MINOR'
+            severity: 'MINOR',
+            status: 'BETA'
           }, {
             name: 'Useless Operation On Immutable',
             language: 'Java',
-            severity: 'MAJOR'
+            severity: 'MAJOR',
+            status: 'READY'
           }
         ],
         paging: {
index f8dd46015ec24e174e6f681bdff99f14274d16ca..11d7539c91d535ace10a7ddd264676139821c911 100644 (file)
 /*
  * Detail
  */
-.coding-rules-detail-header {
-  margin-bottom: 20px;
+.coding-rules-detail-header,
+.coding-rules-detail-title {
+  margin-bottom: 10px;
   line-height: 1.5;
   font-weight: bold;
+}
+.coding-rules-detail-title {
   text-transform: uppercase;
 }
 .coding-rules-detail-status {
   background-color: #efefef;
   color: #777;
   font-size: 11px;
-  text-transform: uppercase;
 }
 .coding-rules-detail-properties {
-  margin: 20px 0;
+  margin: 10px 0;
   font-size: 0;
 }
 .coding-rules-detail-property {
   display: inline-block;
   vertical-align: middle;
-  font-size: 13px;
+  font-size: 11px;
   height: 22px;
   line-height: 22px;
 }
 .coding-rules-detail-tag + .coding-rules-detail-tag {
   margin-left: 10px;
 }
-.coding-rules-detail-tag-delete {
-  position: relative;
-  top: -1px;
-  transition: all 0.3s ease;
-}
-.coding-rules-detail-tag-delete:hover,
-.coding-rules-detail-tag-delete:focus {
-  color: #d4333f;
-}
-.coding-rules-detail-tag-add {
-  transition: all 0.3s ease;
-}
-.coding-rules-detail-tag-add:hover,
-.coding-rules-detail-tag-add:focus {
-  color: #85bb43;
-}
-.coding-rules-detail-tag + .coding-rules-detail-tags-change {
-  margin-left: 15px;
-}
-.coding-rules-detail-add-tag-box {
-  position: absolute;
-  width: 200px;
-  padding: 10px;
-  border: 1px solid #e1e1e1;
-  background-color: #fff;
-}
-.coding-rules-detail-add-tag-list-item {
-  padding: 3px 0;
-}
-.coding-rules-detail-add-tag-list-item input[type=text] {
-  width: 120px;
-}
 .coding-rules-detail-description {
   margin: 20px 0;
-  padding-left: 10px;
-  border-left: 5px solid #4b9fd5;
-}
-.coding-rules-detail-description *:first-child {
-  margin-top: 0;
-  padding-top: 0;
-}
-.coding-rules-detail-description *:last-child {
-  margin-bottom: 0;
-  padding-bottom: 0;
 }
 .coding-rules-detail-description-extra {
   margin-top: -10px;
-  border-left-color: #cdcdcd;
 }
 .coding-rules-detail-parameters {
-  margin: 20px 0;
+  margin: 10px 0 20px;
 }
 .coding-rules-detail-parameter {
   margin: 10px 0;
+  font-size: 0;
+}
+.coding-rules-detail-parameter-name {
+  display: inline-block;
+  visibility: top;
+  width: 150px;
+  font-size: 13px;
+  font-weight: bold;
+  text-align: right;
+}
+.coding-rules-detail-parameter-description {
+  display: inline-block;
+  vertical-align: top;
+  margin-left: 20px;
+  font-size: 13px;
 }
 .coding-rules-detail-quality-profiles-header {
   margin-top: 30px;
index a2c5fa9ad5e9934e0edf8219c09bce77fb64e1bb..bd5cb1cd4a8864d0e64a80b7c3ca73ddde0be1c6 100644 (file)
  * Detail
  */
 
-.coding-rules-detail-header {
-  margin-bottom: 2 * @navigatorPadding;
+.coding-rules-detail-header,
+.coding-rules-detail-title {
+  margin-bottom: @navigatorPadding;
   line-height: 1.5;
   font-weight: bold;
+}
+
+.coding-rules-detail-title {
   text-transform: uppercase;
 }
 
@@ -29,7 +33,6 @@
   background-color: @navigatorBarBackground;
   color: #777;
   font-size: @smallFontSize;
-  text-transform: uppercase;
 }
 
 .coding-rules-detail-key {
 }
 
 .coding-rules-detail-properties {
-  margin: 2 * @navigatorPadding 0;
+  margin: @navigatorPadding 0;
   font-size: 0;
 }
 
 .coding-rules-detail-property {
   display: inline-block;
   vertical-align: middle;
-  font-size: @baseFontSize;
+  font-size: @smallFontSize;
   height: 22px;
   line-height: 22px;
 
   margin-left: @navigatorPadding;
 }
 
-.coding-rules-detail-tag-delete {
-  position: relative;
-  top: -1px;
-  .trans;
-
-  &:hover, &:focus { color: @red; }
-}
-
-.coding-rules-detail-tag-add {
-  .trans;
-
-  &:hover, &:focus { color: @green; }
-}
-
-.coding-rules-detail-tag + .coding-rules-detail-tags-change {
-  margin-left: 1.5 * @navigatorPadding;
-}
-
-.coding-rules-detail-add-tag-box {
-  position: absolute;
-  width: 200px;
-  padding: @navigatorPadding;
-  border: 1px solid @navigatorBorderLightColor;
-  background-color: #fff;
-}
-
-.coding-rules-detail-add-tag-list-item {
-  padding: 3px 0;
-
-  input[type=text] { width: 120px; }
-}
-
 .coding-rules-detail-description {
   margin: 2 * @navigatorPadding 0;
-  padding-left: @navigatorPadding;
-  border-left: 5px solid @blue;
-
-  *:first-child {
-    margin-top: 0;
-    padding-top: 0;
-  }
-
-  *:last-child {
-    margin-bottom: 0;
-    padding-bottom: 0;
-  }
 }
 
 .coding-rules-detail-description-extra {
   margin-top: -@navigatorPadding;
-  border-left-color: @darkGrey;
 }
 
 .coding-rules-detail-parameters {
-  margin: 2 * @navigatorPadding 0;
+  margin: @navigatorPadding 0 @navigatorPadding * 2;
 }
 
 .coding-rules-detail-parameter {
   margin: @navigatorPadding 0;
+  font-size: 0;
+}
+
+.coding-rules-detail-parameter-name {
+  display: inline-block;
+  visibility: top;
+  width: 150px;
+  font-size: @baseFontSize;
+  font-weight: bold;
+  text-align: right;
+}
+
+.coding-rules-detail-parameter-description {
+  display: inline-block;
+  vertical-align: top;
+  margin-left: 2 * @navigatorPadding;
+  font-size: @baseFontSize;
 }