mirror of https://github.com/zulip/zulip.git
templates: Remove partial helper.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
parent
0c565f50be
commit
adcfa68da8
|
@ -14,23 +14,6 @@ var exports = {};
|
|||
// Furthermore, waiting for DOM ready would introduce race conditions with
|
||||
// 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) {
|
||||
return condition === 1 ? one : other;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue