Avoid links on a template-board

Allow creation of template boards with a linked card
Avoid changing the name of the template-container swimlanes
This commit is contained in:
Andrés Manelli 2019-02-23 12:14:37 +01:00
parent cdf070189e
commit 1e72177991
7 changed files with 54 additions and 30 deletions

View file

@ -46,13 +46,14 @@ template(name="addCardForm")
button.primary.confirm(type="submit") {{_ 'add'}}
unless isSandstorm
unless currentBoard.isTemplatesBoard
span.quiet
| {{_ 'or'}}
a.js-link {{_ 'link'}}
span.quiet
|  
| /
a.js-search {{_ 'search'}}
unless currentBoard.isTemplateBoard
span.quiet
| {{_ 'or'}}
a.js-link {{_ 'link'}}
span.quiet
|  
| /
a.js-search {{_ 'search'}}
template(name="autocompleteLabelLine")
.minicard-label(class="card-label-{{colorName}}" title=labelName)

View file

@ -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,

View file

@ -1,15 +1,21 @@
template(name="swimlaneHeader")
.swimlane-header-wrap.js-swimlane-header(class='{{#if colorClass}}swimlane-{{colorClass}}{{/if}}')
+inlinedForm
+editSwimlaneTitleForm
if this.isTemplateContainer
+swimlaneFixedHeader(this)
else
.swimlane-header(
class="{{#if currentUser.isBoardMember}}js-open-inlined-form is-editable{{/if}}")
= title
.swimlane-header-menu
unless currentUser.isCommentOnly
a.fa.fa-plus.js-open-add-swimlane-menu.swimlane-header-plus-icon
a.fa.fa-navicon.js-open-swimlane-menu
+inlinedForm
+editSwimlaneTitleForm
else
+swimlaneFixedHeader(this)
template(name="swimlaneFixedHeader")
.swimlane-header(
class="{{#if currentUser.isBoardMember}}js-open-inlined-form is-editable{{/if}}")
= title
.swimlane-header-menu
unless currentUser.isCommentOnly
a.fa.fa-plus.js-open-add-swimlane-menu.swimlane-header-plus-icon
a.fa.fa-navicon.js-open-swimlane-menu
template(name="editSwimlaneTitleForm")
.list-composer

View file

@ -168,8 +168,8 @@ BlazeComponent.extendComponent({
evt.preventDefault();
const titleInput = this.find('.list-name-input');
const title = titleInput.value.trim();
const listType = (this.currentSwimlane.isListTemplatesSwimlane())?'template-list':'list';
if (title) {
const listType = (this.currentSwimlane.isListTemplatesSwimlane())?'template-list':'list';
Lists.insert({
title,
boardId: Session.get('currentBoard'),

View file

@ -455,7 +455,6 @@
"welcome-swimlane": "Milestone 1",
"welcome-list1": "Basics",
"welcome-list2": "Advanced",
"templates-board": "Templates Board",
"card-templates-swimlane": "Card Templates",
"list-templates-swimlane": "List Templates",
"board-templates-swimlane": "Board Templates",

View file

@ -149,7 +149,7 @@ Swimlanes.helpers({
isBoardTemplatesSwimlane() {
const user = Users.findOne(Meteor.userId());
return user.profile.boardsTemplatesSwimlaneId === this._id;
return user.profile.boardTemplatesSwimlaneId === this._id;
},
});

View file

@ -739,7 +739,7 @@ if (Meteor.isServer) {
});
Boards.insert({
title: TAPi18n.__('templates-board'),
title: TAPi18n.__('templates'),
permission: 'private',
type: 'template-container'
}, fakeUser, (err, boardId) => {