]> source.dussan.org Git - sonarqube.git/commitdiff
fix SONAR-5820/SONAR-6019 finish characteristic facet
authorStas Vilchik <vilchiks@gmail.com>
Wed, 21 Jan 2015 15:04:06 +0000 (16:04 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Wed, 21 Jan 2015 16:45:34 +0000 (17:45 +0100)
server/sonar-web/src/main/hbs/coding-rules/facets/coding-rules-characteristic-facet.hbs [new file with mode: 0644]
server/sonar-web/src/main/js/coding-rules/app.js
server/sonar-web/src/main/js/coding-rules/facets/characteristic-facet.js
server/sonar-web/src/main/less/components/search-navigator.less

diff --git a/server/sonar-web/src/main/hbs/coding-rules/facets/coding-rules-characteristic-facet.hbs b/server/sonar-web/src/main/hbs/coding-rules/facets/coding-rules-characteristic-facet.hbs
new file mode 100644 (file)
index 0000000..1742660
--- /dev/null
@@ -0,0 +1,11 @@
+{{> '_coding-rules-facet-header'}}
+
+<div class="search-navigator-facet-list">
+  {{#each values}}
+    <a class="facet search-navigator-facet {{#if parent}}search-navigator-facet-indent{{/if}} js-facet"
+       data-value="{{val}}" title="{{default label val}}">
+      <span class="facet-name">{{default label val}}</span>
+      <span class="facet-stat">{{numberShort count}}</span>
+    </a>
+  {{/each}}
+</div>
index b467dbaadb7fcf2d0829e3b3f2330b451b1a4419..b92d703e1a4a3bdc3aa57e694b6c2e5e8bc563ab 100644 (file)
@@ -115,7 +115,9 @@ requirejs([
         App.repositories = r.repositories;
         App.repositories.push(App.manualRepository());
         App.statuses = r.statuses;
-        App.characteristics = r.characteristics;
+        App.characteristics = r.characteristics.map(function (item, index) {
+          return _.extend(item, { index: index });
+        });
       });
 
       $.when(window.requestMessages(), appXHR).done(function () {
index 359131f5f04e59f9048a45886c6e1ca9c9dd9e31..0845bd744cc1ce3440b8f3d9b4165f390d58e061 100644 (file)
@@ -1,8 +1,10 @@
 define([
-  'coding-rules/facets/base-facet'
+  'coding-rules/facets/base-facet',
+  'templates/coding-rules'
 ], function (BaseFacet) {
 
   return BaseFacet.extend({
+    template: Templates['coding-rules-characteristic-facet'],
 
     getValues: function () {
       var values = this.model.getValues(),
@@ -19,9 +21,7 @@ define([
     },
 
     sortValues: function (values) {
-      return _.sortBy(values, function (v) {
-        return v.val === 'NONE' ? -999999 : -v.count;
-      });
+      return _.sortBy(values, 'index');
     },
 
     serializeData: function () {
index e5c408df6fe74bf5babdf062983b40f4fe195b99..6eb29cc614ee1ff8ab28ec8c136bf2b91335e093 100644 (file)
   }
 }
 
+.search-navigator-facet-indent {
+  width: ~"calc(100% - 30px)";
+  margin-left: 30px;
+}
+
 .search-navigator-facet-half {
   width: 45%;