mirror of
https://github.com/Radarr/Radarr
synced 2024-12-25 17:27:59 +00:00
769331d45d
single quotes
31 lines
1,005 B
JavaScript
31 lines
1,005 B
JavaScript
'use strict';
|
|
define(['app', 'handlebars'], function (App,Handlebars) {
|
|
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']);
|
|
}
|
|
|
|
if (field.type === 'select') {
|
|
return Handlebars.helpers.partial.apply(field, ['Form/SelectTemplate']);
|
|
}
|
|
|
|
return Handlebars.helpers.partial.apply(field, ['Form/TextboxTemplate']);
|
|
};
|
|
});
|