summaryrefslogtreecommitdiffstats
path: root/client/components/lists/listBody.js
diff options
context:
space:
mode:
authorAndrés Manelli <andresmanelli@gmail.com>2019-02-23 12:14:37 +0100
committerAndrés Manelli <andresmanelli@gmail.com>2019-02-24 00:05:00 +0100
commit1e72177991e3fe11a1837e3e294e4de5d728aa30 (patch)
treee0d8e2fb100bae88f2f9b83d7c79362fe9d431ad /client/components/lists/listBody.js
parentcdf070189e11205eecd11641226ae62964cc03e1 (diff)
downloadwekan-1e72177991e3fe11a1837e3e294e4de5d728aa30.tar.gz
wekan-1e72177991e3fe11a1837e3e294e4de5d728aa30.tar.bz2
wekan-1e72177991e3fe11a1837e3e294e4de5d728aa30.zip
Avoid links on a template-board
Allow creation of template boards with a linked card Avoid changing the name of the template-container swimlanes
Diffstat (limited to 'client/components/lists/listBody.js')
-rw-r--r--client/components/lists/listBody.js38
1 files changed, 28 insertions, 10 deletions
diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js
index 576bcd9f..eccef552 100644
--- a/client/components/lists/listBody.js
+++ b/client/components/lists/listBody.js
@@ -67,29 +67,47 @@ BlazeComponent.extendComponent({
const labelIds = formComponent.labels.get();
const customFields = formComponent.customFields.get();
- const boardId = this.data().board();
+ const board = this.data().board();
+ let linkedId = '';
let swimlaneId = '';
const boardView = Meteor.user().profile.boardView;
let cardType = 'cardType-card';
- if (this.data().board().isTemplatesBoard()) {
- swimlaneId = this.parentComponent().parentComponent().data()._id; // Always swimlanes view
- cardType = (Swimlanes.findOne(swimlaneId).isCardTemplatesSwimlane())?'template-card':'cardType-card';
- } else if (boardView === 'board-view-swimlanes')
- swimlaneId = this.parentComponent().parentComponent().data()._id;
- else if ((boardView === 'board-view-lists') || (boardView === 'board-view-cal'))
- swimlaneId = boardId.getDefaultSwimline()._id;
-
if (title) {
+ if (board.isTemplatesBoard()) {
+ swimlaneId = this.parentComponent().parentComponent().data()._id; // Always swimlanes view
+ const swimlane = Swimlanes.findOne(swimlaneId);
+ // If this is the card templates swimlane, insert a card template
+ if (swimlane.isCardTemplatesSwimlane())
+ cardType = 'template-card';
+ // If this is the board templates swimlane, insert a board template and a linked card
+ else if (swimlane.isBoardTemplatesSwimlane()) {
+ linkedId = Boards.insert({
+ title,
+ permission: 'private',
+ type: 'template-board',
+ });
+ Swimlanes.insert({
+ title: TAPi18n.__('default'),
+ boardId: linkedId,
+ });
+ cardType = 'cardType-linkedBoard';
+ }
+ } else if (boardView === 'board-view-swimlanes')
+ swimlaneId = this.parentComponent().parentComponent().data()._id;
+ else if ((boardView === 'board-view-lists') || (boardView === 'board-view-cal'))
+ swimlaneId = board.getDefaultSwimline()._id;
+
const _id = Cards.insert({
title,
members,
labelIds,
customFields,
listId: this.data()._id,
- boardId: boardId._id,
+ boardId: board._id,
sort: sortIndex,
swimlaneId,
type: cardType,
+ linkedId,
});
// if the displayed card count is less than the total cards in the list,