mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-24 03:49:31 +00:00
Use ajax for form requests too.
This commit is contained in:
parent
b3db1dd139
commit
8711f296a4
6 changed files with 43 additions and 4 deletions
|
|
@ -37,6 +37,7 @@ require( 'datatables.net-buttons/js/buttons.print.js' );
|
|||
require( 'datatables.net-fixedheader-bs4' );
|
||||
require( 'datatables.net-select-bs4' );
|
||||
require('bootstrap-select');
|
||||
require('jquery-form');
|
||||
|
||||
//require('bootstrap-treeview/src/js/bootstrap-treeview');
|
||||
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ class AjaxUI {
|
|||
{
|
||||
console.info("AjaxUI started!");
|
||||
this.registerLinks();
|
||||
this.registerForm();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -95,6 +96,26 @@ class AjaxUI {
|
|||
console.debug('Links registered!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all forms for loading via ajax.
|
||||
*/
|
||||
protected registerForm()
|
||||
{
|
||||
let options : JQueryFormOptions = {
|
||||
success: this.onAjaxComplete,
|
||||
beforeSubmit: function (arr, $form, options) : boolean {
|
||||
//When data-with-progbar is specified, then show progressbar.
|
||||
if($form.data("with-progbar") != undefined) {
|
||||
ajaxUI.showProgressBar();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
$('form').not('[data-no-ajax]').ajaxForm(options);
|
||||
|
||||
console.debug('Forms registered!');
|
||||
}
|
||||
|
||||
|
||||
public showProgressBar()
|
||||
{
|
||||
|
|
@ -204,6 +225,7 @@ class AjaxUI {
|
|||
|
||||
//Do things on the new dom
|
||||
ajaxUI.registerLinks();
|
||||
ajaxUI.registerForm();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"target": "es5",
|
||||
"sourceMap": true,
|
||||
"typeRoots": ["../node_modules"],
|
||||
"types": ["jquery", "js-cookie", "bootstrap"]
|
||||
"types": ["jquery", "js-cookie", "bootstrap", "jquery.form"]
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue