mirror of
https://github.com/grocy/grocy.git
synced 2025-08-15 02:04:38 +00:00
Added the possibility to undo a task (closes #252)
This commit is contained in:
@@ -102,6 +102,32 @@ $(document).on('click', '.do-task-button', function(e)
|
||||
);
|
||||
});
|
||||
|
||||
$(document).on('click', '.undo-task-button', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
// Remove the focus from the current button
|
||||
// to prevent that the tooltip stays until clicked anywhere else
|
||||
document.activeElement.blur();
|
||||
|
||||
Grocy.FrontendHelpers.BeginUiBusy();
|
||||
|
||||
var taskId = $(e.currentTarget).attr('data-task-id');
|
||||
var taskName = $(e.currentTarget).attr('data-task-name');
|
||||
|
||||
Grocy.Api.Post('tasks/' + taskId + '/undo', { },
|
||||
function()
|
||||
{
|
||||
window.location.reload();
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
Grocy.FrontendHelpers.EndUiBusy();
|
||||
console.error(xhr);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$(document).on('click', '.delete-task-button', function (e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
Reference in New Issue
Block a user