[enh] Generalize call handlebars helper

This commit is contained in:
ljf 2019-10-20 01:47:24 +02:00
parent 1c6f5e4011
commit fae6c974d1
3 changed files with 9 additions and 7 deletions

View file

@ -663,7 +663,7 @@ input[type='radio'].nice-radio {
} }
/** Permissions View **/ /** Groups View **/
#view-groups { #view-groups {
.panel-heading a { .panel-heading a {
text-decoration: none; text-decoration: none;

View file

@ -82,12 +82,6 @@
return data_groups.groups[group].members.indexOf(item) === -1; return data_groups.groups[group].members.indexOf(item) === -1;
}); });
} }
Handlebars.registerHelper('call', function () {
var args = Array.prototype.slice.call(arguments);
var func = args.shift();
args.pop();
return func.apply(null, args);
});
data_groups.groups['all_users'].special = true; data_groups.groups['all_users'].special = true;
data_groups.groups['visitors'].special = true; data_groups.groups['visitors'].special = true;
data = { data = {

View file

@ -132,6 +132,14 @@
} }
}); });
// Be able to call a function given in context
Handlebars.registerHelper('call', function () {
var args = Array.prototype.slice.call(arguments);
var func = args.shift();
args.pop();
return func.apply(null, args);
});
Handlebars.registerHelper('in', function(a) { Handlebars.registerHelper('in', function(a) {
// skip first one // skip first one
for (var i = 1; i < arguments.length; ++i) { for (var i = 1; i < arguments.length; ++i) {