diff options
author | Andy Scherzinger <info@andy-scherzinger.de> | 2023-05-24 19:11:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-24 19:11:40 +0200 |
commit | b8ae166eb2d951affe001b12b37f56149848d845 (patch) | |
tree | 821e6cc27e7008e90ee67dd183e86c2da51e4705 /apps/files/src/components/FileEntry.vue | |
parent | 115689f1679c48cb8f6ac84beb261fd5d5799038 (diff) | |
parent | d9f9a7280e94064ded03bbfc7cb9331380c9b185 (diff) | |
download | nextcloud-server-b8ae166eb2d951affe001b12b37f56149848d845.tar.gz nextcloud-server-b8ae166eb2d951affe001b12b37f56149848d845.zip |
Merge pull request #38441 from nextcloud/feat/make-open-folder-action
fix(files): make open folder a default action
Diffstat (limited to 'apps/files/src/components/FileEntry.vue')
-rw-r--r-- | apps/files/src/components/FileEntry.vue | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/apps/files/src/components/FileEntry.vue b/apps/files/src/components/FileEntry.vue index 8dc067a407d..fd61f5e3623 100644 --- a/apps/files/src/components/FileEntry.vue +++ b/apps/files/src/components/FileEntry.vue @@ -33,7 +33,7 @@ <!-- Link to file --> <td class="files-list__row-name"> - <a ref="name" v-bind="linkTo" @click="execDefaultAction"> + <a ref="name" v-bind="linkAttrs" @click="execDefaultAction"> <!-- Icon or preview --> <span class="files-list__row-icon"> <FolderIcon v-if="source.type === 'folder'" /> @@ -261,7 +261,22 @@ export default Vue.extend({ return minOpacity + (1 - minOpacity) * Math.pow((this.source.size / maxOpacitySize), 2) }, - linkTo() { + linkAttrs() { + if (this.enabledDefaultActions.length > 0) { + const action = this.enabledDefaultActions[0] + const displayName = action.displayName([this.source], this.currentView) + return { + class: ['files-list__row-default-action', 'files-list__row-action-' + action.id], + role: 'button', + title: displayName, + } + } + + /** + * A folder would never reach this point + * as it has open-folder as default action. + * Just to be safe, let's handle it. + */ if (this.source.type === 'folder') { const to = { ...this.$route, query: { dir: join(this.dir, this.source.basename) } } return { @@ -271,15 +286,6 @@ export default Vue.extend({ } } - if (this.enabledDefaultActions.length > 0) { - const action = this.enabledDefaultActions[0] - const displayName = action.displayName([this.source], this.currentView) - return { - title: displayName, - role: 'button', - } - } - return { href: this.source.source, // TODO: Use first action title ? @@ -526,11 +532,6 @@ export default Vue.extend({ } }, execDefaultAction(event) { - // Do not execute the default action on the folder, navigate instead - if (this.source.type === 'folder') { - return - } - if (this.enabledDefaultActions.length > 0) { event.preventDefault() event.stopPropagation() |