templates: Remove partial helper.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2019-07-10 23:58:34 -07:00 committed by Tim Abbott
parent 0c565f50be
commit adcfa68da8
1 changed files with 0 additions and 17 deletions

View File

@ -14,23 +14,6 @@ var exports = {};
// Furthermore, waiting for DOM ready would introduce race conditions with // Furthermore, waiting for DOM ready would introduce race conditions with
// other DOM-ready callbacks that attempt to render templates. // other DOM-ready callbacks that attempt to render templates.
// Regular Handlebars partials require pre-registering. This allows us to treat
// any template as a partial. We also allow the partial to be passed additional
// named arguments. Arguments should alternate between strings which will be
// used as the name and the associated value.
Handlebars.registerHelper('partial', function (template_name) {
var extra_data = {};
var args_len = arguments.length;
var i;
for (i = 1; i < args_len - 2; i += 2) {
extra_data[arguments[i]] = arguments[i + 1];
}
var data = _.extend({}, this, extra_data);
return new Handlebars.SafeString(require('../templates/' + template_name + '.hbs')(data));
});
Handlebars.registerHelper('plural', function (condition, one, other) { Handlebars.registerHelper('plural', function (condition, one, other) {
return condition === 1 ? one : other; return condition === 1 ? one : other;
}); });