diff --git a/lib/Migration/Version10400Date20210305.php b/lib/Migration/Version010400Date20210305.php similarity index 71% rename from lib/Migration/Version10400Date20210305.php rename to lib/Migration/Version010400Date20210305.php index 3e298add8..9b2e25f9b 100644 --- a/lib/Migration/Version10400Date20210305.php +++ b/lib/Migration/Version010400Date20210305.php @@ -9,19 +9,20 @@ use OCP\DB\ISchemaWrapper; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; -class Version10400Date20210305 extends SimpleMigrationStep { +class Version010400Date20210305 extends SimpleMigrationStep { public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); // Add cover image database field $table = $schema->getTable('deck_boards'); - if (!$table->hasColumn('coverImages')) { - $table->addColumn('coverImages', 'boolean', [ + if (!$table->hasColumn('cover_images')) { + $table->addColumn('cover_images', 'boolean', [ 'notnull' => false, 'default' => true, ]); + return $schema; } - return $schema; + return null; } -} +} \ No newline at end of file diff --git a/src/components/cards/CardItem.vue b/src/components/cards/CardItem.vue index 2aba014dc..b590106da 100644 --- a/src/components/cards/CardItem.vue +++ b/src/components/cards/CardItem.vue @@ -37,6 +37,11 @@

{{ attachments }} +
+ +
+
+

{{ card.title }}

@@ -86,6 +91,7 @@ import labelStyle from '../../mixins/labelStyle' import AttachmentDragAndDrop from '../AttachmentDragAndDrop' import CardMenu from './CardMenu' import DueDate from './badges/DueDate' +import { generateUrl } from '@nextcloud/router' export default { name: 'CardItem', @@ -131,7 +137,7 @@ export default { return this.$store.getters.stackById(this?.card?.stackId) }, attachments() { - return [...this.$store.getters.attachmentsByCard(this.currentCard.id)].filter(attachment => attachment.deletedAt >= 0) + return [...this.$store.getters.attachmentsByCard(this.id)].filter(attachment => attachment.deletedAt >= 0) }, canEdit() { if (this.currentBoard) { @@ -149,6 +155,21 @@ export default { labelsSorted() { return [...this.card.labels].sort((a, b) => (a.title < b.title) ? -1 : 1) }, + mimetypeForAttachment() { + return (attachment) => { + if (!attachment) { + return {} + } + const url = attachment.extendedData.hasPreview ? this.attachmentPreview(attachment) : OC.MimeType.getIconUrl(attachment.extendedData.mimetype) + const styles = { + 'background-image': `url("${url}")`, + } + return styles + } + }, + attachmentPreview() { + return (attachment) => (attachment.extendedData.fileid ? generateUrl(`/core/preview?fileId=${attachment.extendedData.fileid}&x=260&y=260&a=true`) : null) + }, }, watch: { currentCard(newValue) { @@ -209,6 +230,17 @@ export default { box-shadow: 0 0 5px 1px var(--color-box-shadow); } + .fileicon { + display: flex; + width: 260px; + height: 260px; + background-size: contain; + background-repeat: no-repeat; + margin-left: auto; + margin-right: auto; + border-radius: var(--border-radius-large); + } + .card-upper { display: flex; min-height: 44px; diff --git a/src/components/navigation/AppNavigationBoard.vue b/src/components/navigation/AppNavigationBoard.vue index ddf77e6b2..a740b8e91 100644 --- a/src/components/navigation/AppNavigationBoard.vue +++ b/src/components/navigation/AppNavigationBoard.vue @@ -32,7 +32,6 @@ slot="counter" class="icon-shared" style="opacity: 0.5" /> -