Skip to content

Commit

Permalink
Merge pull request #401 from nextcloud/enh/27/on-hover
Browse files Browse the repository at this point in the history
Show file path on hover
  • Loading branch information
ChristophWurst authored May 27, 2021
2 parents 4e32771 + 8c84532 commit 2d2da4d
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 61 deletions.
84 changes: 42 additions & 42 deletions js/dashboard.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/dashboard.js.map

Large diffs are not rendered by default.

37 changes: 31 additions & 6 deletions js/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/main.js.map

Large diffs are not rendered by default.

27 changes: 18 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@nextcloud/vue-dashboard": "^1.0.1",
"babel-eslint": "^10.1.0",
"nextcloud-server": "^0.15.10",
"v-tooltip": "^2.1.3",
"vue": "^2.6.12",
"vuex": "^3.6.2"
},
Expand Down
20 changes: 18 additions & 2 deletions src/components/RecommendedFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
-->

<template>
<a class="recommendation"
<a v-tooltip="tooltip"
class="recommendation"
tabindex="0"
@click.prevent="navigate"
@keyup.enter.prevent="navigate">
Expand All @@ -47,9 +48,13 @@

<script>
import { generateUrl } from '@nextcloud/router'
import { VTooltip } from 'v-tooltip'

export default {
name: 'RecommendedFile',
directives: {
tooltip: VTooltip,
},
props: {
id: {
type: String,
Expand Down Expand Up @@ -96,6 +101,17 @@ export default {
isFileListAvailable() {
return OCA.Files.App.fileList.changeDirectory && OCA.Files.App.fileList.scrollTo
},
path() {
return (this.directory === '/' ? '' : this.directory) + '/' + this.name
},
tooltip() {
return {
content: this.path,
html: false,
placement: 'bottom',
delay: { show: 500, hide: 0 },
}
},
},
mounted() {
if (this.hasPreview) {
Expand Down Expand Up @@ -123,7 +139,7 @@ export default {
},
navigate() {
if (OCA.Viewer && OCA.Viewer.mimetypes.indexOf(this.mimeType) !== -1) {
OCA.Viewer.open(this.directory + '/' + this.name)
OCA.Viewer.open(this.path)
return
}
if (this.isFileListAvailable) {
Expand Down

0 comments on commit 2d2da4d

Please sign in to comment.