-
-
Notifications
You must be signed in to change notification settings - Fork 604
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
275c879
commit 38c8e1b
Showing
5 changed files
with
94 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<template> | ||
<v-card class="mt-1 h-100"> | ||
<iframe width="100%" height="700px" :src="`${getDjangoUrl('/api/get_recipe_file/')}${props.recipe.id}/`" v-if="isPdf"></iframe> | ||
|
||
<v-img :src="`${getDjangoUrl('/api/get_recipe_file/')}${props.recipe.id}/`" v-if="isImage"></v-img> | ||
</v-card> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import {computed, PropType} from "vue"; | ||
import {Recipe} from "@/openapi"; | ||
import {useDjangoUrls} from "@/composables/useDjangoUrls"; | ||
const props = defineProps({ | ||
recipe: {type: {} as PropType<Recipe>, required: true} | ||
}) | ||
const {getDjangoUrl} = useDjangoUrls() | ||
/** | ||
* determines if the file is a PDF based on the path | ||
*/ | ||
const isPdf = computed(() => { | ||
let filePath = props.recipe.filePath | ||
if (filePath) { | ||
return filePath.includes('.pdf') | ||
} | ||
return false | ||
}) | ||
/** | ||
* determines if the file is an image based on the path | ||
*/ | ||
const isImage = computed(() => { | ||
let filePath = props.recipe.filePath | ||
if (filePath) { | ||
return filePath.includes('.png') || filePath.includes('.jpg') || filePath.includes('.jpeg') || filePath.includes('.gif') | ||
} | ||
return false | ||
}) | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters