Changelog and small fixes for #545

This commit is contained in:
Bernd Bestel 2020-02-09 21:50:56 +01:00
parent 7638254f14
commit 49edd011b4
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 55 additions and 69 deletions

View File

@ -16,6 +16,7 @@
- Fixed that when reloading the "new recipe"-page (or when it gets auto-reloaded due to "Auto reload on external changes" is enabled), for each reload a new recipe was created
- Fixed that the recipe "fullscreen card" was not correctly displayed
- Fixed that nested recipes showed all ingredients of the nested recipes twice
- Fixed that when displaying or consuming a recipe from the meal plan the serving amount was maybe wrong (was the one from the recipe instead the one from the meal plan entry) (thanks @kriddles)
### Meal plan improvements
- Improved that all add-dialogs can be submitted by using `ENTER` and that the next input is automatically selected after selecting a recipe/product

View File

@ -582,40 +582,35 @@ $(document).on('click', '.recipe-order-missing-button', function(e)
{
Grocy.FrontendHelpers.BeginUiBusy();
//set the recipes desired_servings so that the views resolve correctly
//based on the meal plan servings
var data = { };
data.desired_servings = servings;
Grocy.Api.Put('objects/recipes/' + objectId, data,
// Set the recipes desired_servings so that the "recipes resolved"-views resolve correctly based on the meal plan entry servings
Grocy.Api.Put('objects/recipes/' + objectId, { "desired_servings" : servings},
function(result)
{
Grocy.Api.Post('recipes/' + objectId + '/add-not-fulfilled-products-to-shoppinglist', { },
function(result)
{
if (button.attr("data-recipe-type") == "normal")
{
button.addClass("disabled");
Grocy.FrontendHelpers.EndUiBusy();
}
else
{
window.location.reload();
}
},
function(xhr)
{
Grocy.FrontendHelpers.EndUiBusy();
console.error(xhr);
}
);
},
function(xhr)
{
console.error(xhr);
}
);
Grocy.Api.Post('recipes/' + objectId + '/add-not-fulfilled-products-to-shoppinglist', { },
function(result)
{
if (button.attr("data-recipe-type") == "normal")
{
button.addClass("disabled");
Grocy.FrontendHelpers.EndUiBusy();
}
else
{
window.location.reload();
}
},
function(xhr)
{
Grocy.FrontendHelpers.EndUiBusy();
console.error(xhr);
}
);
}
}
});
@ -690,34 +685,29 @@ $(document).on('click', '.recipe-consume-button', function(e)
{
Grocy.FrontendHelpers.BeginUiBusy();
//set the recipes desired_servings so that the views resolve correctly
//based on the meal plan servings
var data = { };
data.desired_servings = servings;
Grocy.Api.Put('objects/recipes/' + objectId, data,
// Set the recipes desired_servings so that the "recipes resolved"-views resolve correctly based on the meal plan entry servings
Grocy.Api.Put('objects/recipes/' + objectId, { "desired_servings": servings },
function(result)
{
Grocy.Api.Post('recipes/' + objectId + '/consume', {},
function(result)
{
Grocy.FrontendHelpers.EndUiBusy();
toastr.success(__t('Removed all ingredients of recipe "%s" from stock', objectName));
},
function(xhr)
{
toastr.warning(__t('Not all ingredients of recipe "%s" are in stock, nothing removed', objectName));
Grocy.FrontendHelpers.EndUiBusy();
console.error(xhr);
}
);
},
function(xhr)
{
console.error(xhr);
}
);
Grocy.Api.Post('recipes/' + objectId + '/consume', { },
function(result)
{
Grocy.FrontendHelpers.EndUiBusy();
toastr.success(__t('Removed all ingredients of recipe "%s" from stock', objectName));
},
function(xhr)
{
toastr.warning(__t('Not all ingredients of recipe "%s" are in stock, nothing removed', objectName));
Grocy.FrontendHelpers.EndUiBusy();
console.error(xhr);
}
);
}
}
});
@ -732,37 +722,32 @@ $(document).on("click", ".recipe-popup-button", function(e)
var objectId = $(e.currentTarget).attr('data-recipe-id');
var servings = $(e.currentTarget).attr('data-mealplan-servings');
//set the recipes desired_servings so that the views resolve correctly
//based on the meal plan servings
var data = { };
data.desired_servings = servings;
Grocy.Api.Put('objects/recipes/' + objectId, data,
// Set the recipes desired_servings so that the "recipes resolved"-views resolve correctly based on the meal plan entry servings
Grocy.Api.Put('objects/recipes/' + objectId, { "desired_servings": servings },
function(result)
{
bootbox.dialog({
message: '<iframe height="650px" class="embed-responsive" src="' + U("/recipes?embedded&recipe=") + objectId + '#fullscreen"></iframe>',
size: 'extra-large',
backdrop: true,
closeButton: false,
buttons: {
cancel: {
label: __t('Close'),
className: 'btn-secondary responsive-button',
callback: function ()
{
bootbox.hideAll();
}
}
}
});
},
function(xhr)
{
console.error(xhr);
}
);
bootbox.dialog({
message: '<iframe height="650px" class="embed-responsive" src="' + U("/recipes?embedded&recipe=") + objectId + '#fullscreen"></iframe>',
size: 'extra-large',
backdrop: true,
closeButton: false,
buttons: {
cancel: {
label: __t('Close'),
className: 'btn-secondary responsive-button',
callback: function()
{
bootbox.hideAll();
}
}
}
});
});
$(window).on("resize", function()