1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-02 03:55:22 +02:00

fix: Refresh recipe section when clicking card tag chip (#4810)

Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
gpotter@gmail.com 2025-01-14 09:18:16 -08:00 committed by GitHub
parent 4b992afc67
commit 203218a3d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 61 additions and 16 deletions

View file

@ -35,7 +35,7 @@
-->
<v-col v-if="!isCookMode || isEditForm" cols="12" sm="12" md="4" lg="4">
<RecipePageIngredientToolsView v-if="!isEditForm" :recipe="recipe" :scale="scale" />
<RecipePageOrganizers v-if="$vuetify.breakpoint.mdAndUp" :recipe="recipe" />
<RecipePageOrganizers v-if="$vuetify.breakpoint.mdAndUp" :recipe="recipe" @item-selected="chipClicked" />
</v-col>
<v-divider v-if="$vuetify.breakpoint.mdAndUp && !isCookMode" class="my-divider" :vertical="true" />
@ -166,7 +166,7 @@ import {
usePageUser,
} from "~/composables/recipe-page/shared-state";
import { NoUndefinedField } from "~/lib/api/types/non-generated";
import { Recipe } from "~/lib/api/types/recipe";
import { Recipe, RecipeCategory, RecipeTag, RecipeTool } from "~/lib/api/types/recipe";
import { useRouteQuery } from "~/composables/use-router";
import { useUserApi } from "~/composables/api";
import { uuid4, deepCopy } from "~/composables/use-utils";
@ -329,6 +329,17 @@ export default defineComponent({
*/
const { user } = usePageUser();
/** =============================================================
* RecipeChip Clicked
*/
function chipClicked(item: RecipeTag | RecipeCategory | RecipeTool, itemType: string) {
if (!item.id) {
return;
}
router.push(`/g/${groupSlug.value}?${itemType}=${item.id}`);
}
return {
user,
isOwnGroup,
@ -350,7 +361,8 @@ export default defineComponent({
deleteRecipe,
addStep,
hasLinkedIngredients,
notLinkedIngredients
notLinkedIngredients,
chipClicked,
};
},
head: {},

View file

@ -14,7 +14,7 @@
:show-add="true"
selector-type="categories"
/>
<RecipeChips v-else :items="recipe.recipeCategory" />
<RecipeChips v-else :items="recipe.recipeCategory" v-on="$listeners" />
</v-card-text>
</v-card>
@ -32,7 +32,7 @@
:show-add="true"
selector-type="tags"
/>
<RecipeChips v-else :items="recipe.tags" url-prefix="tags" />
<RecipeChips v-else :items="recipe.tags" url-prefix="tags" v-on="$listeners" />
</v-card-text>
</v-card>
@ -41,7 +41,7 @@
<v-card-title class="py-2"> {{ $t('tool.required-tools') }} </v-card-title>
<v-divider class="mx-2" />
<v-card-text class="pt-0">
<RecipeOrganizerSelector v-model="recipe.tools" selector-type="tools" />
<RecipeOrganizerSelector v-model="recipe.tools" selector-type="tools" v-on="$listeners" />
</v-card-text>
</v-card>
@ -82,6 +82,8 @@ export default defineComponent({
const { user } = usePageUser();
const { isEditForm } = usePageState(props.recipe.slug);
return {
isEditForm,
user,