Former-commit-id: 419fb04f20d9be50358b0d87285fa92855906f97 [formerly fd974c12d0c06b0bde92e201f636c977a1638608] [formerly faa13a4e0c06720f217e7e4387ca0bf9e367365d [formerly 39f39cca2951018d900ff777b36a9b8f720c4356]]
Former-commit-id: b2df427ca1f97e407a549848649bad020eb5453f [formerly 484d32224ca56fa68d6b5b0f01626d69eaa0528b]
Former-commit-id: 81103561b811e456c4e50dd0d8a6e555e8584839
This commit is contained in:
Henrique Dias
2017-06-30 12:43:43 +01:00
parent 4f964faf6e
commit 5d84c22a91
17 changed files with 169 additions and 413 deletions

View File

@@ -1,8 +1,8 @@
<template>
<div class="prompt">
<h3>Delete files</h3>
<p v-show="req.kind !== 'listing'">Are you sure you want to delete this file/folder?</p>
<p v-show="req.kind === 'listing'">Are you sure you want to delete {{ selected.length }} file(s)?</p>
<p v-show="$store.state.req.kind !== 'listing'">Are you sure you want to delete this file/folder?</p>
<p v-show="$store.state.req.kind === 'listing'">Are you sure you want to delete {{ $store.getters.selectedCount }} file(s)?</p>
<div>
<button @click="submit" autofocus>Delete</button>
<button @click="cancel" class="cancel">Cancel</button>
@@ -14,13 +14,8 @@
import webdav from '../webdav'
import page from '../page'
var $ = window.info
export default {
name: 'delete-prompt',
data: function () {
return window.info
},
methods: {
cancel: function (event) {
this.$store.commit('showDelete', false)
@@ -29,7 +24,7 @@ export default {
this.$store.commit('showDelete', false)
// buttons.setLoading('delete')
if ($.req.kind !== 'listing') {
if (this.$store.state.req.kind !== 'listing') {
webdav.trash(window.location.pathname)
.then(() => {
// buttons.setDone('delete')
@@ -43,13 +38,13 @@ export default {
return
}
if ($.selected.length === 0) {
if (this.$store.getters.selectedCount === 0) {
// This shouldn't happen...
return
}
if ($.selected.length === 1) {
webdav.trash($.req.data.items[$.selected[0]].url)
if (this.$store.getters.selectedCount === 1) {
webdav.trash(this.$store.state.req.data.items[this.$store.state.selected[0]].url)
.then(() => {
// buttons.setDone('delete')
page.reload()
@@ -65,8 +60,8 @@ export default {
// More than one item!
let promises = []
for (let index of $.selected) {
promises.push(webdav.trash($.req.data.items[index].url))
for (let index of this.$store.state.selected) {
promises.push(webdav.trash(this.$store.state.req.data.items[index].url))
}
Promise.all(promises)

View File

@@ -13,7 +13,7 @@ export default {
name: 'download-button',
methods: {
count: function () {
return $.selected.length
return this.$store.getters.selectedCount
},
download: function (event) {
if ($.req.kind !== 'listing') {

View File

@@ -1,28 +1,28 @@
<template>
<div class="prompt help">
<h3>Help</h3>
<div class="prompt help">
<h3>Help</h3>
<ul>
<li><strong>F1</strong> - this information</li>
<li><strong>F2</strong> - rename file</li>
<li><strong>DEL</strong> - delete selected items</li>
<li><strong>ESC</strong> - clear selection and/or close the prompt</li>
<li><strong>CTRL + S</strong> - save a file or download the directory where you are</li>
<li><strong>CTRL + Click</strong> - select multiple files or directories</li>
<li><strong>Double click</strong> - open a file or directory</li>
<li><strong>Click</strong> - select file or directory</li>
</ul>
<ul>
<li><strong>F1</strong> - this information</li>
<li><strong>F2</strong> - rename file</li>
<li><strong>DEL</strong> - delete selected items</li>
<li><strong>ESC</strong> - clear selection and/or close the prompt</li>
<li><strong>CTRL + S</strong> - save a file or download the directory where you are</li>
<li><strong>CTRL + Click</strong> - select multiple files or directories</li>
<li><strong>Double click</strong> - open a file or directory</li>
<li><strong>Click</strong> - select file or directory</li>
</ul>
<p>Not available yet</p>
<p>Not available yet</p>
<ul>
<li><strong>Alt + Click</strong> - select a group of files</li>
</ul>
<ul>
<li><strong>Alt + Click</strong> - select a group of files</li>
</ul>
<div>
<button type="submit" @click="close" class="ok">OK</button>
</div>
<div>
<button type="submit" @click="close" class="ok">OK</button>
</div>
</div>
</template>
<script>
@@ -30,7 +30,7 @@ export default {
name: 'help',
methods: {
close: function (event) {
window.info.showHelp = false
this.$store.commit('showHelp', false)
}
}
}

View File

@@ -59,9 +59,9 @@
<input style="display:none" type="file" id="upload-input" @change="uploadInput($event)" value="Upload" multiple>
<div v-show="multiple" :class="{ active: multiple }" id="multiple-selection">
<div v-show="$store.state.multiple" :class="{ active: $store.state.multiple }" id="multiple-selection">
<p>Multiple selection enabled</p>
<div @click="cancelMultiple" tabindex="0" role="button" title="Clear" aria-label="Clear" class="action">
<div @click="$store.commit('multiple', false)" tabindex="0" role="button" title="Clear" aria-label="Clear" class="action">
<i class="material-icons" title="Clear">clear</i>
</div>
</div>
@@ -73,8 +73,6 @@ import Item from './ListingItem'
import webdav from '../webdav.js'
import page from '../page.js'
var $ = window.info
export default {
name: 'listing',
data: function () {
@@ -92,9 +90,6 @@ export default {
base64: function (name) {
return window.btoa(name)
},
cancelMultiple: function () {
$.multiple = false
},
dragEnter: function (event) {
let items = document.getElementsByClassName('item')

View File

@@ -25,18 +25,18 @@
</template>
<script>
import { mapMutations } from 'vuex'
import filesize from 'filesize'
import moment from 'moment'
import webdav from '../webdav.js'
import page from '../page.js'
import array from '../array.js'
var $ = window.info
export default {
name: 'item',
props: ['name', 'isDir', 'url', 'type', 'size', 'modified', 'index'],
methods: {
// ...mapGetters('selectedCount'),
...mapMutations('addSelected', 'removeSelected'),
icon: function () {
if (this.isDir) return 'folder'
if (this.type === 'image') return 'insert_photo'
@@ -98,19 +98,21 @@ export default {
link.setAttribute('aria-selected', false)
})
$.selected = []
this.$store.commit('resetSelected')
return false
},
click: function (event) {
if ($.selected.length !== 0) event.preventDefault()
if ($.selected.indexOf(this.index) === -1) {
if (!event.ctrlKey && !$.multiple) this.unselectAll()
if (this.selectedCount !== 0) event.preventDefault()
if (this.$store.state.selected.indexOf(this.index) === -1) {
if (!event.ctrlKey && !this.$store.state.multiple) this.unselectAll()
this.$el.setAttribute('aria-selected', true)
$.selected.push(this.index)
// WORKS: this.$store.commit('addSelected', this.index)
this.addSelected(this.index)
} else {
this.$el.setAttribute('aria-selected', false)
$.selected = array.remove($.selected, this.index)
this.removeSelected(this.index)
// WORKS: this.$store.commit('removeSelected', this.index)
}
// this.handleSelectionChange()

View File

@@ -17,8 +17,7 @@
<script>
import page from '../page'
var $ = window.info
import { mapState } from 'vuex'
export default {
name: 'search',
@@ -31,6 +30,7 @@ export default {
input: null
}
},
computed: mapState('user'),
mounted: function () {
this.scrollable = document.querySelector('#search > div')
this.box = document.querySelector('#search > div div')
@@ -39,8 +39,8 @@ export default {
},
methods: {
reset: function () {
if ($.user.allowCommands && $.user.commands.length > 0) {
this.box.innerHTML = `Search or use one of your supported commands: ${$.user.commands.join(', ')}.`
if (this.user.allowCommands && this.user.commands.length > 0) {
this.box.innerHTML = `Search or use one of your supported commands: ${this.user.commands.join(', ')}.`
} else {
this.box.innerHTML = 'Type and press enter to search.'
}
@@ -49,8 +49,8 @@ export default {
let value = this.input.value
let pieces = value.split(' ')
for (let i = 0; i < $.user.commands.length; i++) {
if (pieces[0] === $.user.commands[0]) {
for (let i = 0; i < this.user.commands.length; i++) {
if (pieces[0] === this.user.commands[0]) {
return true
}
}
@@ -69,7 +69,7 @@ export default {
return
}
if (!this.supported() || !$.user.allowCommands) {
if (!this.supported() || !this.user.allowCommands) {
this.box.innerHTML = 'Press enter to search.'
} else {
this.box.innerHTML = 'Press enter to execute.'
@@ -87,7 +87,7 @@ export default {
let protocol = this.$store.state.ssl ? 'wss:' : 'ws:'
if (this.supported() && $.user.allowCommands) {
if (this.supported() && this.user.allowCommands) {
let conn = new window.WebSocket(`${protocol}//${url}?command=true`)
conn.onopen = () => {

View File

@@ -8,15 +8,13 @@
<script>
import page from '../page'
var $ = window.info
export default {
name: 'switch-button',
methods: {
change: function (event) {
let url = window.location.pathname + '?display='
if ($.req.data.display === 'mosaic') {
if (this.$store.state.req.data.display === 'mosaic') {
url += 'list'
} else {
url += 'mosaic'
@@ -25,7 +23,7 @@ export default {
page.open(url)
},
icon: function () {
if ($.req.data.display === 'mosaic') return 'view_list'
if (this.$store.state.req.data.display === 'mosaic') return 'view_list'
return 'view_module'
}
}