mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-06-04 22:25:34 -04:00
Fix: Print Preferences Menu Missing (#2162)
* fixed console errors for missing recipe prop * restored print preferences to action menu
This commit is contained in:
parent
fd03d468d4
commit
666085b9ca
@ -63,6 +63,7 @@
|
|||||||
mealplanner: loggedIn,
|
mealplanner: loggedIn,
|
||||||
shoppingList: loggedIn,
|
shoppingList: loggedIn,
|
||||||
print: true,
|
print: true,
|
||||||
|
printPreferences: true,
|
||||||
share: loggedIn,
|
share: loggedIn,
|
||||||
publicUrl: recipe.settings && loggedIn ? recipe.settings.public : false,
|
publicUrl: recipe.settings && loggedIn ? recipe.settings.public : false,
|
||||||
}"
|
}"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<!-- Recipe Share Dialog -->
|
<!-- Recipe Share Dialog -->
|
||||||
<RecipeDialogShare v-model="shareDialog" :recipe-id="recipeId" :name="name" />
|
<RecipeDialogShare v-model="shareDialog" :recipe-id="recipeId" :name="name" />
|
||||||
<RecipeDialogPrintPreferences v-model="printPreferencesDialog" :recipe="recipe" />
|
<RecipeDialogPrintPreferences v-model="printPreferencesDialog" :recipe="recipeRef" />
|
||||||
<BaseDialog
|
<BaseDialog
|
||||||
v-model="recipeDeleteDialog"
|
v-model="recipeDeleteDialog"
|
||||||
:title="$t('recipe.delete-recipe')"
|
:title="$t('recipe.delete-recipe')"
|
||||||
@ -383,7 +383,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
const shoppingLists = ref<ShoppingListSummary[]>();
|
const shoppingLists = ref<ShoppingListSummary[]>();
|
||||||
const selectedShoppingList = ref<ShoppingListSummary>();
|
const selectedShoppingList = ref<ShoppingListSummary>();
|
||||||
const recipe = ref<Recipe>(props.recipe);
|
const recipeRef = ref<Recipe>(props.recipe);
|
||||||
const recipeIngredients = ref<{ checked: boolean; ingredient: RecipeIngredient; display: string }[]>([]);
|
const recipeIngredients = ref<{ checked: boolean; ingredient: RecipeIngredient; display: string }[]>([]);
|
||||||
|
|
||||||
async function getShoppingLists() {
|
async function getShoppingLists() {
|
||||||
@ -396,22 +396,22 @@ export default defineComponent({
|
|||||||
async function refreshRecipe() {
|
async function refreshRecipe() {
|
||||||
const { data } = await api.recipes.getOne(props.slug);
|
const { data } = await api.recipes.getOne(props.slug);
|
||||||
if (data) {
|
if (data) {
|
||||||
recipe.value = data;
|
recipeRef.value = data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function openShoppingListIngredientDialog(list: ShoppingListSummary) {
|
async function openShoppingListIngredientDialog(list: ShoppingListSummary) {
|
||||||
selectedShoppingList.value = list;
|
selectedShoppingList.value = list;
|
||||||
if (!recipe.value) {
|
if (!recipeRef.value) {
|
||||||
await refreshRecipe();
|
await refreshRecipe();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recipe.value?.recipeIngredient) {
|
if (recipeRef.value?.recipeIngredient) {
|
||||||
recipeIngredients.value = recipe.value.recipeIngredient.map((ingredient) => {
|
recipeIngredients.value = recipeRef.value.recipeIngredient.map((ingredient) => {
|
||||||
return {
|
return {
|
||||||
checked: true,
|
checked: true,
|
||||||
ingredient,
|
ingredient,
|
||||||
display: parseIngredientText(ingredient, recipe.value?.settings?.disableAmount || false, props.recipeScale),
|
display: parseIngredientText(ingredient, recipeRef.value?.settings?.disableAmount || false, props.recipeScale),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -510,7 +510,10 @@ export default defineComponent({
|
|||||||
mealplanner: () => {
|
mealplanner: () => {
|
||||||
state.mealplannerDialog = true;
|
state.mealplannerDialog = true;
|
||||||
},
|
},
|
||||||
printPreferences: () => {
|
printPreferences: async () => {
|
||||||
|
if (!recipeRef.value) {
|
||||||
|
await refreshRecipe();
|
||||||
|
}
|
||||||
state.printPreferencesDialog = true;
|
state.printPreferencesDialog = true;
|
||||||
},
|
},
|
||||||
shoppingList: () => {
|
shoppingList: () => {
|
||||||
@ -547,6 +550,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
|
recipeRef,
|
||||||
shoppingLists,
|
shoppingLists,
|
||||||
selectedShoppingList,
|
selectedShoppingList,
|
||||||
openShoppingListIngredientDialog,
|
openShoppingListIngredientDialog,
|
||||||
|
@ -48,7 +48,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, defineComponent } from "@nuxtjs/composition-api";
|
import { computed, defineComponent } from "@nuxtjs/composition-api";
|
||||||
import { Recipe } from "~/lib/api/types/recipe";
|
import { Recipe } from "~/lib/api/types/recipe";
|
||||||
import { NoUndefinedField } from "~/lib/api/types/non-generated";
|
|
||||||
import { ImagePosition, useUserPrintPreferences } from "~/composables/use-users/preferences";
|
import { ImagePosition, useUserPrintPreferences } from "~/composables/use-users/preferences";
|
||||||
import RecipePrintView from "~/components/Domain/Recipe/RecipePrintView.vue";
|
import RecipePrintView from "~/components/Domain/Recipe/RecipePrintView.vue";
|
||||||
|
|
||||||
@ -62,8 +61,8 @@ export default defineComponent({
|
|||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
recipe: {
|
recipe: {
|
||||||
type: Object as () => NoUndefinedField<Recipe>,
|
type: Object as () => Recipe,
|
||||||
required: true,
|
default: undefined,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup(props, context) {
|
setup(props, context) {
|
||||||
|
@ -30,8 +30,6 @@ export default defineComponent({
|
|||||||
ADD_ATTR: ["src", "alt", "height", "width", "class", "allow", "title", "allowfullscreen", "frameborder", "scrolling"],
|
ADD_ATTR: ["src", "alt", "height", "width", "class", "allow", "title", "allowfullscreen", "frameborder", "scrolling"],
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(sanitized)
|
|
||||||
|
|
||||||
return sanitized;
|
return sanitized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user