Add a button to copy an attachment url from the attachment overview
This commit is contained in:
parent
ac6082a670
commit
b6bc410346
4 changed files with 24 additions and 5 deletions
|
@ -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>
|
||||
|
|
3
src/helpers/generateAttachmentUrl.js
Normal file
3
src/helpers/generateAttachmentUrl.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
export const generateAttachmentUrl = (taskId, attachmentId) => {
|
||||
return `${window.API_URL}/tasks/${taskId}/attachments/${attachmentId}`
|
||||
}
|
|
@ -529,11 +529,15 @@
|
|||
"title": "Attachments",
|
||||
"createdBy": "created {0} by {1}",
|
||||
"download": "Download",
|
||||
"downloadTooltip": "Download this attachment",
|
||||
"upload": "Upload attachment",
|
||||
"drop": "Drop files here to upload",
|
||||
"delete": "Delete attachment",
|
||||
"deleteTooltip": "Delete this attachment",
|
||||
"deleteText1": "Are you sure you want to delete the attachment {filename}?",
|
||||
"deleteText2": "This cannot be undone!"
|
||||
"deleteText2": "This cannot be undone!",
|
||||
"copyUrl": "Copy URL",
|
||||
"copyUrlTooltip": "Copy the url of this attachment for usage in text"
|
||||
},
|
||||
"comment": {
|
||||
"title": "Comments",
|
||||
|
|
Loading…
Reference in a new issue