Open file in viewer if available
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -45,9 +45,10 @@
|
|||||||
<li v-for="attachment in attachments"
|
<li v-for="attachment in attachments"
|
||||||
:key="attachment.id"
|
:key="attachment.id"
|
||||||
class="attachment">
|
class="attachment">
|
||||||
<a class="fileicon" :style="mimetypeForAttachment(attachment.extendedData.mimetype)" :href="attachmentUrl(attachment)" />
|
<a class="fileicon" :style="mimetypeForAttachment(attachment.extendedData.mimetype)"
|
||||||
|
@click.prevent="showViewer(attachment)" />
|
||||||
<div class="details">
|
<div class="details">
|
||||||
<a :href="attachmentUrl(attachment)" target="_blank">
|
<a @click.prevent="showViewer(attachment)">
|
||||||
<div class="filename">
|
<div class="filename">
|
||||||
<span class="basename">{{ attachment.data }}</span>
|
<span class="basename">{{ attachment.data }}</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -62,6 +63,12 @@
|
|||||||
</ActionButton>
|
</ActionButton>
|
||||||
</Actions>
|
</Actions>
|
||||||
<Actions v-if="removable">
|
<Actions v-if="removable">
|
||||||
|
<ActionLink v-if="attachment.fileid" icon="icon-folder" :href="'/index.php/f/'+attachment.fileid">
|
||||||
|
{{ t('deck', 'Show in files') }}
|
||||||
|
</ActionLink>
|
||||||
|
<ActionButton icon="icon-delete">
|
||||||
|
{{ t('deck', 'Unshare file') }}
|
||||||
|
</ActionButton>
|
||||||
<ActionButton v-if="attachment.deletedAt === 0" icon="icon-delete" @click="$emit('deleteAttachment', attachment)">
|
<ActionButton v-if="attachment.deletedAt === 0" icon="icon-delete" @click="$emit('deleteAttachment', attachment)">
|
||||||
{{ t('deck', 'Delete Attachment') }}
|
{{ t('deck', 'Delete Attachment') }}
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
@@ -76,7 +83,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { Actions, ActionButton } from '@nextcloud/vue'
|
import { Actions, ActionButton, ActionLink } from '@nextcloud/vue'
|
||||||
import AttachmentDragAndDrop from '../AttachmentDragAndDrop'
|
import AttachmentDragAndDrop from '../AttachmentDragAndDrop'
|
||||||
import relativeDate from '../../mixins/relativeDate'
|
import relativeDate from '../../mixins/relativeDate'
|
||||||
import { formatFileSize } from '@nextcloud/files'
|
import { formatFileSize } from '@nextcloud/files'
|
||||||
@@ -91,6 +98,7 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
Actions,
|
Actions,
|
||||||
ActionButton,
|
ActionButton,
|
||||||
|
ActionLink,
|
||||||
AttachmentDragAndDrop,
|
AttachmentDragAndDrop,
|
||||||
},
|
},
|
||||||
mixins: [relativeDate, attachmentUpload],
|
mixins: [relativeDate, attachmentUpload],
|
||||||
@@ -165,6 +173,9 @@ export default {
|
|||||||
clickAddNewAttachmment() {
|
clickAddNewAttachmment() {
|
||||||
this.$refs.localAttachments.click()
|
this.$refs.localAttachments.click()
|
||||||
},
|
},
|
||||||
|
showViewer(attachment) {
|
||||||
|
window.OCA.Viewer.open(attachment.path)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user