diff --git a/changelog/66_UNRELEASED_xxxx-xx-xx.md b/changelog/66_UNRELEASED_xxxx-xx-xx.md index a818bc48..329578c5 100644 --- a/changelog/66_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/66_UNRELEASED_xxxx-xx-xx.md @@ -6,6 +6,7 @@ - When using reverse proxy authentication (`ReverseProxyAuthMiddleware`), it's now also possible to pass the username in an environment variable instead of an HTTP header (new `config.php` option `REVERSE_PROXY_AUTH_USE_ENV`) (thanks @Forceu) - Performance improvements (page loading time) of the recipes page - New input shorthand `[+/-]n[d/m/y]` for date fields to quickly input a date relative to today (adding `+` or subtracting `-` the number of days/months/years, see the full list of available shorthands [here](https://github.com/grocy/grocy#input-shorthands-for-date-fields)) +- Added a "Save & add another task"-button on the add task dialog to quickly create multiple tasks without having to close/reopen the dialog - Fixed that stock entry labels on purchase were printed, even when "No label" was selected (was only a problem when running label printer WebHooks server side) - Fixed that when adding missing recipe ingredients, with the option "Only check if any amount is in stock" enabled, to the shopping list, unit conversions (if any) weren't considered - Fixed that the meal plan showed the total calories per recipe (instead of per serving as stated by the suffix) diff --git a/localization/strings.pot b/localization/strings.pot index 24298b3b..1a655b48 100644 --- a/localization/strings.pot +++ b/localization/strings.pot @@ -2280,3 +2280,9 @@ msgstr[1] "" msgid "Set to 0 to hide due soon filters/highlighting" msgstr "" + +msgid "Save & close" +msgstr "" + +msgid "Save & add another task" +msgstr "" diff --git a/public/viewjs/taskform.js b/public/viewjs/taskform.js index cb50933b..298a586b 100644 --- a/public/viewjs/taskform.js +++ b/public/viewjs/taskform.js @@ -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(); } } }); diff --git a/views/taskform.blade.php b/views/taskform.blade.php index d34cc2d4..db56ad2f 100644 --- a/views/taskform.blade.php +++ b/views/taskform.blade.php @@ -104,9 +104,12 @@ 'entity' => 'tasks' )) - - + @if($mode == 'edit') + + @else + + + @endif