Skip to content

Commit

Permalink
feat: Add event for version click
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliushaertl committed Sep 11, 2023
1 parent 5b8c3b0 commit cb2a611
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion apps/files_versions/src/components/Version.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div>
<NcListItem class="version"
:title="versionLabel"
:href="downloadURL"
@click="openVersion"
:force-display-actions="true"
data-files-versions-version>
<template #icon>
Expand Down Expand Up @@ -122,6 +122,7 @@ import { translate } from '@nextcloud/l10n'
import { joinPaths } from '@nextcloud/paths'
import { generateUrl } from '@nextcloud/router'
import { loadState } from '@nextcloud/initial-state'
import { emit } from '@nextcloud/event-bus'
export default {
name: 'Version',
Expand Down Expand Up @@ -238,6 +239,19 @@ export default {
},
},
methods: {
openVersion(e) {
e.preventDefault()
const openVersionEvent = {
preventDefault: false,
fileInfo: this.fileInfo,
version: this.version,
}
emit('files_versions:view:open', openVersionEvent)
if (openVersionEvent.preventDefault) {
return
}
window.location.href = this.downloadURL
},
openVersionLabelModal() {
this.showVersionLabelForm = true
this.$nextTick(() => {
Expand Down

0 comments on commit cb2a611

Please sign in to comment.