start of new forms implementation

This commit is contained in:
Gert
2015-06-01 21:22:56 +02:00
parent 06e8514365
commit 9971ec0291
28 changed files with 888 additions and 448 deletions

20
themes/grav/js/forms.js Normal file
View File

@@ -0,0 +1,20 @@
$(function () {
if (typeof window.GravJS === 'undefined' || !window.GravJS.Form) {
console.warn('Dependencies for Grav Forms are not loaded.');
return;
}
// Register all FormFields that were loaded
if (typeof window.GravJS.FormFields === 'object') {
for (var key in window.GravJS.FormFields) { if (window.GravJS.FormFields.hasOwnProperty(key)) {
GravJS.Form.registerFactory(GravJS.FormFields[key]);
}
}
}
window.formInstances = [];
$('[data-grav-form]').each(function () {
window.formInstances.push(new GravJS.Form($(this)));
})
});