feat: add button to navigate up to .. (parent dir)

This commit is contained in:
Jaroslav Rakhmatoullin 2024-03-31 09:15:34 +02:00
parent 05bfae264a
commit 655a309a96
2 changed files with 16 additions and 1 deletions

View File

@ -32,6 +32,7 @@
"selectMultiple": "Select multiple", "selectMultiple": "Select multiple",
"share": "Share", "share": "Share",
"shell": "Toggle shell", "shell": "Toggle shell",
"gotoParent": "Open parent dir",
"submit": "Submit", "submit": "Submit",
"switchView": "Switch view", "switchView": "Switch view",
"toggleSidebar": "Toggle sidebar", "toggleSidebar": "Toggle sidebar",

View File

@ -46,7 +46,12 @@
show="delete" show="delete"
/> />
</template> </template>
<action
v-if="headerButtons.gotoParent"
icon="arrow_upward"
:label="$t('buttons.gotoParent')"
@action="gotoParent"
/>
<action <action
v-if="headerButtons.shell" v-if="headerButtons.shell"
icon="code" icon="code"
@ -367,6 +372,7 @@ export default {
}, },
headerButtons() { headerButtons() {
return { return {
gotoParent: true,
upload: this.user.perm.create, upload: this.user.perm.create,
download: this.user.perm.download, download: this.user.perm.download,
shell: this.user.perm.execute && enableExec, shell: this.user.perm.execute && enableExec,
@ -853,6 +859,14 @@ export default {
this.setItemWeight(); this.setItemWeight();
this.fillWindow(); this.fillWindow();
}, },
gotoParent: function() {
const url = (window.location.pathname || "")
const parts = url.replace(/\/$/, '').split('/');
parts.pop();
const parentUrl = parts.join('/');
this.$router.push({ path: parentUrl });
},
upload: function () { upload: function () {
if ( if (
typeof window.DataTransferItem !== "undefined" && typeof window.DataTransferItem !== "undefined" &&