- added file resource

- frontend refactoring
This commit is contained in:
Peter Papp
2021-08-26 18:01:57 +02:00
parent f5f2179145
commit 5c6a873b02
37 changed files with 339 additions and 773 deletions

View File

@@ -63,16 +63,16 @@ export default {
: this.files[Math.abs(this.currentIndex) % this.files.length]
},
isPDF() {
return this.currentFile.mimetype === 'pdf'
return this.currentFile.data.attributes.mimetype === 'pdf'
},
isVideo() {
return this.currentFile.type === 'video'
return this.currentFile.data.type === 'video'
},
isAudio() {
return this.currentFile.type === 'audio'
return this.currentFile.data.type === 'audio'
},
isImage() {
return this.currentFile.type === 'image'
return this.currentFile.data.type === 'image'
}
},
data() {
@@ -113,20 +113,20 @@ export default {
this.entries.map(element => {
if (requestedFile.mimetype === 'pdf') {
if (requestedFile.data.attributes.mimetype === 'pdf') {
if (element.mimetype === 'pdf')
if (element.data.attributes.mimetype === 'pdf')
this.files.push(element)
} else {
if (element.type === requestedFile.type)
if (element.data.type === requestedFile.data.type)
this.files.push(element)
}
})
this.files.forEach((element, index) => {
if (element.id === this.clipboard[0].id) {
if (element.data.id === this.clipboard[0].data.id) {
this.currentIndex = index
}
})

View File

@@ -3,7 +3,7 @@
<div class="name-wrapper">
<x-icon @click="closeFullPreview" size="22" class="icon-close hover-text-theme" />
<div class="name-count-wrapper">
<p class="title">{{ currentFile.name }}</p>
<p class="title">{{ currentFile.data.attributes.name }}</p>
<span v-if="! fastPreview" class="file-count"> ({{ showingImageIndex + ' ' + $t('pronouns.of') + ' ' + files.length }}) </span>
</div>
<PopoverWrapper>
@@ -25,7 +25,7 @@
</div>
<div class="created-at-wrapper">
<p>{{ currentFile.filesize }}, {{ currentFile.created_at }}</p>
<p>{{ currentFile.data.attributes.filesize }}, {{ currentFile.data.attributes.created_at }}</p>
</div>
<div class="navigation-icons">
@@ -74,29 +74,29 @@
return this.fastPreview ? this.fastPreview : this.clipboard[0]
},
sharingTitle() {
return this.currentFile.shared
return this.currentFile.data.relationships.shared
? this.$t('context_menu.share_edit')
: this.$t('context_menu.share')
},
isImage() {
return this.currentFile.type === 'image'
return this.currentFile.data.type === 'image'
},
isPdf() {
return this.currentFile.mimetype === 'pdf'
return this.currentFile.data.attributes.mimetype === 'pdf'
},
files() {
let files = []
this.entries.map(element => {
if (this.currentFile.mimetype === 'pdf') {
if (this.currentFile.data.attributes.mimetype === 'pdf') {
if (element.mimetype === 'pdf')
if (element.data.attributes.mimetype === 'pdf')
files.push(element)
} else {
if (element.type === this.currentFile.type)
if (element.data.type === this.currentFile.data.type)
files.push(element)
}
})
@@ -107,7 +107,7 @@
let activeIndex = undefined
this.files.forEach((element, index) => {
if (element.id === this.currentFile.id) {
if (element.data.id === this.currentFile.data.id) {
activeIndex = index + 1
}
})
@@ -142,8 +142,8 @@
},
downloadItem() {
this.$downloadFile(
this.currentFile.file_url,
this.currentFile.name + '.' + this.currentFile.mimetype
this.currentFile.data.attributes.file_url,
this.currentFile.data.attributes.name + '.' + this.currentFile.data.attributes.mimetype
)
},
closeFullPreview() {

View File

@@ -2,7 +2,7 @@
<audio
:class="{'file-shadow': ! $isMobile() }"
class="file audio"
:src="file.file_url"
:src="file.data.attributes.file_url"
controls>
</audio>
</template>

View File

@@ -3,7 +3,7 @@
id="printable-file"
class="file"
:class="{'file-shadow': ! $isMobile() }"
:src="file.file_url"
:src="file.data.attributes.file_url"
/>
</template>

View File

@@ -1,7 +1,7 @@
<template>
<div class="video-wrapper">
<video
:src="file.file_url"
:src="file.data.attributes.file_url"
class="video"
:class="{'file-shadow': !$isMobile() }"
controlsList="nodownload"