Fix styling and attachment count assignment

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2020-03-29 11:42:05 +02:00
parent 67083b8fce
commit 2d639ed470
4 changed files with 52 additions and 72 deletions

View File

@@ -124,28 +124,62 @@ export default {
.attachments-drag-zone { .attachments-drag-zone {
flex-grow: 1; flex-grow: 1;
position: relative;
} }
.dragover { .dragover {
position: absolute; position: absolute;
background: var(--color-primary-light);
z-index: 11;
display: flex;
border-radius: var(--border-radius);
opacity: .9;
margin: auto;
.drop-hint {
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
&__icon {
background-size: 32px;
background-position: center center;
height: 48px;
margin-bottom: 16px;
}
&__text {
line-height: 125%;
text-align: center;
}
}
}
.drop-upload--sidebar .dragover {
top: 20%; top: 20%;
left: 10%; left: 10%;
width: 80%; width: 80%;
height: 60%; height: 60%;
background: var(--color-primary-light);
z-index: 11;
display: flex;
box-shadow: 0px 0px 36px var(--color-box-shadow); box-shadow: 0px 0px 36px var(--color-box-shadow);
border-radius: var(--border-radius);
opacity: .9;
} }
.drop-hint { .drop-upload--card .dragover {
margin: auto; border: 0;
&__icon { width: 100%;
background-size: 48px; height: 100%;
height: 48px; top: 0;
margin-bottom: 16px; left: 0;
h2 {
font-size: 13px;
margin: 0;
}
.drop-hint__icon {
margin: 0;
background-size: 16px;
height: 16px;
} }
} }
@@ -168,11 +202,6 @@ export default {
} }
} }
.icon-upload {
padding-left: 35px;
background-position: 10px center;
}
.modal__content { .modal__content {
width: 25vw; width: 25vw;
min-width: 250px; min-width: 250px;

View File

@@ -21,7 +21,7 @@
--> -->
<template> <template>
<AttachmentDragAndDrop :card-id="card.id"> <AttachmentDragAndDrop :card-id="card.id" class="drop-upload--sidebar">
<button class="icon-upload" @click="clickAddNewAttachmment()"> <button class="icon-upload" @click="clickAddNewAttachmment()">
{{ t('settings', 'Upload attachment') }} {{ t('settings', 'Upload attachment') }}
</button> </button>
@@ -35,7 +35,7 @@
:key="attachment.id" :key="attachment.id"
class="attachment" class="attachment"
style="display: flex;"> style="display: flex;">
<a class="fileicon" :style="mimetypeForAttachment(attachment)" :href="attachmentUrl(attachment)" /> <a class="fileicon" :style="mimetypeForAttachment(attachment.extendedData.mimetype)" :href="attachmentUrl(attachment)" />
<div class="details"> <div class="details">
<a :href="attachmentUrl(attachment)" target="_blank"> <a :href="attachmentUrl(attachment)" target="_blank">
<div class="filename"> <div class="filename">
@@ -115,8 +115,8 @@ export default {
return (filesize) => formatFileSize(filesize) return (filesize) => formatFileSize(filesize)
}, },
mimetypeForAttachment() { mimetypeForAttachment() {
return (attachment) => { return (mimetype) => {
const url = OC.MimeType.getIconUrl(attachment.extendedData.mimetype) const url = OC.MimeType.getIconUrl(mimetype)
const styles = { const styles = {
'background-image': `url("${url}")`, 'background-image': `url("${url}")`,
} }
@@ -167,53 +167,6 @@ export default {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.attachments-drag-zone {
flex-grow: 1;
}
.dragover {
position: absolute;
top: 20%;
left: 10%;
width: 80%;
height: 60%;
background: var(--color-primary-light);
z-index: 11;
display: flex;
box-shadow: 0px 0px 36px var(--color-box-shadow);
border-radius: var(--border-radius);
opacity: .9;
}
.drop-hint {
margin: auto;
&__icon {
background-size: 48px;
height: 48px;
margin-bottom: 16px;
}
}
.fade {
&-enter {
opacity: 0;
}
&-enter-to {
opacity: .9;
}
&-leave {
opacity: .9;
}
&-leave-to {
opacity: 0;
}
&-enter-active,
&-leave-active {
transition: opacity 150ms ease-in-out;
}
}
.icon-upload { .icon-upload {
padding-left: 35px; padding-left: 35px;
background-position: 10px center; background-position: 10px center;

View File

@@ -25,7 +25,7 @@
--> -->
<template> <template>
<AttachmentDragAndDrop :card-id="id"> <AttachmentDragAndDrop :card-id="id" class="drop-upload--card">
<div :class="{'compact': compactMode, 'current-card': currentCard, 'has-labels': card.labels && card.labels.length > 0, 'is-editing': editing}" <div :class="{'compact': compactMode, 'current-card': currentCard, 'has-labels': card.labels && card.labels.length > 0, 'is-editing': editing}"
tag="div" tag="div"
class="card" class="card"

View File

@@ -143,15 +143,13 @@ export default {
cardIncreaseAttachmentCount(state, cardId) { cardIncreaseAttachmentCount(state, cardId) {
const existingIndex = state.cards.findIndex(_card => _card.id === cardId) const existingIndex = state.cards.findIndex(_card => _card.id === cardId)
if (existingIndex !== -1) { if (existingIndex !== -1) {
const existingCard = state.cards.find(_card => _card.id === cardId) Vue.set(state.cards[existingIndex], 'attachmentCount', state.cards[existingIndex].attachmentCount + 1)
Vue.set(state.cards, existingCard.attachmentCount, existingCard.attachmentCount++)
} }
}, },
cardDecreaseAttachmentCount(state, cardId) { cardDecreaseAttachmentCount(state, cardId) {
const existingIndex = state.cards.findIndex(_card => _card.id === cardId) const existingIndex = state.cards.findIndex(_card => _card.id === cardId)
if (existingIndex !== -1) { if (existingIndex !== -1) {
const existingCard = state.cards.find(_card => _card.id === cardId) Vue.set(state.cards[existingIndex], 'attachmentCount', state.cards[existingIndex].attachmentCount - 1)
Vue.set(state.cards, existingCard.attachmentCount, existingCard.attachmentCount--)
} }
}, },
}, },