client/views: move form controls to HB helpers

This commit is contained in:
rr-
2016-04-10 10:23:27 +02:00
parent 7c1876dd5c
commit e268d679d3
10 changed files with 148 additions and 56 deletions

View File

@ -37,3 +37,21 @@ Promise.prototype.always = function(onResolveOrReject) {
throw reason;
});
};
if (!String.prototype.format) {
String.prototype.format = function() {
let str = this.toString();
if (!arguments.length) {
return str;
}
const type = typeof arguments[0];
const args = (type == 'string' || type == 'number') ?
arguments : arguments[0];
for (let arg in args) {
str = str.replace(
new RegExp('\\{' + arg + '\\}', 'gi'),
() => { return args[arg]; });
}
return str;
};
}