mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40: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'}}}
|
| {{{_ 'board-private-info'}}}
|
||||||
a.js-change-visibility {{_ 'change'}}.
|
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'}}")
|
input.primary.wide(type="submit" value="{{_ 'create'}}")
|
||||||
span.quiet
|
span.quiet
|
||||||
| {{_ 'or'}}
|
| {{_ 'or'}}
|
||||||
|
|
@ -232,11 +235,6 @@ template(name="createBoard")
|
||||||
span.quiet
|
span.quiet
|
||||||
| /
|
| /
|
||||||
a.js-board-template {{_ 'template'}}
|
a.js-board-template {{_ 'template'}}
|
||||||
br
|
|
||||||
br
|
|
||||||
span.quiet.right
|
|
||||||
| /
|
|
||||||
a.js-board-template-container {{_ 'add-template-container'}}
|
|
||||||
|
|
||||||
//template(name="listsortPopup")
|
//template(name="listsortPopup")
|
||||||
// h2
|
// h2
|
||||||
|
|
|
||||||
|
|
@ -209,115 +209,75 @@ const CreateBoard = BlazeComponent.extendComponent({
|
||||||
this.visibilityMenuIsOpen.set(!this.visibilityMenuIsOpen.get());
|
this.visibilityMenuIsOpen.set(!this.visibilityMenuIsOpen.get());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
toggleAddTemplateContainer() {
|
||||||
|
$('#add-template-container').toggleClass('is-checked');
|
||||||
|
},
|
||||||
|
|
||||||
onSubmit(event) {
|
onSubmit(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const title = this.find('.js-new-board-title').value;
|
const title = this.find('.js-new-board-title').value;
|
||||||
const visibility = this.visibility.get();
|
|
||||||
|
|
||||||
this.boardId.set(
|
const addTemplateContainer = $('#add-template-container.is-checked').length > 0;
|
||||||
Boards.insert({
|
if (addTemplateContainer) {
|
||||||
title,
|
//const templateContainerId = Meteor.call('setCreateTemplateContainer');
|
||||||
permission: visibility,
|
//Utils.goBoardId(templateContainerId);
|
||||||
}),
|
//alert('niinku template ' + Meteor.call('setCreateTemplateContainer'));
|
||||||
);
|
|
||||||
|
|
||||||
Swimlanes.insert({
|
this.boardId.set(
|
||||||
title: 'Default',
|
Boards.insert({
|
||||||
boardId: this.boardId.get(),
|
title: TAPi18n.__('templates'),
|
||||||
});
|
permission: 'private',
|
||||||
|
|
||||||
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',
|
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
|
// Insert the card templates swimlane
|
||||||
Swimlanes.insert(
|
Swimlanes.insert({
|
||||||
{
|
title: TAPi18n.__('card-templates-swimlane'),
|
||||||
title: TAPi18n.__('list-templates-swimlane'),
|
boardId: this.boardId.get(),
|
||||||
boardId,
|
sort: 1,
|
||||||
sort: 2,
|
type: 'template-container',
|
||||||
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
|
// Insert the list templates swimlane
|
||||||
Swimlanes.insert(
|
Swimlanes.insert(
|
||||||
{
|
{
|
||||||
title: TAPi18n.__('board-templates-swimlane'),
|
title: TAPi18n.__('list-templates-swimlane'),
|
||||||
boardId,
|
boardId: this.boardId.get(),
|
||||||
sort: 3,
|
sort: 2,
|
||||||
type: 'template-container',
|
type: 'template-container',
|
||||||
},
|
},
|
||||||
fakeUser,
|
);
|
||||||
(err, swimlaneId) => {
|
|
||||||
// Insert the reference to out board templates swimlane
|
// Insert the board templates swimlane
|
||||||
Users.update(fakeUserId.get(), {
|
Swimlanes.insert(
|
||||||
$set: {
|
{
|
||||||
'profile.boardTemplatesSwimlaneId': swimlaneId,
|
title: TAPi18n.__('board-templates-swimlane'),
|
||||||
},
|
boardId: this.boardId.get(),
|
||||||
});
|
sort: 3,
|
||||||
future3.return();
|
type: 'template-container',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
|
||||||
);
|
Utils.goBoardId(this.boardId.get());
|
||||||
// HACK
|
|
||||||
future1.wait();
|
} else {
|
||||||
future2.wait();
|
const visibility = this.visibility.get();
|
||||||
future3.wait();
|
|
||||||
|
this.boardId.set(
|
||||||
|
Boards.insert({
|
||||||
|
title,
|
||||||
|
permission: visibility,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
Swimlanes.insert({
|
||||||
|
title: 'Default',
|
||||||
|
boardId: this.boardId.get(),
|
||||||
|
});
|
||||||
|
|
||||||
|
Utils.goBoardId(this.boardId.get());
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
events() {
|
events() {
|
||||||
|
|
@ -331,7 +291,7 @@ const CreateBoard = BlazeComponent.extendComponent({
|
||||||
submit: this.onSubmit,
|
submit: this.onSubmit,
|
||||||
'click .js-import-board': Popup.open('chooseBoardSource'),
|
'click .js-import-board': Popup.open('chooseBoardSource'),
|
||||||
'click .js-board-template': Popup.open('searchElement'),
|
'click .js-board-template': Popup.open('searchElement'),
|
||||||
'click .js-board-template-container': this.addBoardTemplateContainer,
|
'click .js-toggle-add-template-container': this.toggleAddTemplateContainer,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1490,24 +1490,26 @@ if (Meteor.isServer) {
|
||||||
|
|
||||||
fakeUserId.withValue(doc._id, () => {
|
fakeUserId.withValue(doc._id, () => {
|
||||||
/*
|
/*
|
||||||
// Insert the Welcome Board
|
|
||||||
Boards.insert({
|
|
||||||
title: TAPi18n.__('welcome-board'),
|
|
||||||
permission: 'private',
|
|
||||||
}, fakeUser, (err, boardId) => {
|
|
||||||
|
|
||||||
Swimlanes.insert({
|
// Insert the Welcome Board
|
||||||
title: TAPi18n.__('welcome-swimlane'),
|
Boards.insert({
|
||||||
boardId,
|
title: TAPi18n.__('welcome-board'),
|
||||||
sort: 1,
|
permission: 'private',
|
||||||
}, fakeUser);
|
}, fakeUser, (err, boardId) => {
|
||||||
|
|
||||||
['welcome-list1', 'welcome-list2'].forEach((title, titleIndex) => {
|
Swimlanes.insert({
|
||||||
Lists.insert({title: TAPi18n.__(title), boardId, sort: titleIndex}, fakeUser);
|
title: TAPi18n.__('welcome-swimlane'),
|
||||||
});
|
boardId,
|
||||||
});
|
sort: 1,
|
||||||
*/
|
}, fakeUser);
|
||||||
|
|
||||||
|
['welcome-list1', 'welcome-list2'].forEach((title, titleIndex) => {
|
||||||
|
Lists.insert({title: TAPi18n.__(title), boardId, sort: titleIndex}, fakeUser);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Insert Template Container
|
||||||
const Future = require('fibers/future');
|
const Future = require('fibers/future');
|
||||||
const future1 = new Future();
|
const future1 = new Future();
|
||||||
const future2 = new Future();
|
const future2 = new Future();
|
||||||
|
|
@ -1592,6 +1594,7 @@ if (Meteor.isServer) {
|
||||||
future1.wait();
|
future1.wait();
|
||||||
future2.wait();
|
future2.wait();
|
||||||
future3.wait();
|
future3.wait();
|
||||||
|
*/
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue