mirror of
https://github.com/wekan/wekan.git
synced 2026-01-19 15:56:09 +01:00
Set card attachment as background image. Part 2.
Thanks to xet7 ! Related #486
This commit is contained in:
parent
e892a6104a
commit
ed92db87bc
4 changed files with 49 additions and 7 deletions
|
|
@ -81,14 +81,14 @@ template(name="attachmentActionsPopup")
|
|||
| {{_ 'remove-cover'}}
|
||||
else
|
||||
| {{_ 'add-cover'}}
|
||||
if isImage
|
||||
a(class="{{#if isBackgroundImage}}js-remove-background-image{{else}}js-add-background-image{{/if}}")
|
||||
i.fa.fa-picture-o
|
||||
if isBackgroundImage
|
||||
| {{_ 'remove-background-image'}}
|
||||
else
|
||||
| {{_ 'add-background-image'}}
|
||||
if currentUser.isBoardAdmin
|
||||
if isImage
|
||||
a(class="{{#if isBackgroundImage}}js-remove-background-image{{else}}js-add-background-image{{/if}}")
|
||||
i.fa.fa-picture-o
|
||||
if isBackgroundImage
|
||||
| {{_ 'remove-background-image'}}
|
||||
else
|
||||
| {{_ 'add-background-image'}}
|
||||
a.js-rename
|
||||
i.fa.fa-pencil-square-o
|
||||
| {{_ 'rename'}}
|
||||
|
|
|
|||
|
|
@ -175,6 +175,10 @@ BlazeComponent.extendComponent({
|
|||
const ret = Cards.findOne(this.data().meta.cardId).coverId == this.data()._id;
|
||||
return ret;
|
||||
},
|
||||
isBackgroundImage() {
|
||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||
return currentBoard.backgroundImageURL === $(".attachment-thumbnail-img").attr("src");
|
||||
},
|
||||
events() {
|
||||
return [
|
||||
{
|
||||
|
|
@ -191,6 +195,20 @@ BlazeComponent.extendComponent({
|
|||
Cards.findOne(this.data().meta.cardId).unsetCover();
|
||||
Popup.back();
|
||||
},
|
||||
'click .js-add-background-image'() {
|
||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||
currentBoard.setBackgroundImageURL($(".attachment-thumbnail-img").attr("src"));
|
||||
Utils.setBackgroundImage();
|
||||
Popup.back();
|
||||
event.preventDefault();
|
||||
},
|
||||
'click .js-remove-background-image'() {
|
||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||
currentBoard.setBackgroundImageURL("");
|
||||
Utils.setBackgroundImage();
|
||||
Popup.back();
|
||||
Utils.reload();
|
||||
},
|
||||
'click .js-move-storage-fs'() {
|
||||
Meteor.call('moveAttachmentToStorage', this.data()._id, "fs");
|
||||
Popup.back();
|
||||
|
|
|
|||
|
|
@ -145,6 +145,14 @@ template(name="boardChangeBackgroundImagePopup")
|
|||
input.js-board-background-image-url(type="text" value="{{backgroundImageURL}}" autofocus)
|
||||
div.buttonsContainer
|
||||
input.primary.wide(type="submit" value="{{_ 'save'}}")
|
||||
br
|
||||
br
|
||||
br
|
||||
br
|
||||
br
|
||||
hr
|
||||
div
|
||||
button.js-remove-background.negate.wide.card-details-red.right {{_ 'unset-color'}}
|
||||
|
||||
template(name="boardInfoOnMyBoardsPopup")
|
||||
form.board-info-on-my-boards
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue