Make sure event is properly emitted

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2020-04-27 12:23:49 +02:00
parent 0659038d0b
commit 7c15a17aa4
5 changed files with 30 additions and 43 deletions

8
package-lock.json generated
View File

@@ -13962,7 +13962,7 @@
}, },
"os-homedir": { "os-homedir": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
"dev": true "dev": true
}, },
@@ -13979,7 +13979,7 @@
}, },
"os-tmpdir": { "os-tmpdir": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
"dev": true "dev": true
}, },
@@ -14181,7 +14181,7 @@
}, },
"path-is-absolute": { "path-is-absolute": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
}, },
"path-is-inside": { "path-is-inside": {
@@ -17293,7 +17293,7 @@
}, },
"string_decoder": { "string_decoder": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"requires": { "requires": {
"safe-buffer": "~5.1.0" "safe-buffer": "~5.1.0"

View File

@@ -24,12 +24,12 @@
<div class="board-wrapper"> <div class="board-wrapper">
<Controls :board="board" /> <Controls :board="board" />
<transition name="fade" mode="out-in"> <transition name="fade" mode="out-in">
<div v-if="loading" class="emptycontent" key="loading"> <div v-if="loading" key="loading" class="emptycontent">
<div class="icon icon-loading" /> <div class="icon icon-loading" />
<h2>{{ t('deck', 'Loading board') }}</h2> <h2>{{ t('deck', 'Loading board') }}</h2>
<p /> <p />
</div> </div>
<div v-else-if="board && !loading" class="board" key="board"> <div v-else-if="board && !loading" key="board" class="board">
<Container lock-axix="y" <Container lock-axix="y"
orientation="horizontal" orientation="horizontal"
:drag-handle-selector="dragHandleSelector" :drag-handle-selector="dragHandleSelector"
@@ -39,13 +39,12 @@
</Draggable> </Draggable>
</Container> </Container>
</div> </div>
<div v-else class="emptycontent" key="notfound"> <div v-else key="notfound" class="emptycontent">
<div class="icon icon-deck" /> <div class="icon icon-deck" />
<h2>{{ t('deck', 'Board not found') }}</h2> <h2>{{ t('deck', 'Board not found') }}</h2>
<p /> <p />
</div> </div>
</transition> </transition>
</div> </div>
</template> </template>

View File

@@ -38,16 +38,16 @@
</a> </a>
</div> </div>
<Actions v-if="selectable"> <Actions v-if="selectable">
<ActionButton icon="icon-confirm" @click="this.$emit('selectAttachment', attachment)"> <ActionButton icon="icon-confirm" @click="$emit('selectAttachment', attachment)">
{{ t('deck', 'Add this attachment') }} {{ t('deck', 'Add this attachment') }}
</ActionButton> </ActionButton>
</Actions> </Actions>
<Actions v-if="removable"> <Actions v-if="removable">
<ActionButton v-if="attachment.deletedAt === 0" icon="icon-delete" @click="deleteAttachment(attachment)"> <ActionButton v-if="attachment.deletedAt === 0" icon="icon-delete" @click="$emit('deleteAttachment', attachment)">
{{ t('deck', 'Delete Attachment') }} {{ t('deck', 'Delete Attachment') }}
</ActionButton> </ActionButton>
<ActionButton v-else icon="icon-history" @click="restoreAttachment(attachment)"> <ActionButton v-else icon="icon-history" @click="$emit('restoreAttachment', attachment)">
{{ t('deck', 'Restore Attachment') }} {{ t('deck', 'Restore Attachment') }}
</ActionButton> </ActionButton>
</Actions> </Actions>
@@ -73,10 +73,6 @@ export default {
type: Number, type: Number,
required: true, required: true,
}, },
editor: {
type: Object,
required: false,
},
selectable: { selectable: {
type: Boolean, type: Boolean,
required: false, required: false,
@@ -114,24 +110,6 @@ export default {
watch: { watch: {
}, },
methods: {
addAttachment(attachment) {
const descString = this.editor.easymde.value()
let embed = ''
if (attachment.extendedData.mimetype.includes('image')) {
embed = '!'
}
const attachmentString = embed + '[📎 ' + attachment.data + '](' + this.attachmentUrl(attachment) + ')'
this.editor.easymde.value(descString + '\n' + attachmentString)
this.modalShow = false
},
deleteAttachment(attachment) {
this.$store.dispatch('deleteAttachment', attachment)
},
restoreAttachment(attachment) {
this.$store.dispatch('restoreAttachment', attachment)
},
},
} }
</script> </script>

View File

@@ -178,15 +178,9 @@
<Modal v-if="modalShow" :title="t('deck', 'Choose attachment')" @close="modalShow=false"> <Modal v-if="modalShow" :title="t('deck', 'Choose attachment')" @close="modalShow=false">
<div class="modal__content"> <div class="modal__content">
<h3>{{ t('deck', 'Choose attachment') }}</h3> <h3>{{ t('deck', 'Choose attachment') }}</h3>
<!-- <Actions>
<ActionButton icon="icon-close" @click="modalShow=false">
{{ t('deck', 'Cancel') }}
</ActionButton>
</Actions> -->
<AttachmentList <AttachmentList
:card-id="currentCard.id" :card-id="currentCard.id"
:selectable="true" :selectable="true"
:editor="$refs.markdownEditor"
@selectAttachment="addAttachment" /> @selectAttachment="addAttachment" />
</div> </div>
</Modal> </Modal>
@@ -376,7 +370,6 @@ export default {
this.modalShow = true this.modalShow = true
}, },
addAttachment(attachment) { addAttachment(attachment) {
console.log('hier')
const descString = this.$refs.markdownEditor.easymde.value() const descString = this.$refs.markdownEditor.easymde.value()
let embed = '' let embed = ''
if (attachment.extendedData.mimetype.includes('image')) { if (attachment.extendedData.mimetype.includes('image')) {
@@ -511,7 +504,7 @@ export default {
margin-bottom: 5px; margin-bottom: 5px;
color: var(--color-text-maxcontrast); color: var(--color-text-maxcontrast);
.icon-info, .icon-attach { .icon-info {
display: inline-block; display: inline-block;
width: 32px; width: 32px;
height: 16px; height: 16px;
@@ -519,6 +512,13 @@ export default {
opacity: .7; opacity: .7;
} }
.icon-attach {
background-size: 16px;
float: right;
margin-top: -14px;
opacity: .7;
}
.icon-toggle, .icon-rename { .icon-toggle, .icon-rename {
float: right; float: right;
margin-top: -14px; margin-top: -14px;
@@ -604,6 +604,7 @@ export default {
height: 120px; height: 120px;
text-align: center; text-align: center;
margin: 20px 20px 60px 20px; margin: 20px 20px 60px 20px;
padding-bottom: 20px;
} }
.modal__content button { .modal__content button {

View File

@@ -44,7 +44,11 @@
</div> </div>
</li> </li>
<AttachmentList :card-id="card.id" :removable="true" /> <AttachmentList
:card-id="card.id"
:removable="true"
@deleteAttachment="deleteAttachment"
@restoreAttachment="restoreAttachment" />
</ul> </ul>
</div> </div>
</AttachmentDragAndDrop> </AttachmentDragAndDrop>
@@ -124,7 +128,12 @@ export default {
clickAddNewAttachmment() { clickAddNewAttachmment() {
this.$refs.localAttachments.click() this.$refs.localAttachments.click()
}, },
deleteAttachment(attachment) {
this.$store.dispatch('deleteAttachment', attachment)
},
restoreAttachment(attachment) {
this.$store.dispatch('restoreAttachment', attachment)
},
}, },
} }
</script> </script>