mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-05-24 01:12:54 -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,
|
||||
shoppingList: loggedIn,
|
||||
print: true,
|
||||
printPreferences: true,
|
||||
share: loggedIn,
|
||||
publicUrl: recipe.settings && loggedIn ? recipe.settings.public : false,
|
||||
}"
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div class="text-center">
|
||||
<!-- Recipe Share Dialog -->
|
||||
<RecipeDialogShare v-model="shareDialog" :recipe-id="recipeId" :name="name" />
|
||||
<RecipeDialogPrintPreferences v-model="printPreferencesDialog" :recipe="recipe" />
|
||||
<RecipeDialogPrintPreferences v-model="printPreferencesDialog" :recipe="recipeRef" />
|
||||
<BaseDialog
|
||||
v-model="recipeDeleteDialog"
|
||||
:title="$t('recipe.delete-recipe')"
|
||||
@ -383,7 +383,7 @@ export default defineComponent({
|
||||
|
||||
const shoppingLists = 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 }[]>([]);
|
||||
|
||||
async function getShoppingLists() {
|
||||
@ -396,22 +396,22 @@ export default defineComponent({
|
||||
async function refreshRecipe() {
|
||||
const { data } = await api.recipes.getOne(props.slug);
|
||||
if (data) {
|
||||
recipe.value = data;
|
||||
recipeRef.value = data;
|
||||
}
|
||||
}
|
||||
|
||||
async function openShoppingListIngredientDialog(list: ShoppingListSummary) {
|
||||
selectedShoppingList.value = list;
|
||||
if (!recipe.value) {
|
||||
if (!recipeRef.value) {
|
||||
await refreshRecipe();
|
||||
}
|
||||
|
||||
if (recipe.value?.recipeIngredient) {
|
||||
recipeIngredients.value = recipe.value.recipeIngredient.map((ingredient) => {
|
||||
if (recipeRef.value?.recipeIngredient) {
|
||||
recipeIngredients.value = recipeRef.value.recipeIngredient.map((ingredient) => {
|
||||
return {
|
||||
checked: true,
|
||||
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: () => {
|
||||
state.mealplannerDialog = true;
|
||||
},
|
||||
printPreferences: () => {
|
||||
printPreferences: async () => {
|
||||
if (!recipeRef.value) {
|
||||
await refreshRecipe();
|
||||
}
|
||||
state.printPreferencesDialog = true;
|
||||
},
|
||||
shoppingList: () => {
|
||||
@ -547,6 +550,7 @@ export default defineComponent({
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
recipeRef,
|
||||
shoppingLists,
|
||||
selectedShoppingList,
|
||||
openShoppingListIngredientDialog,
|
||||
|
@ -48,7 +48,6 @@
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent } from "@nuxtjs/composition-api";
|
||||
import { Recipe } from "~/lib/api/types/recipe";
|
||||
import { NoUndefinedField } from "~/lib/api/types/non-generated";
|
||||
import { ImagePosition, useUserPrintPreferences } from "~/composables/use-users/preferences";
|
||||
import RecipePrintView from "~/components/Domain/Recipe/RecipePrintView.vue";
|
||||
|
||||
@ -62,8 +61,8 @@ export default defineComponent({
|
||||
default: false,
|
||||
},
|
||||
recipe: {
|
||||
type: Object as () => NoUndefinedField<Recipe>,
|
||||
required: true,
|
||||
type: Object as () => Recipe,
|
||||
default: undefined,
|
||||
},
|
||||
},
|
||||
setup(props, context) {
|
||||
|
@ -30,8 +30,6 @@ export default defineComponent({
|
||||
ADD_ATTR: ["src", "alt", "height", "width", "class", "allow", "title", "allowfullscreen", "frameborder", "scrolling"],
|
||||
});
|
||||
|
||||
console.log(sanitized)
|
||||
|
||||
return sanitized;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user