mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
FormBuilder split out
This commit is contained in:
parent
f1d2e0e6df
commit
34e35bd00b
5 changed files with 40 additions and 24 deletions
27
UI/Form/FormBuilder.js
Normal file
27
UI/Form/FormBuilder.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
'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']);
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue