Former-commit-id: 419fb04f20d9be50358b0d87285fa92855906f97 [formerly fd974c12d0c06b0bde92e201f636c977a1638608] [formerly faa13a4e0c06720f217e7e4387ca0bf9e367365d [formerly 39f39cca29]]
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

@@ -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()