From: Stas Vilchik Date: Wed, 21 Jan 2015 15:04:06 +0000 (+0100) Subject: fix SONAR-5820/SONAR-6019 finish characteristic facet X-Git-Tag: latest-silver-master-#65~138 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9f73addd1004325b911a58327a391058e3b4c69b;p=sonarqube.git fix SONAR-5820/SONAR-6019 finish characteristic facet --- 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 index 00000000000..1742660c33a --- /dev/null +++ b/server/sonar-web/src/main/hbs/coding-rules/facets/coding-rules-characteristic-facet.hbs @@ -0,0 +1,11 @@ +{{> '_coding-rules-facet-header'}} + +
+ {{#each values}} + + {{default label val}} + {{numberShort count}} + + {{/each}} +
diff --git a/server/sonar-web/src/main/js/coding-rules/app.js b/server/sonar-web/src/main/js/coding-rules/app.js index b467dbaadb7..b92d703e1a4 100644 --- a/server/sonar-web/src/main/js/coding-rules/app.js +++ b/server/sonar-web/src/main/js/coding-rules/app.js @@ -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 () { diff --git a/server/sonar-web/src/main/js/coding-rules/facets/characteristic-facet.js b/server/sonar-web/src/main/js/coding-rules/facets/characteristic-facet.js index 359131f5f04..0845bd744cc 100644 --- a/server/sonar-web/src/main/js/coding-rules/facets/characteristic-facet.js +++ b/server/sonar-web/src/main/js/coding-rules/facets/characteristic-facet.js @@ -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 () { diff --git a/server/sonar-web/src/main/less/components/search-navigator.less b/server/sonar-web/src/main/less/components/search-navigator.less index e5c408df6fe..6eb29cc614e 100644 --- a/server/sonar-web/src/main/less/components/search-navigator.less +++ b/server/sonar-web/src/main/less/components/search-navigator.less @@ -116,6 +116,11 @@ } } +.search-navigator-facet-indent { + width: ~"calc(100% - 30px)"; + margin-left: 30px; +} + .search-navigator-facet-half { width: 45%;