mirror of
https://github.com/filegator/filegator.git
synced 2025-08-13 05:24:03 +02:00
File edit
This commit is contained in:
@@ -113,7 +113,7 @@
|
||||
<b-dropdown-item v-if="props.row.type == 'file' && can('download')" aria-role="listitem" @click="download(props.row)">
|
||||
<b-icon icon="download" size="is-small" /> {{ lang('Download') }}
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item v-if="props.row.type == 'file' && can('read')" aria-role="listitem" @click="preview(props.row)">
|
||||
<b-dropdown-item v-if="props.row.type == 'file' && can(['read', 'download'])" aria-role="listitem" @click="preview(props.row)">
|
||||
<b-icon icon="file-alt" size="is-small" /> {{ lang('View') }}
|
||||
</b-dropdown-item>
|
||||
<b-dropdown-item v-if="can('write')" aria-role="listitem" @click="copy($event, props.row)">
|
||||
@@ -252,7 +252,7 @@ export default {
|
||||
itemClick(item) {
|
||||
if (item.type == 'dir' || item.type == 'back') {
|
||||
this.goTo(item.path)
|
||||
} else {
|
||||
} else if (this.can(['read', 'download'])) {
|
||||
this.preview(item)
|
||||
}
|
||||
},
|
||||
|
@@ -13,6 +13,9 @@
|
||||
</div>
|
||||
</section>
|
||||
<footer class="modal-card-foot">
|
||||
<button v-if="isText() && can(['write'])" class="button" type="button" @click="saveFile()">
|
||||
{{ lang('Save') }}
|
||||
</button>
|
||||
<button class="button" type="button" @click="$parent.close()">
|
||||
{{ lang('Close') }}
|
||||
</button>
|
||||
@@ -54,6 +57,20 @@ export default {
|
||||
hasExtension(exts) {
|
||||
return (new RegExp('(' + exts.join('|').replace(/\./g, '\\.') + ')$', 'i')).test(this.item.path)
|
||||
},
|
||||
saveFile() {
|
||||
api.saveContent({
|
||||
name: this.item.name,
|
||||
content: this.content,
|
||||
})
|
||||
.then(() => {
|
||||
this.$toast.open({
|
||||
message: this.lang('Updated'),
|
||||
type: 'is-success',
|
||||
})
|
||||
this.$parent.close()
|
||||
})
|
||||
.catch(error => this.handleError(error))
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user