Updates :D

Former-commit-id: 4aab1964b9462d1fdee92999dd5a7d03f17b4457 [formerly 22352202547980b191886cf29f68ce8e9cc4c39b] [formerly 1a66bae34022092936c2912ea3a323a6984fe7e4 [formerly 1e7c4e6468b07dbb2b2726df4ff345371e2ec714]]
Former-commit-id: 94170b15369b05e8f4985e88242ba453b5545116 [formerly 2a0b57bebcd48c0189974f4f9e72679b5c67f37b]
Former-commit-id: 635be5ad2826c1659670997900122d024a46de24
This commit is contained in:
Henrique Dias
2017-06-29 14:16:08 +01:00
parent 60ffb88d8e
commit dd87a70157
13 changed files with 220 additions and 201 deletions

View File

@@ -2,13 +2,13 @@
<div class="prompt">
<h3>File Information</h3>
<p v-show="listing.selected.length > 1">{{ listing.selected.length }} files selected.</p>
<p v-show="selected.length > 1">{{ selected.length }} files selected.</p>
<p v-show="listing.selected.length < 2"><strong>Display Name:</strong> {{ name() }}</p>
<p v-show="selected.length < 2"><strong>Display Name:</strong> {{ name() }}</p>
<p><strong>Size:</strong> <span id="content_length"></span>{{ humanSize() }}</p>
<p v-show="listing.selected.length < 2"><strong>Last Modified:</strong> {{ humanTime() }}</p>
<p v-show="selected.length < 2"><strong>Last Modified:</strong> {{ humanTime() }}</p>
<section v-show="dir() && listing.selected.length === 0">
<section v-show="dir() && selected.length === 0">
<p><strong>Number of files:</strong> {{ req.data.numFiles }}</p>
<p><strong>Number of directories:</strong> {{ req.data.numDirs }}</p>
</section>
@@ -37,43 +37,43 @@ export default {
},
methods: {
humanSize: function () {
if (this.listing.selected.length === 0 || this.req.kind !== 'listing') {
if (this.selected.length === 0 || this.req.kind !== 'listing') {
return filesize(this.req.data.size)
}
var sum = 0
for (let i = 0; i < this.listing.selected.length; i++) {
sum += this.req.data.items[this.listing.selected[i]].size
for (let i = 0; i < this.selected.length; i++) {
sum += this.req.data.items[this.selected[i]].size
}
return filesize(sum)
},
humanTime: function () {
if (this.listing.selected.length === 0) {
if (this.selected.length === 0) {
return moment(this.req.data.modified).fromNow()
}
return moment(this.req.data.items[this.listing.selected[0]]).fromNow()
return moment(this.req.data.items[this.selected[0]]).fromNow()
},
name: function () {
if (this.listing.selected.length === 0) {
if (this.selected.length === 0) {
return this.req.data.name
}
return this.req.data.items[this.listing.selected[0]].name
return this.req.data.items[this.selected[0]].name
},
dir: function () {
if (this.listing.selected.length > 1) {
if (this.selected.length > 1) {
// Don't show when multiple selected.
return true
}
if (this.listing.selected.length === 0) {
if (this.selected.length === 0) {
return this.req.data.isDir
}
return this.req.data.items[this.listing.selected[0]].isDir
return this.req.data.items[this.selected[0]].isDir
},
checksum: function (event, hash) {
event.preventDefault()
@@ -81,8 +81,8 @@ export default {
let request = new window.XMLHttpRequest()
let link
if (this.listing.selected.length) {
link = this.req.data.items[this.listing.selected[0]].url
if (this.selected.length) {
link = this.req.data.items[this.selected[0]].url
} else {
link = window.location.pathname
}