Clicking on Recipe in Meal Plan auto does servings

This commit is contained in:
Patrick Magauran 2024-02-06 22:37:25 -05:00
parent 13f532a67b
commit e8db2b6401

View File

@ -126,7 +126,7 @@
<div class="flex-grow-1 ml-2" <div class="flex-grow-1 ml-2"
style="text-overflow: ellipsis; overflow-wrap: anywhere;"> style="text-overflow: ellipsis; overflow-wrap: anywhere;">
<span class="two-row-text"> <span class="two-row-text">
<a :href="resolveDjangoUrl('view_recipe', plan.entry.recipe.id)" v-if="plan.entry.recipe">{{ plan.entry.recipe.name }}</a> <a :href="resolveDjangoUrl('view_recipe', `${plan.entry.recipe.id}-${plan.entry.servings}`)" v-if="plan.entry.recipe">{{ plan.entry.recipe.name }}</a>
<span v-else>{{ plan.entry.title }}</span> <br/> <span v-else>{{ plan.entry.title }}</span> <br/>
</span> </span>
<span v-if="plan.entry.note" class="two-row-text"> <span v-if="plan.entry.note" class="two-row-text">
@ -169,7 +169,7 @@
v-if="contextData && contextData.originalItem && contextData.originalItem.entry.recipe != null" v-if="contextData && contextData.originalItem && contextData.originalItem.entry.recipe != null"
@click=" @click="
$refs.menu.close() $refs.menu.close()
openRecipe(contextData.originalItem.entry.recipe) openRecipe(contextData.originalItem.entry.recipe, contextData.originalItem.entry.servings)
" "
> >
<a class="dropdown-item p-2" href="javascript:void(0)"><i class="fas fa-pizza-slice"></i> <a class="dropdown-item p-2" href="javascript:void(0)"><i class="fas fa-pizza-slice"></i>
@ -392,8 +392,10 @@ export default {
}, },
}, },
methods: { methods: {
openRecipe: function (recipe) { openRecipe: function (recipe, servings) {
window.open(this.resolveDjangoUrl("view_recipe", recipe.id)) let ur = this.resolveDjangoUrl("view_recipe", `${recipe.id}-${servings}`)
console.log(ur)
window.open(ur)
}, },
setStartingDay(days) { setStartingDay(days) {
if (this.settings.startingDayOfWeek + days < 0) { if (this.settings.startingDayOfWeek + days < 0) {