Public boards overview

This commit is contained in:
Nico 2020-04-12 00:56:35 +02:00
parent 8f28a409c7
commit edf52bc438
6 changed files with 42 additions and 8 deletions

View file

@ -55,7 +55,7 @@ template(name="boardList")
title="{{_ 'archive-board'}}") title="{{_ 'archive-board'}}")
template(name="boardListHeaderBar") template(name="boardListHeaderBar")
h1 {{_ 'my-boards'}} h1 {{_ title }}
.board-header-btns.right .board-header-btns.right
a.board-header-btn.js-open-archived-board a.board-header-btn.js-open-archived-board
i.fa.fa-archive i.fa.fa-archive

View file

@ -7,6 +7,9 @@ Template.boardListHeaderBar.events({
}); });
Template.boardListHeaderBar.helpers({ Template.boardListHeaderBar.helpers({
title(){
return FlowRouter.getRouteName() == 'home' ? 'my-boards' :'public';
},
templatesBoardId() { templatesBoardId() {
return Meteor.user() && Meteor.user().getTemplatesBoardId(); return Meteor.user() && Meteor.user().getTemplatesBoardId();
}, },
@ -21,12 +24,17 @@ BlazeComponent.extendComponent({
}, },
boards() { boards() {
return Boards.find( let query = {
{
archived: false, archived: false,
'members.userId': Meteor.userId(),
type: 'board', type: 'board',
}, }
if (FlowRouter.getRouteName() == 'home')
query['members.userId'] = Meteor.userId()
else
query.permission = 'public'
return Boards.find(
query,
{ sort: ['title'] }, { sort: ['title'] },
); );
}, },

View file

@ -24,6 +24,11 @@ template(name="header")
a(href="{{pathFor 'home'}}") a(href="{{pathFor 'home'}}")
span.fa.fa-home span.fa.fa-home
| {{_ 'all-boards'}} | {{_ 'all-boards'}}
li.separator -
li
a(href="{{pathFor 'public'}}")
span.fa.fa-globe
| {{_ 'public'}}
each currentUser.starredBoards each currentUser.starredBoards
li.separator - li.separator -
li(class="{{#if $.Session.equals 'currentBoard' _id}}current{{/if}}") li(class="{{#if $.Session.equals 'currentBoard' _id}}current{{/if}}")

View file

@ -127,7 +127,7 @@
&.current &.current
color: darken(white, 5%) color: darken(white, 5%)
&:first-child .fa-home &:first-child .fa-home,&:nth-child(3) .fa-globe
margin-right: 5px margin-right: 5px
a.js-create-board a.js-create-board

View file

@ -26,6 +26,27 @@ FlowRouter.route('/', {
}, },
}); });
FlowRouter.route('/public', {
name: 'public',
triggersEnter: [AccountsTemplates.ensureSignedIn],
action() {
Session.set('currentBoard', null);
Session.set('currentList', null);
Session.set('currentCard', null);
Filter.reset();
EscapeActions.executeAll();
Utils.manageCustomUI();
Utils.manageMatomo();
BlazeLayout.render('defaultLayout', {
headerBar: 'boardListHeaderBar',
content: 'boardList',
});
},
});
FlowRouter.route('/b/:id/:slug', { FlowRouter.route('/b/:id/:slug', {
name: 'board', name: 'board',
action(params) { action(params) {

View file

@ -18,7 +18,7 @@ Meteor.publish('boards', function() {
archived: false, archived: false,
$or: [ $or: [
{ {
_id: { $in: starredBoards }, // _id: { $in: starredBoards }, // Commented out, to get a list of all public boards
permission: 'public', permission: 'public',
}, },
{ members: { $elemMatch: { userId, isActive: true } } }, { members: { $elemMatch: { userId, isActive: true } } },