diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2014-06-10 16:09:46 +0600 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2014-06-10 16:09:55 +0600 |
commit | 5d0730e2be1a25c186049a3255c50772818ae4c1 (patch) | |
tree | 833cbb591994c198fc75cbe450dbc809ee1efd77 /sonar-server/src/main/js/common/handlebars-extensions.js | |
parent | dd3adbe6b335f80afa87578275cc5ba7b18d3c4b (diff) | |
download | sonarqube-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.js | 14 |
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); + } + }); + }); |