aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/common
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/common')
-rw-r--r--server/sonar-web/src/main/js/common/handlebars-extensions.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/common/handlebars-extensions.js b/server/sonar-web/src/main/js/common/handlebars-extensions.js
index 2d0bd715144..f5e8e3cfe0b 100644
--- a/server/sonar-web/src/main/js/common/handlebars-extensions.js
+++ b/server/sonar-web/src/main/js/common/handlebars-extensions.js
@@ -132,6 +132,26 @@ define(['handlebars'], function (Handlebars) {
return ret;
});
+ Handlebars.registerHelper('eachEven', function (context, options) {
+ var ret = '';
+ context.forEach(function (d, i) {
+ if (i % 2 === 0) {
+ ret += options.fn(d);
+ }
+ });
+ return ret;
+ });
+
+ Handlebars.registerHelper('eachOdd', function (context, options) {
+ var ret = '';
+ context.forEach(function (d, i) {
+ if (i % 2 === 1) {
+ ret += options.fn(d);
+ }
+ });
+ return ret;
+ });
+
Handlebars.registerHelper('eq', function(v1, v2, options) {
// use `==` instead of `===` to ignore types
return v1 == v2 ? options.fn(this) : options.inverse(this);