mirror of
https://github.com/plankanban/planka.git
synced 2025-07-24 15:49:46 +02:00
Add covers for cards
This commit is contained in:
parent
f743f4ea8b
commit
3dffed90c6
26 changed files with 315 additions and 98 deletions
|
@ -42,14 +42,19 @@ module.exports = {
|
|||
required: true,
|
||||
columnName: 'card_id',
|
||||
},
|
||||
userId: {
|
||||
model: 'User',
|
||||
required: true,
|
||||
columnName: 'user_id',
|
||||
},
|
||||
},
|
||||
|
||||
customToJSON() {
|
||||
return {
|
||||
..._.omit(this, ['dirname', 'filename', 'isImage']),
|
||||
url: `${sails.config.custom.attachmentsUrl}/${this.dirname}/${this.filename}`,
|
||||
thumbnailUrl: this.isImage
|
||||
? `${sails.config.custom.attachmentsUrl}/${this.dirname}/240.jpg`
|
||||
coverUrl: this.isImage
|
||||
? `${sails.config.custom.attachmentsUrl}/${this.dirname}/thumbnails/cover-256.jpg`
|
||||
: null,
|
||||
};
|
||||
},
|
||||
|
|
|
@ -50,6 +50,10 @@ module.exports = {
|
|||
required: true,
|
||||
columnName: 'board_id',
|
||||
},
|
||||
coverAttachmentId: {
|
||||
model: 'Attachment',
|
||||
columnName: 'cover_attachment_id',
|
||||
},
|
||||
subscriptionUsers: {
|
||||
collection: 'User',
|
||||
via: 'cardId',
|
||||
|
|
|
@ -94,7 +94,8 @@ module.exports = {
|
|||
return {
|
||||
..._.omit(this, ['password', 'avatarDirname']),
|
||||
avatarUrl:
|
||||
this.avatarDirname && `${sails.config.custom.userAvatarsUrl}/${this.avatarDirname}/100.jpg`,
|
||||
this.avatarDirname &&
|
||||
`${sails.config.custom.userAvatarsUrl}/${this.avatarDirname}/square-100.jpg`,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue