Former-commit-id: 669a20f35e5a94af214b70502c884232a14139f8 [formerly 3eafe2a3a86e79a970816eedb6c32d67f4c8f050] [formerly a77c64652b6e8ed6a224f5fb83886d8c1b52caa1 [formerly 3785423d740a44439e382103322819c1f9c86b44]] Former-commit-id: 407cfb10b54fca8862697c7132e138565a17b5be [formerly 88891c481ff2dbd3383355eb37ebd88f3b7885e6] Former-commit-id: 0fabc1b8a68c87d2046767832fa0f4f62ac1f533
54 lines
1.2 KiB
Vue
54 lines
1.2 KiB
Vue
<template>
|
|
<div class="prompt">
|
|
<h3>New directory</h3>
|
|
<p>Write the name of the new directory.</p>
|
|
<input autofocus type="text" @keyup.enter="submit" v-model.trim="name">
|
|
<div>
|
|
<button class="ok" @click="submit">Create</button>
|
|
<button class="cancel" @click="$store.commit('showNewDir', false)">Cancel</button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import url from '@/utils/url'
|
|
import api from '@/utils/api'
|
|
|
|
export default {
|
|
name: 'new-dir-prompt',
|
|
data: function () {
|
|
return {
|
|
name: ''
|
|
}
|
|
},
|
|
methods: {
|
|
submit: function (event) {
|
|
event.preventDefault()
|
|
if (this.new === '') return
|
|
|
|
let uri = this.$route.path
|
|
if (this.$store.state.req.kind !== 'listing') {
|
|
uri = url.removeLastDir(uri) + '/'
|
|
}
|
|
|
|
uri += this.name + '/'
|
|
uri = uri.replace('//', '/')
|
|
|
|
// buttons.setLoading('newDir')
|
|
api.put(uri)
|
|
.then(() => {
|
|
// buttons.setDone('newDir')
|
|
this.$router.push({ path: uri })
|
|
})
|
|
.catch(error => {
|
|
// buttons.setDone('newDir', false)
|
|
console.log(error)
|
|
})
|
|
|
|
this.$store.commit('showNewDir', false)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|