mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2025-12-30 21:49:50 -05:00
open recipe in new tab from meal plan dialog
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
<template>
|
||||
<template v-if="!props.loading">
|
||||
|
||||
<router-link :to="{name: 'RecipeViewPage', params: {id: props.recipe.id}}">
|
||||
<router-link :to="{name: 'RecipeViewPage', params: {id: props.recipe.id}}" :target="linkTarget">
|
||||
<recipe-image :style="{height: props.height}" :recipe="props.recipe" rounded="lg" class="mr-3 ml-3">
|
||||
|
||||
</recipe-image>
|
||||
</router-link>
|
||||
<div class="ml-3">
|
||||
<div class="d-flex ">
|
||||
<div class="flex-grow-1 cursor-pointer" @click="router.push({name: 'RecipeViewPage', params: {id: props.recipe.id}})">
|
||||
<div class="flex-grow-1 cursor-pointer" @click="openRecipe()">
|
||||
<p class="font-weight-bold mt-2">{{ props.recipe.name }}</p>
|
||||
</div>
|
||||
<div class="mt-1">
|
||||
@@ -107,10 +107,23 @@ const props = defineProps({
|
||||
show_keywords: {type: Boolean, required: false},
|
||||
show_description: {type: Boolean, required: false},
|
||||
height: {type: String, required: false, default: '15vh'},
|
||||
linkTarget: {type: String, required: false, default: ''}
|
||||
})
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
/**
|
||||
* open the recipe either in the same tab or in a new tab depending on the link target prop
|
||||
*/
|
||||
function openRecipe() {
|
||||
if (props.linkTarget != '') {
|
||||
const routeData = router.resolve({name: 'RecipeViewPage', params: {id: props.recipe.id}});
|
||||
window.open(routeData.href, props.linkTarget);
|
||||
} else {
|
||||
router.push({name: 'RecipeViewPage', params: {id: props.recipe.id}})
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
@update:modelValue="editingObj.servings = editingObj.recipe ? editingObj.recipe.servings : 1"></ModelSelect>
|
||||
<!-- <v-number-input label="Days" control-variant="split" :min="1"></v-number-input>-->
|
||||
<!--TODO create days input with +/- synced to date -->
|
||||
<recipe-card :recipe="editingObj.recipe" v-if="editingObj && editingObj.recipe"></recipe-card>
|
||||
<recipe-card :recipe="editingObj.recipe" v-if="editingObj && editingObj.recipe" link-target="_blank"></recipe-card>
|
||||
<v-btn prepend-icon="$shopping" color="create" class="mt-1" v-if="!editingObj.shopping && editingObj.recipe && isUpdate()">
|
||||
{{$t('Add')}}
|
||||
<add-to-shopping-dialog :recipe="editingObj.recipe" :meal-plan="editingObj" @created="loadShoppingListEntries(); editingObj.shopping = true;"></add-to-shopping-dialog>
|
||||
@@ -47,6 +47,7 @@
|
||||
multiple="range"
|
||||
prepend-icon=""
|
||||
prepend-inner-icon="$calendar"
|
||||
hide-details
|
||||
></v-date-input>
|
||||
|
||||
<v-input>
|
||||
|
||||
Reference in New Issue
Block a user