mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-31 16:24:54 +02:00
Added possibillity to delete attachments in admin page.
This commit is contained in:
parent
72cd9a3722
commit
7c43feefbe
10 changed files with 133 additions and 19 deletions
|
@ -256,12 +256,9 @@ class AjaxUI {
|
|||
console.debug('Links registered!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all forms for loading via ajax.
|
||||
*/
|
||||
public registerForm()
|
||||
protected getFormOptions() : JQueryFormOptions
|
||||
{
|
||||
let options : JQueryFormOptions = {
|
||||
return {
|
||||
success: this.onAjaxComplete,
|
||||
beforeSerialize: function() : boolean {
|
||||
|
||||
|
@ -285,12 +282,34 @@ class AjaxUI {
|
|||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all forms for loading via ajax.
|
||||
*/
|
||||
public registerForm()
|
||||
{
|
||||
|
||||
let options = this.getFormOptions();
|
||||
|
||||
$('form').not('[data-no-ajax]').ajaxForm(options);
|
||||
|
||||
console.debug('Forms registered!');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Submits the given form via ajax.
|
||||
* @param form The form that will be submmitted.
|
||||
*/
|
||||
public submitForm(form)
|
||||
{
|
||||
let options = ajaxUI.getFormOptions();
|
||||
|
||||
$(form).ajaxSubmit(options);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the progressbar
|
||||
*/
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
*/
|
||||
|
||||
import {ajaxUI} from "./ajax_ui";
|
||||
import "bootbox";
|
||||
|
||||
/************************************
|
||||
*
|
||||
|
@ -188,6 +189,29 @@ $(document).on("ajaxUI:start ajaxUI:reload", function() {
|
|||
});
|
||||
});
|
||||
|
||||
$(document).on("ajaxUI:start ajaxUI:reload", function() {
|
||||
$("[data-delete-form]").unbind('submit').submit(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
let form = this;
|
||||
|
||||
let title = $(this).data("title");
|
||||
let message = $(this).data("message");
|
||||
|
||||
bootbox.confirm({
|
||||
message: message,
|
||||
title: title,
|
||||
callback: function(result) {
|
||||
//If the dialog was confirmed, then submit the form.
|
||||
if(result) {
|
||||
ajaxUI.submitForm(form);
|
||||
}
|
||||
}});
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Register the button, to jump to the top of the page.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue