mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
[enh] add handlebars 'eq' and 'in' helpers
This commit is contained in:
parent
cc2e1887ea
commit
df213fba3f
1 changed files with 15 additions and 0 deletions
|
@ -60,6 +60,21 @@
|
|||
+ '</script>');
|
||||
});
|
||||
|
||||
// equality stuff because mustache/Handlebars is lame
|
||||
// source https://stackoverflow.com/a/31632215
|
||||
Handlebars.registerHelper('eq', function(a, b) {
|
||||
return a === b;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('in', function(a) {
|
||||
// skip first one
|
||||
for (var i = 1; i < arguments.length; ++i) {
|
||||
if (arguments[i] == a)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// Look for supported type of storage to use
|
||||
/**
|
||||
* http://sammyjs.org/docs/api/0.7.4/all#Sammy.Store.LocalStorage
|
||||
|
|
Loading…
Reference in a new issue