mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Handlebars ucword helper.
This commit is contained in:
parent
860ba5a253
commit
4134d3c48a
1 changed files with 5 additions and 0 deletions
|
@ -7,6 +7,11 @@ app = Sammy('#main', function (sam) {
|
|||
// Plugins
|
||||
sam.use('Handlebars', 'ms');
|
||||
|
||||
Handlebars.registerHelper('ucwords', function(str) {
|
||||
return (str + '').replace(/^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g, function ($1) {
|
||||
return $1.toUpperCase();
|
||||
});
|
||||
});
|
||||
Handlebars.registerHelper('humanSize', function(bytes) {
|
||||
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
||||
if (bytes == 0) return 'n/a';
|
||||
|
|
Loading…
Reference in a new issue