You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/UI/Form/FormBuilder.js

28 lines
838 B

'use strict';
define(['app'], function () {
Handlebars.registerHelper('formBuilder', function (){
var ret = "";
_.each(this.fields, function(field){
ret += NzbDrone.Form.FieldBuilder(field);
});
return new Handlebars.SafeString(ret);
});
NzbDrone.Form.FieldBuilder = function(field) {
if (!field.type) {
return Handlebars.helpers.partial.apply(field, ['Form/TextboxTemplate']);
}
if (field.type === 'password') {
return Handlebars.helpers.partial.apply(field, ['Form/PasswordTemplate']);
}
if (field.type === 'checkbox') {
return Handlebars.helpers.partial.apply(field, ['Form/CheckboxTemplate']);
}
return Handlebars.helpers.partial.apply(field, ['Form/TextboxTemplate']);
};
});