aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src/main/js/common/handlebars-extensions.js
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2014-06-10 16:09:46 +0600
committerStas Vilchik <vilchiks@gmail.com>2014-06-10 16:09:55 +0600
commit5d0730e2be1a25c186049a3255c50772818ae4c1 (patch)
tree833cbb591994c198fc75cbe450dbc809ee1efd77 /sonar-server/src/main/js/common/handlebars-extensions.js
parentdd3adbe6b335f80afa87578275cc5ba7b18d3c4b (diff)
downloadsonarqube-5d0730e2be1a25c186049a3255c50772818ae4c1.tar.gz
sonarqube-5d0730e2be1a25c186049a3255c50772818ae4c1.zip
SONAR-5209 Issues time changes
Diffstat (limited to 'sonar-server/src/main/js/common/handlebars-extensions.js')
-rw-r--r--sonar-server/src/main/js/common/handlebars-extensions.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/sonar-server/src/main/js/common/handlebars-extensions.js b/sonar-server/src/main/js/common/handlebars-extensions.js
index 8deac86c643..8d7ada4f526 100644
--- a/sonar-server/src/main/js/common/handlebars-extensions.js
+++ b/sonar-server/src/main/js/common/handlebars-extensions.js
@@ -79,7 +79,11 @@ define(['handlebars', 'moment'], function (Handlebars, moment) {
});
Handlebars.registerHelper('percent', function(value, total) {
- return '' + ((value || 0) / total * 100) + '%';
+ if (total > 0) {
+ return '' + ((value || 0) / total * 100) + '%';
+ } else {
+ return '0%';
+ }
});
Handlebars.registerHelper('eq', function(v1, v2, options) {
@@ -303,4 +307,12 @@ define(['handlebars', 'moment'], function (Handlebars, moment) {
}
});
+ Handlebars.registerHelper('ifMeasureShouldBeShown', function(measure, period, options) {
+ if (measure != null || period != null) {
+ return options.fn(this);
+ } else {
+ return options.inverse(this);
+ }
+ });
+
});