Improvements and more reliability :)

Former-commit-id: 4d5ca1dd46c57e35222860a66c9f98f945fbaad7 [formerly 5a0bea68d0ddec09c95919c1ef45bdff3f602bc6] [formerly b324db325f094e5563f945c41f4f9eeb0b2df086 [formerly 698a08e1a9]]
Former-commit-id: 6c39601f33482edafad63f4b39e10e2720db2813 [formerly 02a9c37289ce3d27eee55f3eb3052391349adc0e]
Former-commit-id: fd29981acff35fa5428af5e1d95fe1d53bba0459
This commit is contained in:
Henrique Dias
2017-06-30 17:49:05 +01:00
parent 713e89eb68
commit c7e37c09e1
17 changed files with 239 additions and 300 deletions

View File

@@ -1,32 +1,35 @@
<template>
<div id="previewer">
<div class="bar">
<button @click="back" class="action" aria-label="Close Preview" id="close">
<i class="material-icons">close</i>
</button>
<div id="previewer">
<div class="bar">
<button @click="back" class="action" aria-label="Close Preview" id="close">
<i class="material-icons">close</i>
</button>
<rename-button v-if="allowEdit()"></rename-button>
<delete-button v-if="allowEdit()"></delete-button>
<download-button></download-button>
<info-button></info-button>
</div>
<div class="preview">
<img v-if="type == 'image'" :src="raw()">
<audio v-else-if="type == 'audio'" :src="raw()" controls></audio>
<video v-else-if="type == 'video'" :src="raw()" controls>
Sorry, your browser doesn't support embedded videos,
but don't worry, you can <a href="?download=true">download it</a>
and watch it with your favorite video player!
</video>
<object v-else-if="extension == '.pdf'" class="pdf" :data="raw()"></object>
<a v-else-if="type == 'blob'" href="?download=true"><h2 class="message">Download <i class="material-icons">file_download</i></h2></a>
<pre v-else >{{ content }}</pre>
</div>
<rename-button v-if="allowEdit()"></rename-button>
<delete-button v-if="allowEdit()"></delete-button>
<download-button></download-button>
<info-button></info-button>
</div>
<div class="preview">
<img v-if="req.data.type == 'image'" :src="raw()">
<audio v-else-if="req.data.type == 'audio'" :src="raw()" controls></audio>
<video v-else-if="req.data.type == 'video'" :src="raw()" controls>
Sorry, your browser doesn't support embedded videos,
but don't worry, you can <a href="?download=true">download it</a>
and watch it with your favorite video player!
</video>
<object v-else-if="req.data.extension == '.pdf'" class="pdf" :data="raw()"></object>
<a v-else-if="req.data.type == 'blob'" href="?download=true">
<h2 class="message">Download <i class="material-icons">file_download</i></h2>
</a>
<pre v-else >{{ req.data.content }}</pre>
</div>
</div>
</template>
<script>
import { mapState } from 'vuex'
import page from '../utils/page'
import InfoButton from './InfoButton'
import DeleteButton from './DeleteButton'
@@ -41,19 +44,17 @@ export default {
RenameButton,
DownloadButton
},
data: function () {
return window.info.req.data
},
computed: mapState(['req']),
methods: {
raw: function () {
return this.url + '?raw=true'
return this.req.data.url + '?raw=true'
},
back: function (event) {
let url = page.removeLastDir(window.location.pathname)
page.open(url)
},
allowEdit: function (event) {
return window.info.user.allowEdit
return this.$store.state.user.allowEdit
}
}
}