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",
"share": "Share",
"shell": "Toggle shell",
"gotoParent": "Open parent dir",
"submit": "Submit",
"switchView": "Switch view",
"toggleSidebar": "Toggle sidebar",

View File

@ -46,7 +46,12 @@
show="delete"
/>
</template>
<action
v-if="headerButtons.gotoParent"
icon="arrow_upward"
:label="$t('buttons.gotoParent')"
@action="gotoParent"
/>
<action
v-if="headerButtons.shell"
icon="code"
@ -367,6 +372,7 @@ export default {
},
headerButtons() {
return {
gotoParent: true,
upload: this.user.perm.create,
download: this.user.perm.download,
shell: this.user.perm.execute && enableExec,
@ -853,6 +859,14 @@ export default {
this.setItemWeight();
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 () {
if (
typeof window.DataTransferItem !== "undefined" &&