Former-commit-id: 229baefa76ee3202dcf4aac3249a461b6cc51eed [formerly 2773046c33eee1ff79ef1d02238de37e14860726] [formerly 2d50f10c3f809c6135cc861eaf0360092a23ea3f [formerly 14ff4f2b74c440888b632a6bacd338067dd0b588]] Former-commit-id: e766887e65390514cf827700c3ab0d5ed000c480 [formerly 7429be72884d3eb154e45dc638fd17dfcfdfaa62] Former-commit-id: d23373bf316295d6579e4bbc780f5b963c632c4d
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('closeHovers')">Cancel</button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import url from '@/utils/url'
|
|
import api from '@/utils/api'
|
|
|
|
export default {
|
|
name: 'new-dir',
|
|
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('closeHovers')
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|