mirror of
https://github.com/wekan/wekan.git
synced 2025-12-27 12:48:49 +01:00
Import card-as-card, board-as-card. Add styling. Missing details and links
This commit is contained in:
parent
061a13e46e
commit
5644ef66af
5 changed files with 159 additions and 25 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
template(name="minicard")
|
template(name="minicard")
|
||||||
.minicard
|
.minicard(
|
||||||
|
class="{{#if importedCard}}imported-card{{/if}}"
|
||||||
|
class="{{#if importedBoard}}imported-board{{/if}}")
|
||||||
if cover
|
if cover
|
||||||
.minicard-cover(style="background-image: url('{{cover.url}}');")
|
.minicard-cover(style="background-image: url('{{cover.url}}');")
|
||||||
if labels
|
if labels
|
||||||
|
|
@ -13,6 +15,8 @@ template(name="minicard")
|
||||||
if $eq 'prefix-with-parent' currentBoard.presentParentTask
|
if $eq 'prefix-with-parent' currentBoard.presentParentTask
|
||||||
.parent-prefix
|
.parent-prefix
|
||||||
| {{ parentCardName }}
|
| {{ parentCardName }}
|
||||||
|
if imported
|
||||||
|
span.imported-icon.fa.fa-share-alt
|
||||||
+viewer
|
+viewer
|
||||||
| {{ title }}
|
| {{ title }}
|
||||||
if $eq 'subtext-with-full-path' currentBoard.presentParentTask
|
if $eq 'subtext-with-full-path' currentBoard.presentParentTask
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,13 @@ BlazeComponent.extendComponent({
|
||||||
template() {
|
template() {
|
||||||
return 'minicard';
|
return 'minicard';
|
||||||
},
|
},
|
||||||
|
importedCard() {
|
||||||
|
return this.currentData().type === 'cardType-importedCard';
|
||||||
|
},
|
||||||
|
importedBoard() {
|
||||||
|
return this.currentData().type === 'cardType-importedBoard';
|
||||||
|
},
|
||||||
|
imported() {
|
||||||
|
return this.importedCard() || this.importedBoard();
|
||||||
|
},
|
||||||
}).register('minicard');
|
}).register('minicard');
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,41 @@
|
||||||
transition: transform 0.2s,
|
transition: transform 0.2s,
|
||||||
border-radius 0.2s
|
border-radius 0.2s
|
||||||
|
|
||||||
|
&.imported-board
|
||||||
|
background-color: #efd8e6
|
||||||
|
&:hover:not(.minicard-composer),
|
||||||
|
.is-selected &,
|
||||||
|
.draggable-hover-card &
|
||||||
|
background: darken(#efd8e6, 3%)
|
||||||
|
|
||||||
|
.is-selected &
|
||||||
|
border-left: 3px solid darken(#efd8e6, 50%)
|
||||||
|
|
||||||
|
.minicard-title
|
||||||
|
font-style: italic
|
||||||
|
font-weight: bold
|
||||||
|
|
||||||
|
&.imported-card
|
||||||
|
background-color: #d5e4bd
|
||||||
|
&:hover:not(.minicard-composer),
|
||||||
|
.is-selected &,
|
||||||
|
.draggable-hover-card &
|
||||||
|
background: darken(#d5e4bd, 3%)
|
||||||
|
|
||||||
|
.is-selected &
|
||||||
|
border-left: 3px solid darken(#d5e4bd, 50%)
|
||||||
|
|
||||||
|
.minicard-title
|
||||||
|
font-style: italic
|
||||||
|
|
||||||
|
&.imported-board
|
||||||
|
&.imported-card
|
||||||
|
.imported-icon
|
||||||
|
display: inline-block
|
||||||
|
margin-right: 11px
|
||||||
|
vertical-align: baseline
|
||||||
|
font-size: 0.9em
|
||||||
|
|
||||||
.is-selected &
|
.is-selected &
|
||||||
transform: translateX(11px)
|
transform: translateX(11px)
|
||||||
border-bottom-right-radius: 0
|
border-bottom-right-radius: 0
|
||||||
|
|
@ -87,6 +122,8 @@
|
||||||
.minicard-title
|
.minicard-title
|
||||||
p:last-child
|
p:last-child
|
||||||
margin-bottom: 0
|
margin-bottom: 0
|
||||||
|
.viewer
|
||||||
|
display: inline-block
|
||||||
.dates
|
.dates
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,10 @@ template(name="addCardForm")
|
||||||
span.quiet
|
span.quiet
|
||||||
| {{_ 'or'}}
|
| {{_ 'or'}}
|
||||||
a.js-import {{_ 'import'}}
|
a.js-import {{_ 'import'}}
|
||||||
|
span.quiet
|
||||||
|
|
|
||||||
|
| /
|
||||||
|
a.js-search {{_ 'search'}}
|
||||||
|
|
||||||
template(name="autocompleteLabelLine")
|
template(name="autocompleteLabelLine")
|
||||||
.minicard-label(class="card-label-{{colorName}}" title=labelName)
|
.minicard-label(class="card-label-{{colorName}}" title=labelName)
|
||||||
|
|
@ -51,7 +55,7 @@ template(name="importCardPopup")
|
||||||
option(value="{{_id}}" selected) {{_ 'current'}}
|
option(value="{{_id}}" selected) {{_ 'current'}}
|
||||||
else
|
else
|
||||||
option(value="{{_id}}") {{title}}
|
option(value="{{_id}}") {{title}}
|
||||||
input.primary.confirm.js-import-board(type="submit" value="{{_ 'add'}}")
|
input.primary.confirm.js-import-board(type="button" value="{{_ 'import'}}")
|
||||||
|
|
||||||
label {{_ 'swimlanes'}}:
|
label {{_ 'swimlanes'}}:
|
||||||
select.js-select-swimlanes
|
select.js-select-swimlanes
|
||||||
|
|
@ -64,15 +68,12 @@ template(name="importCardPopup")
|
||||||
option(value="{{_id}}") {{title}}
|
option(value="{{_id}}") {{title}}
|
||||||
|
|
||||||
label {{_ 'cards'}}:
|
label {{_ 'cards'}}:
|
||||||
select.js-select-lists
|
select.js-select-cards
|
||||||
each cards
|
each cards
|
||||||
option(value="{{_id}}") {{title}}
|
option(value="{{_id}}") {{title}}
|
||||||
|
|
||||||
.edit-controls.clearfix
|
.edit-controls.clearfix
|
||||||
input.primary.confirm.js-done(type="submit" value="{{_ 'done'}}")
|
input.primary.confirm.js-done(type="button" value="{{_ 'import'}}")
|
||||||
span.quiet
|
|
||||||
| {{_ 'or'}}
|
|
||||||
a.js-search {{_ 'search'}}
|
|
||||||
|
|
||||||
template(name="searchCardPopup")
|
template(name="searchCardPopup")
|
||||||
label {{_ 'boards'}}:
|
label {{_ 'boards'}}:
|
||||||
|
|
|
||||||
|
|
@ -201,6 +201,7 @@ BlazeComponent.extendComponent({
|
||||||
return [{
|
return [{
|
||||||
keydown: this.pressKey,
|
keydown: this.pressKey,
|
||||||
'click .js-import': Popup.open('importCard'),
|
'click .js-import': Popup.open('importCard'),
|
||||||
|
'click .js-search': Popup.open('searchCard'),
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -275,14 +276,39 @@ BlazeComponent.extendComponent({
|
||||||
|
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
onCreated() {
|
onCreated() {
|
||||||
subManager.subscribe('board', Session.get('currentBoard'));
|
// Prefetch first non-current board id
|
||||||
this.selectedBoardId = new ReactiveVar(Session.get('currentBoard'));
|
const boardId = Boards.findOne({
|
||||||
|
archived: false,
|
||||||
|
'members.userId': Meteor.userId(),
|
||||||
|
_id: {$ne: Session.get('currentBoard')},
|
||||||
|
})._id;
|
||||||
|
// Subscribe to this board
|
||||||
|
subManager.subscribe('board', boardId);
|
||||||
|
this.selectedBoardId = new ReactiveVar(boardId);
|
||||||
|
this.selectedSwimlaneId = new ReactiveVar('');
|
||||||
|
this.selectedListId = new ReactiveVar('');
|
||||||
|
|
||||||
|
this.boardId = Session.get('currentBoard');
|
||||||
|
// In order to get current board info
|
||||||
|
subManager.subscribe('board', this.boardId);
|
||||||
|
const board = Boards.findOne(this.boardId);
|
||||||
|
// List where to insert card
|
||||||
|
const list = $(Popup._getTopStack().openerElement).closest('.js-list');
|
||||||
|
this.listId = Blaze.getData(list[0])._id;
|
||||||
|
// Swimlane where to insert card
|
||||||
|
const swimlane = $(Popup._getTopStack().openerElement).closest('.js-swimlane');
|
||||||
|
this.swimlaneId = '';
|
||||||
|
if (board.view === 'board-view-swimlanes')
|
||||||
|
this.swimlaneId = Blaze.getData(swimlane[0])._id;
|
||||||
|
else
|
||||||
|
this.swimlaneId = Swimlanes.findOne({boardId: this.boardId})._id;
|
||||||
},
|
},
|
||||||
|
|
||||||
boards() {
|
boards() {
|
||||||
const boards = Boards.find({
|
const boards = Boards.find({
|
||||||
archived: false,
|
archived: false,
|
||||||
'members.userId': Meteor.userId(),
|
'members.userId': Meteor.userId(),
|
||||||
|
_id: {$ne: Session.get('currentBoard')},
|
||||||
}, {
|
}, {
|
||||||
sort: ['title'],
|
sort: ['title'],
|
||||||
});
|
});
|
||||||
|
|
@ -290,18 +316,26 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
swimlanes() {
|
swimlanes() {
|
||||||
const board = Boards.findOne(this.selectedBoardId.get());
|
const swimlanes = Swimlanes.find({boardId: this.selectedBoardId.get()});
|
||||||
return board.swimlanes();
|
if (swimlanes.count())
|
||||||
|
this.selectedSwimlaneId.set(swimlanes.fetch()[0]._id);
|
||||||
|
return swimlanes;
|
||||||
},
|
},
|
||||||
|
|
||||||
lists() {
|
lists() {
|
||||||
const board = Boards.findOne(this.selectedBoardId.get());
|
const lists = Lists.find({boardId: this.selectedBoardId.get()});
|
||||||
return board.lists();
|
if (lists.count())
|
||||||
|
this.selectedListId.set(lists.fetch()[0]._id);
|
||||||
|
return lists;
|
||||||
},
|
},
|
||||||
|
|
||||||
cards() {
|
cards() {
|
||||||
const board = Boards.findOne(this.selectedBoardId.get());
|
return Cards.find({
|
||||||
return board.cards();
|
boardId: this.selectedBoardId.get(),
|
||||||
|
swimlaneId: this.selectedSwimlaneId.get(),
|
||||||
|
listId: this.selectedListId.get(),
|
||||||
|
archived: false,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
events() {
|
events() {
|
||||||
|
|
@ -310,24 +344,44 @@ BlazeComponent.extendComponent({
|
||||||
this.selectedBoardId.set($(evt.currentTarget).val());
|
this.selectedBoardId.set($(evt.currentTarget).val());
|
||||||
subManager.subscribe('board', this.selectedBoardId.get());
|
subManager.subscribe('board', this.selectedBoardId.get());
|
||||||
},
|
},
|
||||||
'submit .js-done' (evt) {
|
'change .js-select-swimlanes'(evt) {
|
||||||
|
this.selectedSwimlaneId.set($(evt.currentTarget).val());
|
||||||
|
},
|
||||||
|
'change .js-select-lists'(evt) {
|
||||||
|
this.selectedListId.set($(evt.currentTarget).val());
|
||||||
|
},
|
||||||
|
'click .js-done' (evt) {
|
||||||
// IMPORT CARD
|
// IMPORT CARD
|
||||||
|
evt.stopPropagation();
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
// XXX We should *not* get the currentCard from the global state, but
|
const _id = Cards.insert({
|
||||||
// instead from a “component” state.
|
title: $('.js-select-cards option:selected').text(), //dummy
|
||||||
const card = Cards.findOne(Session.get('currentCard'));
|
listId: this.listId,
|
||||||
const lSelect = $('.js-select-lists')[0];
|
swimlaneId: this.swimlaneId,
|
||||||
const newListId = lSelect.options[lSelect.selectedIndex].value;
|
boardId: this.boardId,
|
||||||
const slSelect = $('.js-select-swimlanes')[0];
|
sort: Lists.findOne(this.listId).cards().count(),
|
||||||
card.swimlaneId = slSelect.options[slSelect.selectedIndex].value;
|
type: 'cardType-importedCard',
|
||||||
|
importedId: $('.js-select-cards option:selected').val(),
|
||||||
|
});
|
||||||
|
Filter.addException(_id);
|
||||||
Popup.close();
|
Popup.close();
|
||||||
},
|
},
|
||||||
'submit .js-import-board' (evt) {
|
'click .js-import-board' (evt) {
|
||||||
//IMPORT BOARD
|
//IMPORT BOARD
|
||||||
|
evt.stopPropagation();
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
const _id = Cards.insert({
|
||||||
|
title: $('.js-select-boards option:selected').text(), //dummy
|
||||||
|
listId: this.listId,
|
||||||
|
swimlaneId: this.swimlaneId,
|
||||||
|
boardId: this.boardId,
|
||||||
|
sort: Lists.findOne(this.listId).cards().count(),
|
||||||
|
type: 'cardType-importedBoard',
|
||||||
|
importedId: $('.js-select-boards option:selected').val(),
|
||||||
|
});
|
||||||
|
Filter.addException(_id);
|
||||||
Popup.close();
|
Popup.close();
|
||||||
},
|
},
|
||||||
'click .js-search': Popup.open('searchCard'),
|
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
}).register('importCardPopup');
|
}).register('importCardPopup');
|
||||||
|
|
@ -338,13 +392,30 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
onCreated() {
|
onCreated() {
|
||||||
|
// Prefetch first non-current board id
|
||||||
const boardId = Boards.findOne({
|
const boardId = Boards.findOne({
|
||||||
archived: false,
|
archived: false,
|
||||||
'members.userId': Meteor.userId(),
|
'members.userId': Meteor.userId(),
|
||||||
_id: {$ne: Session.get('currentBoard')},
|
_id: {$ne: Session.get('currentBoard')},
|
||||||
})._id;
|
})._id;
|
||||||
|
// Subscribe to this board
|
||||||
subManager.subscribe('board', boardId);
|
subManager.subscribe('board', boardId);
|
||||||
this.selectedBoardId = new ReactiveVar(boardId);
|
this.selectedBoardId = new ReactiveVar(boardId);
|
||||||
|
|
||||||
|
this.boardId = Session.get('currentBoard');
|
||||||
|
// In order to get current board info
|
||||||
|
subManager.subscribe('board', this.boardId);
|
||||||
|
const board = Boards.findOne(this.boardId);
|
||||||
|
// List where to insert card
|
||||||
|
const list = $(Popup._getTopStack().openerElement).closest('.js-list');
|
||||||
|
this.listId = Blaze.getData(list[0])._id;
|
||||||
|
// Swimlane where to insert card
|
||||||
|
const swimlane = $(Popup._getTopStack().openerElement).closest('.js-swimlane');
|
||||||
|
this.swimlaneId = '';
|
||||||
|
if (board.view === 'board-view-swimlanes')
|
||||||
|
this.swimlaneId = Blaze.getData(swimlane[0])._id;
|
||||||
|
else
|
||||||
|
this.swimlaneId = Swimlanes.findOne({boardId: this.boardId})._id;
|
||||||
this.term = new ReactiveVar('');
|
this.term = new ReactiveVar('');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -376,6 +447,18 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
'click .js-minicard'(evt) {
|
'click .js-minicard'(evt) {
|
||||||
// IMPORT CARD
|
// IMPORT CARD
|
||||||
|
const card = Blaze.getData(evt.currentTarget);
|
||||||
|
const _id = Cards.insert({
|
||||||
|
title: card.title, //dummy
|
||||||
|
listId: this.listId,
|
||||||
|
swimlaneId: this.swimlaneId,
|
||||||
|
boardId: this.boardId,
|
||||||
|
sort: Lists.findOne(this.listId).cards().count(),
|
||||||
|
type: 'cardType-importedCard',
|
||||||
|
importedId: card._id,
|
||||||
|
});
|
||||||
|
Filter.addException(_id);
|
||||||
|
Popup.close();
|
||||||
},
|
},
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue