From d1c62369b7d18a64023fea0f2f495e500a24b25c Mon Sep 17 00:00:00 2001 From: Shubham Dhama Date: Sun, 2 Sep 2018 13:08:09 +0530 Subject: [PATCH] templates: Add `is_false` handlebars helper. There is need for such a helper because `unless` executes to be true even when we haven't passed the context variable on which we are checking the conditional statement. --- static/js/templates.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/static/js/templates.js b/static/js/templates.js index 0ad0bbbc18..850040b44e 100644 --- a/static/js/templates.js +++ b/static/js/templates.js @@ -79,6 +79,13 @@ Handlebars.registerHelper('if_or', function () { return options.inverse(this); }); +Handlebars.registerHelper('is_false', function (variable, options) { + if (variable === false) { + return options.fn(this); + } + return options.inverse(this); +}); + Handlebars.registerHelper('t', function (i18n_key) { // Marks a string for translation. // Example usage: