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:
@@ -7,7 +7,7 @@
|
||||
</div>
|
||||
<div>
|
||||
<rename-button v-show="showRenameButton()"></rename-button>
|
||||
<move-button v-show="showDeleteButton()"></move-button>
|
||||
<move-button v-show="showMoveButton()"></move-button>
|
||||
<delete-button v-show="showDeleteButton()"></delete-button>
|
||||
<switch-button v-show="req.kind !== 'editor'"></switch-button>
|
||||
<download-button></download-button>
|
||||
@@ -50,6 +50,7 @@
|
||||
<rename-prompt v-show="showRename" :class="{ active: showRename }"></rename-prompt>
|
||||
<delete-prompt v-show="showDelete" :class="{ active: showDelete }"></delete-prompt>
|
||||
<info-prompt v-show="showInfo" :class="{ active: showInfo }"></info-prompt>
|
||||
<move-prompt v-if="showMove" :class="{ active: showMove }"></move-prompt>
|
||||
<help v-show="showHelp" :class="{ active: showHelp }"></help>
|
||||
|
||||
<div v-show="showOverlay()" @click="resetPrompts" class="overlay" :class="{ active: showOverlay() }"></div>
|
||||
@@ -73,8 +74,11 @@ import UploadButton from './components/UploadButton'
|
||||
import DownloadButton from './components/DownloadButton'
|
||||
import SwitchButton from './components/SwitchViewButton'
|
||||
import MoveButton from './components/MoveButton'
|
||||
import MovePrompt from './components/MovePrompt'
|
||||
import css from './css.js'
|
||||
|
||||
var $ = window.info
|
||||
|
||||
function updateColumnSizes () {
|
||||
let columns = Math.floor(document.querySelector('main').offsetWidth / 300)
|
||||
let items = css(['#listing.mosaic .item', '.mosaic#listing .item'])
|
||||
@@ -83,11 +87,11 @@ function updateColumnSizes () {
|
||||
}
|
||||
|
||||
function resetPrompts () {
|
||||
window.info.showHelp = false
|
||||
window.info.showInfo = false
|
||||
window.info.showDelete = false
|
||||
window.info.showRename = false
|
||||
window.info.showMove = false
|
||||
$.showHelp = false
|
||||
$.showInfo = false
|
||||
$.showDelete = false
|
||||
$.showRename = false
|
||||
$.showMove = false
|
||||
}
|
||||
|
||||
window.addEventListener('keydown', (event) => {
|
||||
@@ -96,13 +100,13 @@ window.addEventListener('keydown', (event) => {
|
||||
resetPrompts()
|
||||
|
||||
// Unselect all files and folders.
|
||||
if (window.info.req.kind === 'listing') {
|
||||
if ($.req.kind === 'listing') {
|
||||
let items = document.getElementsByClassName('item')
|
||||
Array.from(items).forEach(link => {
|
||||
link.setAttribute('aria-selected', false)
|
||||
})
|
||||
|
||||
window.info.listing.selected.length = 0
|
||||
$.selected = []
|
||||
}
|
||||
|
||||
return
|
||||
@@ -110,18 +114,18 @@ window.addEventListener('keydown', (event) => {
|
||||
|
||||
// Del!
|
||||
if (event.keyCode === 46) {
|
||||
window.info.showDelete = true
|
||||
$.showDelete = true
|
||||
}
|
||||
|
||||
// F1!
|
||||
if (event.keyCode === 112) {
|
||||
event.preventDefault()
|
||||
window.info.showHelp = true
|
||||
$.showHelp = true
|
||||
}
|
||||
|
||||
// F2!
|
||||
if (event.keyCode === 113) {
|
||||
window.info.showRename = true
|
||||
$.showRename = true
|
||||
}
|
||||
|
||||
// CTRL + S
|
||||
@@ -130,7 +134,7 @@ window.addEventListener('keydown', (event) => {
|
||||
case 's':
|
||||
event.preventDefault()
|
||||
|
||||
if (window.info.req.kind !== 'editor') {
|
||||
if ($.req.kind !== 'editor') {
|
||||
window.location = '?download=true'
|
||||
return
|
||||
}
|
||||
@@ -156,7 +160,8 @@ export default {
|
||||
DownloadButton,
|
||||
UploadButton,
|
||||
SwitchButton,
|
||||
MoveButton
|
||||
MoveButton,
|
||||
MovePrompt
|
||||
},
|
||||
mounted: function () {
|
||||
updateColumnSizes()
|
||||
@@ -175,29 +180,40 @@ export default {
|
||||
},
|
||||
showUpload: function () {
|
||||
if (this.req.kind === 'editor') return false
|
||||
return this.user.allowNew
|
||||
return $.user.allowNew
|
||||
},
|
||||
showDeleteButton: function () {
|
||||
if (this.req.kind === 'listing') {
|
||||
if (this.listing.selected.length === 0) {
|
||||
if (this.selected.length === 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
return this.user.allowEdit
|
||||
return $.user.allowEdit
|
||||
}
|
||||
|
||||
return this.user.allowEdit
|
||||
return $.user.allowEdit
|
||||
},
|
||||
showRenameButton: function () {
|
||||
if (this.req.kind === 'listing') {
|
||||
if (this.listing.selected.length === 1) {
|
||||
return this.user.allowEdit
|
||||
if (this.selected.length === 1) {
|
||||
return $.user.allowEdit
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
return this.user.allowEdit
|
||||
return $.user.allowEdit
|
||||
},
|
||||
showMoveButton: function () {
|
||||
if (this.req.kind !== 'listing') {
|
||||
return false
|
||||
}
|
||||
|
||||
if (this.selected.length > 0) {
|
||||
return $.user.allowEdit
|
||||
}
|
||||
|
||||
return false
|
||||
},
|
||||
resetPrompts: resetPrompts
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user