mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
removed NzbDrone. namespace, everything is done using require.
This commit is contained in:
@@ -1,31 +1,50 @@
|
||||
'use strict';
|
||||
define(['app', 'handlebars'], function (App,Handlebars) {
|
||||
Handlebars.registerHelper('formBuilder', function () {
|
||||
var ret = '';
|
||||
_.each(this.fields, function (field) {
|
||||
ret += NzbDrone.Form.FieldBuilder(field);
|
||||
define(
|
||||
[
|
||||
'handlebars'
|
||||
], function (Handlebars) {
|
||||
|
||||
var formBuilder = 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'
|
||||
]);
|
||||
};
|
||||
|
||||
Handlebars.registerHelper('formBuilder', function () {
|
||||
var ret = '';
|
||||
_.each(this.fields, function (field) {
|
||||
ret += this.FieldBuilder(field);
|
||||
});
|
||||
|
||||
return new Handlebars.SafeString(ret);
|
||||
});
|
||||
|
||||
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']);
|
||||
};
|
||||
});
|
||||
|
Reference in New Issue
Block a user