Merge pull request #2938 from patmagauran/meal-plan-serving-size-link

Add ability to open recipes with specified number of servings from meal plan
This commit is contained in:
vabene1111
2024-02-16 19:46:36 +01:00
committed by GitHub
4 changed files with 21 additions and 8 deletions

View File

@@ -237,6 +237,7 @@ export default {
},
props: {
recipe_id: Number,
def_servings: Number,
recipe_obj: {type: Object, default: null},
show_context_menu: {type: Boolean, default: true},
enable_keyword_links: {type: Boolean, default: true},
@@ -320,8 +321,13 @@ export default {
if (this.recipe.image === null) this.printReady()
this.servings = this.servings_cache[this.rootrecipe.id] = this.recipe.servings
window.RECIPE_SERVINGS = Number(window.RECIPE_SERVINGS)
if (window.RECIPE_SERVINGS && ! isNaN(window.RECIPE_SERVINGS)) {
//I am not sure this is the best way. This overwrites our servings cache, which may not be intended?
this.servings = window.RECIPE_SERVINGS
} else {
this.servings = this.servings_cache[this.rootrecipe.id] = this.recipe.servings
}
this.loading = false
setTimeout(() => {