From 094f13934c189e5012e7faf517bd8142a22997c4 Mon Sep 17 00:00:00 2001 From: Zegden Rayen <131524969+Rayene123@users.noreply.github.com> Date: Sat, 8 Mar 2025 15:38:22 +0000 Subject: [PATCH 1/2] added the confirm pop up before cloning or archiving a board --- client/components/boards/boardsList.js | 55 +++++++++++++++----------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/client/components/boards/boardsList.js b/client/components/boards/boardsList.js index 69a29b3c2..dbdd3789c 100644 --- a/client/components/boards/boardsList.js +++ b/client/components/boards/boardsList.js @@ -239,34 +239,41 @@ BlazeComponent.extendComponent({ evt.preventDefault(); }, 'click .js-clone-board'(evt) { - let title = getSlug(ReactiveCache.getBoard(this.currentData()._id).title) || 'cloned-board'; - Meteor.call( - 'copyBoard', - this.currentData()._id, - { - sort: ReactiveCache.getBoards({ archived: false }).length, - type: 'board', - title: ReactiveCache.getBoard(this.currentData()._id).title, - }, - (err, res) => { - if (err) { - console.error(err); - } else { - Session.set('fromBoard', null); - subManager.subscribe('board', res, false); - FlowRouter.go('board', { - id: res, - slug: title, - }); - } - }, - ); - evt.preventDefault(); + if (confirm('Are you sure you want to clone this board?')) { + let title = + getSlug(ReactiveCache.getBoard(this.currentData()._id).title) || + 'cloned-board'; + Meteor.call( + 'copyBoard', + this.currentData()._id, + { + sort: ReactiveCache.getBoards({ archived: false }).length, + type: 'board', + title: ReactiveCache.getBoard(this.currentData()._id).title, + }, + (err, res) => { + if (err) { + console.error(err); + } else { + Session.set('fromBoard', null); + subManager.subscribe('board', res, false); + FlowRouter.go('board', { + id: res, + slug: title, + }); + } + }, + ); + evt.preventDefault(); + } }, 'click .js-archive-board'(evt) { - const boardId = this.currentData()._id; + if (confirm('Are you sure you want to archive this board?')) + { + const boardId = this.currentData()._id; Meteor.call('archiveBoard', boardId); evt.preventDefault(); + } }, 'click .js-accept-invite'() { const boardId = this.currentData()._id; From 61235c953c79c6496cbdc207a46b4afa1068add0 Mon Sep 17 00:00:00 2001 From: Rayene123 Date: Thu, 24 Apr 2025 11:53:08 +0100 Subject: [PATCH 2/2] added a watch icon button when clicked toggle if a card is watched or not --- client/components/cards/minicard.jade | 9 +++++++++ client/components/cards/minicard.js | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/client/components/cards/minicard.jade b/client/components/cards/minicard.jade index 7630c85cd..cfec7ae46 100644 --- a/client/components/cards/minicard.jade +++ b/client/components/cards/minicard.jade @@ -225,3 +225,12 @@ template(name="minicardDetailsActionsPopup") a.js-link i.fa.fa-link | {{_ 'link-card'}} + li + a.js-toggle-watch-card + if isWatching + i.fa.fa-eye + | {{_ 'unwatch'}} + else + i.fa.fa-eye-slash + | {{_ 'watch'}} + diff --git a/client/components/cards/minicard.js b/client/components/cards/minicard.js index d9b5a3806..959092dd3 100644 --- a/client/components/cards/minicard.js +++ b/client/components/cards/minicard.js @@ -46,6 +46,10 @@ BlazeComponent.extendComponent({ } return ret; }, + isWatching() { + const card = this.currentData(); + return card.findWatcher(Meteor.userId()); + }, showMembers() { // cache "board" to reduce the mini-mongodb access @@ -125,6 +129,9 @@ Template.minicard.helpers({ ? Meteor.connection._lastSessionId : null; }, + isWatching() { + return this.findWatcher(Meteor.userId()); + } }); BlazeComponent.extendComponent({ @@ -178,4 +185,11 @@ Template.minicardDetailsActionsPopup.events({ this.archive(); Utils.goBoardId(this.boardId); }), + 'click .js-toggle-watch-card'() { + const currentCard = this; + const level = currentCard.findWatcher(Meteor.userId()) ? null : 'watching'; + Meteor.call('watch', 'card', currentCard._id, level, (err, ret) => { + if (!err && ret) Popup.back(); + }); + }, });