Fixed Templates are Missing, Error: Site not Found "/templates" is missing in the URL.

Shared Templates part 5: Make visible Create template board checkbox and templates at All Boards page, In Progress.

Thanks to xet7 !

Fixes #4253,
related #3313
This commit is contained in:
Lauri Ojansivu 2021-12-25 21:59:43 +02:00
parent c46ec4a155
commit 7f32de3bec
5 changed files with 58 additions and 14 deletions

View file

@ -235,9 +235,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 a.flex.js-toggle-add-template-container
// .materialCheckBox#add-template-container .materialCheckBox#add-template-container
// span {{_ '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'}}

View file

@ -14,6 +14,14 @@ template(name="boardList")
option(value="-1") {{_ 'organizations'}} : option(value="-1") {{_ 'organizations'}} :
each orgsDatas each orgsDatas
option(value="{{orgId}}") {{_ orgDisplayName}} option(value="{{orgId}}") {{_ orgDisplayName}}
//li.AllBoardTemplates
// if userHasTemplates
// select.js-AllBoardTemplates#jsAllBoardTemplates("multiple")
// option(value="-1") {{_ 'templates'}} :
// each templatesDatas
// option(value="{{templateId}}") {{_ templateDisplayName}}
li.AllBoardBtns li.AllBoardBtns
div.AllBoardButtonsContainer div.AllBoardButtonsContainer
if userHasOrgsOrTeams if userHasOrgsOrTeams

View file

@ -8,7 +8,11 @@ Template.boardListHeaderBar.events({
Template.boardListHeaderBar.helpers({ Template.boardListHeaderBar.helpers({
title() { title() {
//if (FlowRouter.getRouteName() === 'template-container') {
// return 'template-container';
//} else {
return FlowRouter.getRouteName() === 'home' ? 'my-boards' : 'public'; return FlowRouter.getRouteName() === 'home' ? 'my-boards' : 'public';
//}
}, },
templatesBoardId() { templatesBoardId() {
return Meteor.user() && Meteor.user().getTemplatesBoardId(); return Meteor.user() && Meteor.user().getTemplatesBoardId();
@ -99,6 +103,14 @@ BlazeComponent.extendComponent({
else else
return false; return false;
}, },
/*
userHasTemplates(){
if(Meteor.user() != null && Meteor.user().orgs && Meteor.user().orgs.length > 0)
return true;
else
return false;
},
*/
orgsDatas() { orgsDatas() {
if(Meteor.user().orgs) if(Meteor.user().orgs)
return Meteor.user().orgs.sort((a, b) => a.orgDisplayName.localeCompare(b.orgDisplayName)); return Meteor.user().orgs.sort((a, b) => a.orgDisplayName.localeCompare(b.orgDisplayName));
@ -122,12 +134,11 @@ BlazeComponent.extendComponent({
}, },
boards() { boards() {
let query = { let query = {
//archived: false, // { type: 'board' },
////type: { $in: ['board','template-container'] }, // { type: { $in: ['board','template-container'] } },
//type: 'board',
$and: [ $and: [
{ archived: false }, { archived: false },
{ type: 'board' }, { type: { $in: ['board','template-container'] } },
{ $or:[] } { $or:[] }
] ]
}; };

View file

@ -124,6 +124,30 @@ FlowRouter.route('/shortcuts', {
}, },
}); });
FlowRouter.route('/b/templates', {
name: 'template-container',
triggersEnter: [AccountsTemplates.ensureSignedIn],
action() {
Session.set('currentBoard', null);
Session.set('currentList', null);
Session.set('currentCard', null);
Session.set('popupCardId', null);
Session.set('popupCardBoardId', null);
Filter.reset();
Session.set('sortBy', '');
EscapeActions.executeAll();
Utils.manageCustomUI();
Utils.manageMatomo();
BlazeLayout.render('defaultLayout', {
headerBar: 'boardListHeaderBar',
content: 'boardList',
});
},
});
FlowRouter.route('/my-cards', { FlowRouter.route('/my-cards', {
name: 'my-cards', name: 'my-cards',
triggersEnter: [AccountsTemplates.ensureSignedIn], triggersEnter: [AccountsTemplates.ensureSignedIn],

View file

@ -719,7 +719,8 @@ Users.helpers({
}, },
getTemplatesBoardSlug() { getTemplatesBoardSlug() {
return (Boards.findOne((this.profile || {}).templatesBoardId) || {}).slug; //return (Boards.findOne((this.profile || {}).templatesBoardId) || {}).slug;
return 'templates';
}, },
remove() { remove() {
@ -1305,13 +1306,13 @@ if (Meteor.isServer) {
if (Meteor.user() && Meteor.user().isAdmin) { if (Meteor.user() && Meteor.user().isAdmin) {
Users.find({ Users.find({
teams: { teams: {
$elemMatch: {teamId: teamId} $elemMatch: {teamId: teamId}
} }
}).forEach(user => { }).forEach(user => {
Users.update({ Users.update({
_id: user._id, _id: user._id,
teams: { teams: {
$elemMatch: {teamId: teamId} $elemMatch: {teamId: teamId}
} }
}, { }, {
$set: { $set: {
@ -1327,13 +1328,13 @@ if (Meteor.isServer) {
if (Meteor.user() && Meteor.user().isAdmin) { if (Meteor.user() && Meteor.user().isAdmin) {
Users.find({ Users.find({
orgs: { orgs: {
$elemMatch: {orgId: orgId} $elemMatch: {orgId: orgId}
} }
}).forEach(user => { }).forEach(user => {
Users.update({ Users.update({
_id: user._id, _id: user._id,
orgs: { orgs: {
$elemMatch: {orgId: orgId} $elemMatch: {orgId: orgId}
} }
}, { }, {
$set: { $set: {