From edf52bc4382823ed8768251954371094a849213e Mon Sep 17 00:00:00 2001 From: Nico Date: Sun, 12 Apr 2020 00:56:35 +0200 Subject: Public boards overview --- client/components/boards/boardsList.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'client/components/boards/boardsList.js') diff --git a/client/components/boards/boardsList.js b/client/components/boards/boardsList.js index 3918af82..0ff1c4fb 100644 --- a/client/components/boards/boardsList.js +++ b/client/components/boards/boardsList.js @@ -7,6 +7,9 @@ Template.boardListHeaderBar.events({ }); Template.boardListHeaderBar.helpers({ + title(){ + return FlowRouter.getRouteName() == 'home' ? 'my-boards' :'public'; + }, templatesBoardId() { return Meteor.user() && Meteor.user().getTemplatesBoardId(); }, @@ -21,12 +24,17 @@ BlazeComponent.extendComponent({ }, boards() { + let query = { + archived: false, + type: 'board', + } + if (FlowRouter.getRouteName() == 'home') + query['members.userId'] = Meteor.userId() + else + query.permission = 'public' + return Boards.find( - { - archived: false, - 'members.userId': Meteor.userId(), - type: 'board', - }, + query, { sort: ['title'] }, ); }, -- cgit v1.2.3-1-g7c22 From 35ae07e2a65c5ab5ba6784cdb67631918a41ccc3 Mon Sep 17 00:00:00 2001 From: salleman Date: Mon, 13 Apr 2020 15:46:29 +0200 Subject: debug isBoardAdmin on main page --- client/components/boards/boardsList.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'client/components/boards/boardsList.js') diff --git a/client/components/boards/boardsList.js b/client/components/boards/boardsList.js index 0ff1c4fb..65bed16a 100644 --- a/client/components/boards/boardsList.js +++ b/client/components/boards/boardsList.js @@ -42,6 +42,10 @@ BlazeComponent.extendComponent({ const user = Meteor.user(); return user && user.hasStarred(this.currentData()._id); }, + isAdministrable() { + const user = Meteor.user(); + return user && user.isBoardAdmin(this.currentData()._id); + }, hasOvertimeCards() { subManager.subscribe('board', this.currentData()._id, false); -- cgit v1.2.3-1-g7c22 From 10fcc19b7f9307e71f01b6abca055806d69f7d4e Mon Sep 17 00:00:00 2001 From: boeserwolf Date: Sun, 19 Apr 2020 12:30:21 +0300 Subject: Add sortDefault helper for sorting boards --- client/components/boards/boardsList.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'client/components/boards/boardsList.js') diff --git a/client/components/boards/boardsList.js b/client/components/boards/boardsList.js index 65bed16a..aabc98e8 100644 --- a/client/components/boards/boardsList.js +++ b/client/components/boards/boardsList.js @@ -7,8 +7,8 @@ Template.boardListHeaderBar.events({ }); Template.boardListHeaderBar.helpers({ - title(){ - return FlowRouter.getRouteName() == 'home' ? 'my-boards' :'public'; + title() { + return FlowRouter.getRouteName() == 'home' ? 'my-boards' : 'public'; }, templatesBoardId() { return Meteor.user() && Meteor.user().getTemplatesBoardId(); @@ -27,16 +27,12 @@ BlazeComponent.extendComponent({ let query = { archived: false, type: 'board', - } + }; if (FlowRouter.getRouteName() == 'home') - query['members.userId'] = Meteor.userId() - else - query.permission = 'public' + query['members.userId'] = Meteor.userId(); + else query.permission = 'public'; - return Boards.find( - query, - { sort: ['title'] }, - ); + return Boards.find(query, { sort: { sort: 1 /* boards default sorting */ } }); }, isStarred() { const user = Meteor.user(); -- cgit v1.2.3-1-g7c22 From ef5f38f431dbedbecc81135702764cdc08797177 Mon Sep 17 00:00:00 2001 From: boeserwolf Date: Sun, 19 Apr 2020 12:45:04 +0300 Subject: Make boards sortable --- client/components/boards/boardsList.js | 54 ++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'client/components/boards/boardsList.js') diff --git a/client/components/boards/boardsList.js b/client/components/boards/boardsList.js index aabc98e8..d2d44407 100644 --- a/client/components/boards/boardsList.js +++ b/client/components/boards/boardsList.js @@ -1,4 +1,5 @@ const subManager = new SubsManager(); +const { calculateIndex, enableClickOnTouch } = Utils; Template.boardListHeaderBar.events({ 'click .js-open-archived-board'() { @@ -23,6 +24,59 @@ BlazeComponent.extendComponent({ Meteor.subscribe('setting'); }, + onRendered() { + const self = this; + function userIsAllowedToMove() { + return Meteor.user(); + } + + const itemsSelector = '.js-board:not(.placeholder)'; + + const $boards = this.$('.js-boards'); + $boards.sortable({ + connectWith: '.js-boards', + tolerance: 'pointer', + appendTo: '.board-list', + helper: 'clone', + distance: 7, + items: itemsSelector, + placeholder: 'board-wrapper placeholder', + start(evt, ui) { + ui.helper.css('z-index', 1000); + ui.placeholder.height(ui.helper.height()); + EscapeActions.executeUpTo('popup-close'); + }, + stop(evt, ui) { + // To attribute the new index number, we need to get the DOM element + // of the previous and the following card -- if any. + const prevCardDom = ui.item.prev('.js-board').get(0); + const nextCardDom = ui.item.next('.js-board').get(0); + const sortIndex = calculateIndex(prevCardDom, nextCardDom, 1); + + const boardDomElement = ui.item.get(0); + const board = Blaze.getData(boardDomElement); + // Normally the jquery-ui sortable library moves the dragged DOM element + // to its new position, which disrupts Blaze reactive updates mechanism + // (especially when we move the last card of a list, or when multiple + // users move some cards at the same time). To prevent these UX glitches + // we ask sortable to gracefully cancel the move, and to put back the + // DOM in its initial state. The card move is then handled reactively by + // Blaze with the below query. + $boards.sortable('cancel'); + + board.move(sortIndex.base); + }, + }); + + // ugly touch event hotfix + enableClickOnTouch(itemsSelector); + + // Disable drag-dropping if the current user is not a board member or is comment only + this.autorun(() => { + $boards.sortable('option', 'disabled', !userIsAllowedToMove()); + }); + }, + boards() { let query = { archived: false, -- cgit v1.2.3-1-g7c22 From 1a065ff351b5c37536d73cc3d46b736fe310e32c Mon Sep 17 00:00:00 2001 From: boeserwolf Date: Sun, 19 Apr 2020 15:52:43 +0300 Subject: Refactor variable names --- client/components/boards/boardsList.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'client/components/boards/boardsList.js') diff --git a/client/components/boards/boardsList.js b/client/components/boards/boardsList.js index d2d44407..c700084f 100644 --- a/client/components/boards/boardsList.js +++ b/client/components/boards/boardsList.js @@ -49,9 +49,9 @@ BlazeComponent.extendComponent({ stop(evt, ui) { // To attribute the new index number, we need to get the DOM element // of the previous and the following card -- if any. - const prevCardDom = ui.item.prev('.js-board').get(0); - const nextCardDom = ui.item.next('.js-board').get(0); - const sortIndex = calculateIndex(prevCardDom, nextCardDom, 1); + const prevBoardDom = ui.item.prev('.js-board').get(0); + const nextBoardBom = ui.item.next('.js-board').get(0); + const sortIndex = calculateIndex(prevBoardDom, nextBoardBom, 1); const boardDomElement = ui.item.get(0); const board = Blaze.getData(boardDomElement); -- cgit v1.2.3-1-g7c22 From b2acc3ba45c48d3bb3b25e84bc31f5b80e7961d4 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Tue, 21 Apr 2020 17:06:39 +0200 Subject: Multiple lint issue fixes Found by using the command `meteor npm run lint:eslint:fix`. --- client/components/boards/boardsList.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'client/components/boards/boardsList.js') diff --git a/client/components/boards/boardsList.js b/client/components/boards/boardsList.js index c700084f..847ea395 100644 --- a/client/components/boards/boardsList.js +++ b/client/components/boards/boardsList.js @@ -9,7 +9,7 @@ Template.boardListHeaderBar.events({ Template.boardListHeaderBar.helpers({ title() { - return FlowRouter.getRouteName() == 'home' ? 'my-boards' : 'public'; + return FlowRouter.getRouteName() === 'home' ? 'my-boards' : 'public'; }, templatesBoardId() { return Meteor.user() && Meteor.user().getTemplatesBoardId(); @@ -82,7 +82,7 @@ BlazeComponent.extendComponent({ archived: false, type: 'board', }; - if (FlowRouter.getRouteName() == 'home') + if (FlowRouter.getRouteName() === 'home') query['members.userId'] = Meteor.userId(); else query.permission = 'public'; -- cgit v1.2.3-1-g7c22 From 9e95c06415e614e587d684ff9660cc53c5f8c8d3 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Wed, 22 Apr 2020 21:00:31 +0300 Subject: Fix lint errors in lint error fix. Thanks to xet7 ! --- client/components/boards/boardsList.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'client/components/boards/boardsList.js') diff --git a/client/components/boards/boardsList.js b/client/components/boards/boardsList.js index 847ea395..9208fdb2 100644 --- a/client/components/boards/boardsList.js +++ b/client/components/boards/boardsList.js @@ -86,7 +86,9 @@ BlazeComponent.extendComponent({ query['members.userId'] = Meteor.userId(); else query.permission = 'public'; - return Boards.find(query, { sort: { sort: 1 /* boards default sorting */ } }); + return Boards.find(query, { + sort: { sort: 1 /* boards default sorting */ }, + }); }, isStarred() { const user = Meteor.user(); -- cgit v1.2.3-1-g7c22 From f1b18d79cdbfd9c9edecf4f93a89e88ee1c6faea Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Fri, 24 Apr 2020 22:41:24 +0200 Subject: Don't interpret dragging an element as a click Remove `enableClickOnTouch` as this behavior is not intuitive. --- client/components/boards/boardsList.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'client/components/boards/boardsList.js') diff --git a/client/components/boards/boardsList.js b/client/components/boards/boardsList.js index 9208fdb2..df319ce0 100644 --- a/client/components/boards/boardsList.js +++ b/client/components/boards/boardsList.js @@ -1,5 +1,5 @@ const subManager = new SubsManager(); -const { calculateIndex, enableClickOnTouch } = Utils; +const { calculateIndex } = Utils; Template.boardListHeaderBar.events({ 'click .js-open-archived-board'() { @@ -68,9 +68,6 @@ BlazeComponent.extendComponent({ }, }); - // ugly touch event hotfix - enableClickOnTouch(itemsSelector); - // Disable drag-dropping if the current user is not a board member or is comment only this.autorun(() => { $boards.sortable('option', 'disabled', !userIsAllowedToMove()); -- cgit v1.2.3-1-g7c22 From eddcb2260bdfba62ecd3e8f8fe6da6e6927ccc47 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Mon, 27 Apr 2020 01:15:10 +0200 Subject: Reactivate the touch event fix for the boards list This fixes https://github.com/wekan/wekan/issues/3049. --- client/components/boards/boardsList.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'client/components/boards/boardsList.js') diff --git a/client/components/boards/boardsList.js b/client/components/boards/boardsList.js index df319ce0..9208fdb2 100644 --- a/client/components/boards/boardsList.js +++ b/client/components/boards/boardsList.js @@ -1,5 +1,5 @@ const subManager = new SubsManager(); -const { calculateIndex } = Utils; +const { calculateIndex, enableClickOnTouch } = Utils; Template.boardListHeaderBar.events({ 'click .js-open-archived-board'() { @@ -68,6 +68,9 @@ BlazeComponent.extendComponent({ }, }); + // ugly touch event hotfix + enableClickOnTouch(itemsSelector); + // Disable drag-dropping if the current user is not a board member or is comment only this.autorun(() => { $boards.sortable('option', 'disabled', !userIsAllowedToMove()); -- cgit v1.2.3-1-g7c22