Added a button to quickly create multiple tasks without having to close/reopen the dialog (closes #1776)

This commit is contained in:
Bernd Bestel
2022-02-06 18:35:19 +01:00
parent e6a6d7ae42
commit 9eb46df517
4 changed files with 33 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
$('#save-task-button').on('click', function(e)
$('.save-task-button').on('click', function(e)
{
e.preventDefault();
@@ -16,6 +16,8 @@
if (Grocy.EditMode === 'create')
{
var addAnother = $(e.currentTarget).hasClass("add-another");
Grocy.Api.Post('objects/tasks', jsonData,
function(result)
{
@@ -24,11 +26,25 @@
{
if (GetUriParam("embedded") !== undefined)
{
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
if (addAnother)
{
window.location.href = U('/task/new?embedded');
}
else
{
window.parent.postMessage(WindowMessageBag("Reload"), Grocy.BaseUrl);
}
}
else
{
window.location.href = U('/tasks');
if (addAnother)
{
window.location.href = U('/task/new');
}
else
{
window.location.href = U('/tasks');
}
}
});
},
@@ -82,7 +98,7 @@ $('#task-form input').keydown(function(event)
}
else
{
$('#save-task-button').click();
$('.save-task-button').first().click();
}
}
});