mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
Shared Templates. In Progress.
Part 2: - Ablity to Add Template Container, checkbox in Create Board popup. - Do not create Template Container by default, when creating user. Thanks to xet7 ! Related #3313
This commit is contained in:
parent
48dcb02328
commit
d1d4453120
3 changed files with 83 additions and 122 deletions
|
|
@ -225,6 +225,9 @@ template(name="createBoard")
|
|||
= " "
|
||||
| {{{_ 'board-private-info'}}}
|
||||
a.js-change-visibility {{_ 'change'}}.
|
||||
a.flex.js-toggle-add-template-container
|
||||
.materialCheckBox#add-template-container
|
||||
span {{_ 'add-template-container'}}
|
||||
input.primary.wide(type="submit" value="{{_ 'create'}}")
|
||||
span.quiet
|
||||
| {{_ 'or'}}
|
||||
|
|
@ -232,11 +235,6 @@ template(name="createBoard")
|
|||
span.quiet
|
||||
| /
|
||||
a.js-board-template {{_ 'template'}}
|
||||
br
|
||||
br
|
||||
span.quiet.right
|
||||
| /
|
||||
a.js-board-template-container {{_ 'add-template-container'}}
|
||||
|
||||
//template(name="listsortPopup")
|
||||
// h2
|
||||
|
|
|
|||
|
|
@ -209,9 +209,59 @@ const CreateBoard = BlazeComponent.extendComponent({
|
|||
this.visibilityMenuIsOpen.set(!this.visibilityMenuIsOpen.get());
|
||||
},
|
||||
|
||||
toggleAddTemplateContainer() {
|
||||
$('#add-template-container').toggleClass('is-checked');
|
||||
},
|
||||
|
||||
onSubmit(event) {
|
||||
event.preventDefault();
|
||||
const title = this.find('.js-new-board-title').value;
|
||||
|
||||
const addTemplateContainer = $('#add-template-container.is-checked').length > 0;
|
||||
if (addTemplateContainer) {
|
||||
//const templateContainerId = Meteor.call('setCreateTemplateContainer');
|
||||
//Utils.goBoardId(templateContainerId);
|
||||
//alert('niinku template ' + Meteor.call('setCreateTemplateContainer'));
|
||||
|
||||
this.boardId.set(
|
||||
Boards.insert({
|
||||
title: TAPi18n.__('templates'),
|
||||
permission: 'private',
|
||||
type: 'template-container',
|
||||
}),
|
||||
);
|
||||
|
||||
// Insert the card templates swimlane
|
||||
Swimlanes.insert({
|
||||
title: TAPi18n.__('card-templates-swimlane'),
|
||||
boardId: this.boardId.get(),
|
||||
sort: 1,
|
||||
type: 'template-container',
|
||||
}),
|
||||
|
||||
// Insert the list templates swimlane
|
||||
Swimlanes.insert(
|
||||
{
|
||||
title: TAPi18n.__('list-templates-swimlane'),
|
||||
boardId: this.boardId.get(),
|
||||
sort: 2,
|
||||
type: 'template-container',
|
||||
},
|
||||
);
|
||||
|
||||
// Insert the board templates swimlane
|
||||
Swimlanes.insert(
|
||||
{
|
||||
title: TAPi18n.__('board-templates-swimlane'),
|
||||
boardId: this.boardId.get(),
|
||||
sort: 3,
|
||||
type: 'template-container',
|
||||
},
|
||||
);
|
||||
|
||||
Utils.goBoardId(this.boardId.get());
|
||||
|
||||
} else {
|
||||
const visibility = this.visibility.get();
|
||||
|
||||
this.boardId.set(
|
||||
|
|
@ -227,97 +277,7 @@ const CreateBoard = BlazeComponent.extendComponent({
|
|||
});
|
||||
|
||||
Utils.goBoardId(this.boardId.get());
|
||||
},
|
||||
|
||||
addBoardTemplateContainer(event) {
|
||||
event.preventDefault();
|
||||
const title = this.find('.js-new-board-title').value;
|
||||
|
||||
// Insert Template Container
|
||||
const Future = require('fibers/future');
|
||||
const future1 = new Future();
|
||||
const future2 = new Future();
|
||||
const future3 = new Future();
|
||||
Boards.insert(
|
||||
{
|
||||
title: title || TAPi18n.__('templates'),
|
||||
permission: 'private',
|
||||
type: 'template-container',
|
||||
},
|
||||
fakeUser,
|
||||
(err, boardId) => {
|
||||
// Insert the reference to our templates board
|
||||
Users.update(fakeUserId.get(), {
|
||||
$set: {
|
||||
'profile.templatesBoardId': boardId,
|
||||
},
|
||||
});
|
||||
|
||||
// Insert the card templates swimlane
|
||||
Swimlanes.insert(
|
||||
{
|
||||
title: TAPi18n.__('card-templates-swimlane'),
|
||||
boardId,
|
||||
sort: 1,
|
||||
type: 'template-container',
|
||||
},
|
||||
fakeUser,
|
||||
(err, swimlaneId) => {
|
||||
// Insert the reference to out card templates swimlane
|
||||
Users.update(fakeUserId.get(), {
|
||||
$set: {
|
||||
'profile.cardTemplatesSwimlaneId': swimlaneId,
|
||||
},
|
||||
});
|
||||
future1.return();
|
||||
},
|
||||
);
|
||||
|
||||
// Insert the list templates swimlane
|
||||
Swimlanes.insert(
|
||||
{
|
||||
title: TAPi18n.__('list-templates-swimlane'),
|
||||
boardId,
|
||||
sort: 2,
|
||||
type: 'template-container',
|
||||
},
|
||||
fakeUser,
|
||||
(err, swimlaneId) => {
|
||||
// Insert the reference to out list templates swimlane
|
||||
Users.update(fakeUserId.get(), {
|
||||
$set: {
|
||||
'profile.listTemplatesSwimlaneId': swimlaneId,
|
||||
},
|
||||
});
|
||||
future2.return();
|
||||
},
|
||||
);
|
||||
|
||||
// Insert the board templates swimlane
|
||||
Swimlanes.insert(
|
||||
{
|
||||
title: TAPi18n.__('board-templates-swimlane'),
|
||||
boardId,
|
||||
sort: 3,
|
||||
type: 'template-container',
|
||||
},
|
||||
fakeUser,
|
||||
(err, swimlaneId) => {
|
||||
// Insert the reference to out board templates swimlane
|
||||
Users.update(fakeUserId.get(), {
|
||||
$set: {
|
||||
'profile.boardTemplatesSwimlaneId': swimlaneId,
|
||||
},
|
||||
});
|
||||
future3.return();
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
// HACK
|
||||
future1.wait();
|
||||
future2.wait();
|
||||
future3.wait();
|
||||
}
|
||||
},
|
||||
|
||||
events() {
|
||||
|
|
@ -331,7 +291,7 @@ const CreateBoard = BlazeComponent.extendComponent({
|
|||
submit: this.onSubmit,
|
||||
'click .js-import-board': Popup.open('chooseBoardSource'),
|
||||
'click .js-board-template': Popup.open('searchElement'),
|
||||
'click .js-board-template-container': this.addBoardTemplateContainer,
|
||||
'click .js-toggle-add-template-container': this.toggleAddTemplateContainer,
|
||||
},
|
||||
];
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1490,6 +1490,7 @@ if (Meteor.isServer) {
|
|||
|
||||
fakeUserId.withValue(doc._id, () => {
|
||||
/*
|
||||
|
||||
// Insert the Welcome Board
|
||||
Boards.insert({
|
||||
title: TAPi18n.__('welcome-board'),
|
||||
|
|
@ -1506,8 +1507,9 @@ if (Meteor.isServer) {
|
|||
Lists.insert({title: TAPi18n.__(title), boardId, sort: titleIndex}, fakeUser);
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
||||
|
||||
// Insert Template Container
|
||||
const Future = require('fibers/future');
|
||||
const future1 = new Future();
|
||||
const future2 = new Future();
|
||||
|
|
@ -1592,6 +1594,7 @@ if (Meteor.isServer) {
|
|||
future1.wait();
|
||||
future2.wait();
|
||||
future3.wait();
|
||||
*/
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue