Skip to content
Snippets Groups Projects
Commit eed23a45 authored by Timothee P's avatar Timothee P :sunflower:
Browse files

feat: preview image if not pdf

parent b7ec0173
No related branches found
No related tags found
1 merge request!839REDMINE_ISSUE-19725 | Redirection vers la page de connexion du portail MRN si l'utilisateur n'est pas connecté
<template> <template>
<div class="attachment-preview"> <div :class="['attachment-preview', { is_pdf }]">
<embed src="http://localhost:8000/media/user_1/attachements/sample-1.pdf" type="application/pdf" width="100%" height="100%"> <embed
v-if="is_pdf"
:src="src"
type="application/pdf"
width="100%"
height="100%"
>
<img
v-else
:src="src"
>
</div> </div>
</template> </template>
...@@ -11,6 +21,17 @@ export default { ...@@ -11,6 +21,17 @@ export default {
name: 'FeatureAttachmentPreview', name: 'FeatureAttachmentPreview',
computed: { computed: {
is_pdf() {
return this.src && this.src.includes('pdf');
}
},
data() {
return {
// src: "http://localhost:8000/media/user_1/attachements/sample-1.pdf"
src: "http://localhost:8010/media/user_1/attachements/Miscanthus-sinensis-Little-Miss-84976-1.webp"
}
}, },
mounted() { mounted() {
...@@ -26,15 +47,23 @@ export default { ...@@ -26,15 +47,23 @@ export default {
.attachment-preview { .attachment-preview {
width: 100vw; width: 100vw;
padding: 0; padding: 0;
@media screen and (min-width: 726px) { &.is_pdf {
height: calc(100vh - 70px - 1em); @media screen and (min-width: 726px) {
margin: .5em auto; height: calc(100vh - 70px - 1em);
box-shadow: 1px 2px 10px grey; margin: .5em auto;
box-shadow: 1px 2px 10px grey;
}
@media screen and (max-width: 725px) {
height: calc(100vh - 110px);
margin: 0 auto;
}
} }
div {
@media screen and (max-width: 725px) { height: 100%;
height: calc(100vh - 110px); width: 100%;
margin: 0 auto; }
img {
height: 100%;
} }
} }
</style> </style>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment