Add a button to copy an attachment url from the attachment overview
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import AttachmentModel from '../../../models/attachment'
|
||||
import AttachmentService from '../../../services/attachment'
|
||||
import {generateAttachmentUrl} from '@/helpers/generateAttachmentUrl'
|
||||
|
||||
export default {
|
||||
methods: {
|
||||
@ -21,7 +22,7 @@ export default {
|
||||
taskId: this.taskId,
|
||||
attachment: a,
|
||||
})
|
||||
onSuccess(`${window.API_URL}/tasks/${this.taskId}/attachments/${a.id}`)
|
||||
onSuccess(generateAttachmentUrl(this.taskId, a.id))
|
||||
})
|
||||
}
|
||||
if (r.errors !== null) {
|
||||
|
@ -55,14 +55,20 @@
|
||||
<p>
|
||||
<a
|
||||
@click.prevent.stop="downloadAttachment(a)"
|
||||
v-tooltip="'Download this attachment'"
|
||||
v-tooltip="$t('task.attachment.downloadTooltip')"
|
||||
>
|
||||
{{ $t('task.attachment.download') }}
|
||||
</a>
|
||||
<a
|
||||
@click.stop="copyUrl(a)"
|
||||
v-tooltip="$t('task.attachment.copyUrlTooltip')"
|
||||
>
|
||||
{{ $t('task.attachment.copyUrl') }}
|
||||
</a>
|
||||
<a
|
||||
@click.prevent.stop="() => {attachmentToDelete = a; showDeleteModal = true}"
|
||||
v-if="editEnabled"
|
||||
v-tooltip="'Delete this attachment'"
|
||||
v-tooltip="$t('task.attachment.deleteTooltip')"
|
||||
>
|
||||
{{ $t('misc.delete') }}
|
||||
</a>
|
||||
@ -106,7 +112,7 @@
|
||||
>
|
||||
<span slot="header">{{ $t('task.attachment.delete') }}</span>
|
||||
<p slot="text">
|
||||
{{ $t('task.attachment.deleteText1', {filename: attachmentUpload.file.name}) }}<br/>
|
||||
{{ $t('task.attachment.deleteText1', {filename: attachmentToDelete.file.name}) }}<br/>
|
||||
<strong>{{ $t('task.attachment.deleteText2') }}</strong>
|
||||
</p>
|
||||
</modal>
|
||||
@ -133,7 +139,9 @@ import AttachmentService from '../../../services/attachment'
|
||||
import AttachmentModel from '../../../models/attachment'
|
||||
import User from '../../misc/user'
|
||||
import attachmentUpload from '@/components/tasks/mixins/attachmentUpload'
|
||||
import {generateAttachmentUrl} from '@/helpers/generateAttachmentUrl'
|
||||
import {mapState} from 'vuex'
|
||||
import copy from 'copy-to-clipboard'
|
||||
|
||||
export default {
|
||||
name: 'attachments',
|
||||
@ -247,6 +255,9 @@ export default {
|
||||
this.downloadAttachment(attachment)
|
||||
}
|
||||
},
|
||||
copyUrl(attachment) {
|
||||
copy(generateAttachmentUrl(this.taskId, attachment.id))
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user