Former-commit-id: 682c7d56814a3c9a35fcf55b540e470b5c66d890 [formerly a603a591938ec8edbe3f703772f86ba978ff92de] [formerly 6d1a11fdeb5d3a00c202e125a0873b263a3787cf [formerly 12c466d2aafbd07bea83352c03d0ad19347dbea3]] Former-commit-id: 4f43bbf0b4f91a9528cdf881f4abbdfc098b82cd [formerly 7fc1e010ac54107ff03762ad729ed54beccca02c] Former-commit-id: 4d464034e98aefbdce39d142a30bf34aa3fd2d2e
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 = window.location.pathname
|
|
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>
|
|
|