Organisation and reworking stuff
Former-commit-id: 01621444e51316cc9f125e4d541caf9d6c9d37a1 [formerly 733a976b594348754cb34b27c594c485fd5b0df4] [formerly 36a2f39b0e471ee231343ebaed474ae247764b37 [formerly 8d891f0d513d21282adfd9e1b9f206b69f4b17c7]] Former-commit-id: 505c381e3135c0e0607e984a37e908672e8100a3 [formerly a6e70288608c6ee1edc380af76ee3e82ff62861a] Former-commit-id: d946069b4f8ad1b19da7ee087901762b3f4b7936
This commit is contained in:
53
_assets/src/components/prompts/NewFilePrompt.vue
Normal file
53
_assets/src/components/prompts/NewFilePrompt.vue
Normal file
@@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<div class="prompt">
|
||||
<h3>New file</h3>
|
||||
<p>Write the name of the new file.</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('showNewFile', false)">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import page from '@/utils/page'
|
||||
import webdav from '@/utils/webdav'
|
||||
|
||||
export default {
|
||||
name: 'new-file-prompt',
|
||||
data: function () {
|
||||
return {
|
||||
name: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit: function (event) {
|
||||
event.preventDefault()
|
||||
if (this.new === '') return
|
||||
|
||||
let url = window.location.pathname
|
||||
if (this.$store.state.req.kind !== 'listing') {
|
||||
url = page.removeLastDir(url) + '/'
|
||||
}
|
||||
|
||||
url += this.name
|
||||
url = url.replace('//', '/')
|
||||
|
||||
// buttons.setLoading('newFile')
|
||||
webdav.create(url)
|
||||
.then(() => {
|
||||
// buttons.setDone('newFile')
|
||||
page.open(url)
|
||||
})
|
||||
.catch(e => {
|
||||
// buttons.setDone('newFile', false)
|
||||
console.log(e)
|
||||
})
|
||||
|
||||
this.$store.commit('showNewFile', false)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user