mirror of
https://github.com/grocy/grocy.git
synced 2026-07-21 10:46:51 -07:00
Preselect the default serving size when adding a nested recipe (closes #500)
This commit is contained in:
@@ -348,3 +348,23 @@ $(window).on("message", function(e)
|
||||
window.location.href = U('/recipe/' + Grocy.EditObjectId);
|
||||
}
|
||||
});
|
||||
|
||||
Grocy.Components.RecipePicker.GetPicker().on('change', function (e)
|
||||
{
|
||||
var value = Grocy.Components.RecipePicker.GetValue();
|
||||
if (value.toString().isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Grocy.Api.Get('objects/recipes/' + value,
|
||||
function(recipe)
|
||||
{
|
||||
$("#includes_servings").val(recipe.servings);
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user