mirror of
https://github.com/grocy/grocy.git
synced 2025-08-17 19:16:37 +00:00
Added a button to quickly create multiple tasks without having to close/reopen the dialog (closes #1776)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user