2017-06-29 17:55:16 +00:00
|
|
|
<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="cancel">Cancel</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import page from '../page'
|
|
|
|
import webdav from '../webdav'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'new-dir-prompt',
|
|
|
|
data: function () {
|
|
|
|
return {
|
|
|
|
name: ''
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
cancel: function () {
|
2017-06-30 09:25:35 +00:00
|
|
|
this.$store.commit('showNewDir', false)
|
2017-06-29 17:55:16 +00:00
|
|
|
},
|
|
|
|
submit: function (event) {
|
|
|
|
event.preventDefault()
|
|
|
|
if (this.new === '') return
|
|
|
|
|
|
|
|
let url = window.location.pathname + this.name + '/'
|
|
|
|
url = url.replace('//', '/')
|
|
|
|
|
|
|
|
// buttons.setLoading('newDir')
|
|
|
|
webdav.create(url)
|
|
|
|
.then(() => {
|
|
|
|
// buttons.setDone('newDir')
|
|
|
|
page.open(url)
|
|
|
|
})
|
|
|
|
.catch(e => {
|
|
|
|
// buttons.setDone('newDir', false)
|
|
|
|
console.log(e)
|
|
|
|
})
|
|
|
|
|
2017-06-30 09:25:35 +00:00
|
|
|
this.$store.commit('showNewDir', false)
|
2017-06-29 17:55:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|