From 2bbc312ad0600da06b7d18f57630ad19cd90efd2 Mon Sep 17 00:00:00 2001 From: Nico Date: Tue, 7 Apr 2020 20:43:35 +0200 Subject: Voteing feature --- client/components/cards/cardDetails.js | 77 +++++++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 5 deletions(-) (limited to 'client/components/cards/cardDetails.js') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 5fdc5579..8492393c 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -38,6 +38,34 @@ BlazeComponent.extendComponent({ Meteor.subscribe('unsaved-edits'); }, + voteState() { + const card = this.currentData(); + const userId = Meteor.userId() + let state + if (card.vote) { + if (card.vote.positive) { + state = _.contains(card.vote.positive, userId); + if (state === true) return true + } + if (card.vote.negative) { + state = _.contains(card.vote.negative, userId); + if (state === true) return false + } + } + return null + }, + voteCountPositive() { + const card = this.currentData(); + if (card.vote && card.vote.positive) + return card.vote.positive.length + return null + }, + voteCountNegative() { + const card = this.currentData(); + if (card.vote && card.vote.negative) + return card.vote.negative.length + return null + }, isWatching() { const card = this.currentData(); return card.findWatcher(Meteor.userId()); @@ -379,6 +407,18 @@ BlazeComponent.extendComponent({ 'click #toggleButton'() { Meteor.call('toggleSystemMessages'); }, + 'click .js-vote'(e) { + const forIt = $(e.target).hasClass('js-vote-positive') + let newState = null + if ( + this.voteState() == null || + this.voteState() == false && forIt || + this.voteState() == true && !forIt + ) { + newState = forIt + } + this.data().setVote(Meteor.userId(), newState) + } }, ]; }, @@ -560,6 +600,7 @@ Template.cardDetailsActionsPopup.events({ 'click .js-assignees': Popup.open('cardAssignees'), 'click .js-labels': Popup.open('cardLabels'), 'click .js-attachments': Popup.open('cardAttachments'), + 'click .js-start-voting': Popup.open('cardStartVoting'), 'click .js-custom-fields': Popup.open('cardCustomFields'), 'click .js-received-date': Popup.open('editCardReceivedDate'), 'click .js-start-date': Popup.open('editCardStartDate'), @@ -570,6 +611,11 @@ Template.cardDetailsActionsPopup.events({ 'click .js-copy-card': Popup.open('copyCard'), 'click .js-copy-checklist-cards': Popup.open('copyChecklistToManyCards'), 'click .js-set-card-color': Popup.open('setCardColor'), + 'click .js-cancel-voting'(event) { + event.preventDefault(); + this.unsetVote() + Popup.close(); + }, 'click .js-move-card-to-top'(event) { event.preventDefault(); const minOrder = _.min( @@ -603,7 +649,7 @@ Template.cardDetailsActionsPopup.events({ }, }); -Template.editCardTitleForm.onRendered(function() { +Template.editCardTitleForm.onRendered(function () { autosize(this.$('.js-edit-card-title')); }); @@ -617,7 +663,7 @@ Template.editCardTitleForm.events({ }, }); -Template.editCardRequesterForm.onRendered(function() { +Template.editCardRequesterForm.onRendered(function () { autosize(this.$('.js-edit-card-requester')); }); @@ -630,7 +676,7 @@ Template.editCardRequesterForm.events({ }, }); -Template.editCardAssignerForm.onRendered(function() { +Template.editCardAssignerForm.onRendered(function () { autosize(this.$('.js-edit-card-assigner')); }); @@ -770,7 +816,7 @@ Template.copyChecklistToManyCardsPopup.events({ // copy subtasks cursor = Cards.find({ parentId: oldId }); - cursor.forEach(function() { + cursor.forEach(function () { 'use strict'; const subtask = arguments[0]; subtask.parentId = _id; @@ -919,7 +965,7 @@ BlazeComponent.extendComponent({ } } }, - 'click .js-delete': Popup.afterConfirm('cardDelete', function() { + 'click .js-delete': Popup.afterConfirm('cardDelete', function () { Popup.close(); Cards.remove(this._id); Utils.goBoardId(this.boardId); @@ -945,6 +991,27 @@ BlazeComponent.extendComponent({ }, }).register('cardMorePopup'); +BlazeComponent.extendComponent({ + onCreated() { + this.currentCard = this.currentData(); + this.voteQuestion = new ReactiveVar(this.currentCard.voteQuestion); + }, + + events() { + return [ + { + 'submit .edit-vote-question'(evt) { + evt.preventDefault(); + const voteQuestion = evt.target.vote.value; + this.currentCard.setVoteQuestion(voteQuestion) + Popup.close(); + + }, + }, + ]; + }, +}).register('cardStartVotingPopup'); + // Close the card details pane by pressing escape EscapeActions.register( 'detailsPane', -- cgit v1.2.3-1-g7c22 From 5ebb47cb0ec7272894a37d99579ede872251f55c Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Wed, 8 Apr 2020 23:16:48 +0300 Subject: Add setting default NOTIFICATION_TRAY_AFTER_READ_DAYS_BEFORE_REMOVE=2 to all Wekan platforms https://github.com/wekan/wekan/pull/2998 Thanks to xet7 ! --- client/components/cards/cardDetails.js | 49 ++++++++++++++++------------------ 1 file changed, 23 insertions(+), 26 deletions(-) (limited to 'client/components/cards/cardDetails.js') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 8492393c..84ba21b1 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -40,31 +40,29 @@ BlazeComponent.extendComponent({ voteState() { const card = this.currentData(); - const userId = Meteor.userId() - let state + const userId = Meteor.userId(); + let state; if (card.vote) { if (card.vote.positive) { state = _.contains(card.vote.positive, userId); - if (state === true) return true + if (state === true) return true; } if (card.vote.negative) { state = _.contains(card.vote.negative, userId); - if (state === true) return false + if (state === true) return false; } } - return null + return null; }, voteCountPositive() { const card = this.currentData(); - if (card.vote && card.vote.positive) - return card.vote.positive.length - return null + if (card.vote && card.vote.positive) return card.vote.positive.length; + return null; }, voteCountNegative() { const card = this.currentData(); - if (card.vote && card.vote.negative) - return card.vote.negative.length - return null + if (card.vote && card.vote.negative) return card.vote.negative.length; + return null; }, isWatching() { const card = this.currentData(); @@ -408,17 +406,17 @@ BlazeComponent.extendComponent({ Meteor.call('toggleSystemMessages'); }, 'click .js-vote'(e) { - const forIt = $(e.target).hasClass('js-vote-positive') - let newState = null + const forIt = $(e.target).hasClass('js-vote-positive'); + let newState = null; if ( this.voteState() == null || - this.voteState() == false && forIt || - this.voteState() == true && !forIt + (this.voteState() == false && forIt) || + (this.voteState() == true && !forIt) ) { - newState = forIt + newState = forIt; } - this.data().setVote(Meteor.userId(), newState) - } + this.data().setVote(Meteor.userId(), newState); + }, }, ]; }, @@ -613,7 +611,7 @@ Template.cardDetailsActionsPopup.events({ 'click .js-set-card-color': Popup.open('setCardColor'), 'click .js-cancel-voting'(event) { event.preventDefault(); - this.unsetVote() + this.unsetVote(); Popup.close(); }, 'click .js-move-card-to-top'(event) { @@ -649,7 +647,7 @@ Template.cardDetailsActionsPopup.events({ }, }); -Template.editCardTitleForm.onRendered(function () { +Template.editCardTitleForm.onRendered(function() { autosize(this.$('.js-edit-card-title')); }); @@ -663,7 +661,7 @@ Template.editCardTitleForm.events({ }, }); -Template.editCardRequesterForm.onRendered(function () { +Template.editCardRequesterForm.onRendered(function() { autosize(this.$('.js-edit-card-requester')); }); @@ -676,7 +674,7 @@ Template.editCardRequesterForm.events({ }, }); -Template.editCardAssignerForm.onRendered(function () { +Template.editCardAssignerForm.onRendered(function() { autosize(this.$('.js-edit-card-assigner')); }); @@ -816,7 +814,7 @@ Template.copyChecklistToManyCardsPopup.events({ // copy subtasks cursor = Cards.find({ parentId: oldId }); - cursor.forEach(function () { + cursor.forEach(function() { 'use strict'; const subtask = arguments[0]; subtask.parentId = _id; @@ -965,7 +963,7 @@ BlazeComponent.extendComponent({ } } }, - 'click .js-delete': Popup.afterConfirm('cardDelete', function () { + 'click .js-delete': Popup.afterConfirm('cardDelete', function() { Popup.close(); Cards.remove(this._id); Utils.goBoardId(this.boardId); @@ -1003,9 +1001,8 @@ BlazeComponent.extendComponent({ 'submit .edit-vote-question'(evt) { evt.preventDefault(); const voteQuestion = evt.target.vote.value; - this.currentCard.setVoteQuestion(voteQuestion) + this.currentCard.setVoteQuestion(voteQuestion); Popup.close(); - }, }, ]; -- cgit v1.2.3-1-g7c22 From 8f28a409c7dd90319f785e3fc4c1b26803f67f31 Mon Sep 17 00:00:00 2001 From: Nico Date: Fri, 10 Apr 2020 01:46:36 +0200 Subject: Public vote --- client/components/cards/cardDetails.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'client/components/cards/cardDetails.js') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 84ba21b1..6ca5d784 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -54,6 +54,12 @@ BlazeComponent.extendComponent({ } return null; }, + votePublic() { + const card = this.currentData(); + if (card.vote) + return card.vote.public + return null + }, voteCountPositive() { const card = this.currentData(); if (card.vote && card.vote.positive) return card.vote.positive.length; @@ -382,6 +388,8 @@ BlazeComponent.extendComponent({ 'click .js-start-date': Popup.open('editCardStartDate'), 'click .js-due-date': Popup.open('editCardDueDate'), 'click .js-end-date': Popup.open('editCardEndDate'), + 'click .js-show-positive-votes':Popup.open('positiveVoteMembers'), + 'click .js-show-negative-votes': Popup.open('negativeVoteMembers'), 'mouseenter .js-card-details'() { const parentComponent = this.parentComponent().parentComponent(); //on mobile view parent is Board, not BoardBody. @@ -647,7 +655,7 @@ Template.cardDetailsActionsPopup.events({ }, }); -Template.editCardTitleForm.onRendered(function() { +Template.editCardTitleForm.onRendered(function () { autosize(this.$('.js-edit-card-title')); }); @@ -661,7 +669,7 @@ Template.editCardTitleForm.events({ }, }); -Template.editCardRequesterForm.onRendered(function() { +Template.editCardRequesterForm.onRendered(function () { autosize(this.$('.js-edit-card-requester')); }); @@ -674,7 +682,7 @@ Template.editCardRequesterForm.events({ }, }); -Template.editCardAssignerForm.onRendered(function() { +Template.editCardAssignerForm.onRendered(function () { autosize(this.$('.js-edit-card-assigner')); }); @@ -814,7 +822,7 @@ Template.copyChecklistToManyCardsPopup.events({ // copy subtasks cursor = Cards.find({ parentId: oldId }); - cursor.forEach(function() { + cursor.forEach(function () { 'use strict'; const subtask = arguments[0]; subtask.parentId = _id; @@ -963,7 +971,7 @@ BlazeComponent.extendComponent({ } } }, - 'click .js-delete': Popup.afterConfirm('cardDelete', function() { + 'click .js-delete': Popup.afterConfirm('cardDelete', function () { Popup.close(); Cards.remove(this._id); Utils.goBoardId(this.boardId); @@ -1001,9 +1009,14 @@ BlazeComponent.extendComponent({ 'submit .edit-vote-question'(evt) { evt.preventDefault(); const voteQuestion = evt.target.vote.value; - this.currentCard.setVoteQuestion(voteQuestion); + const publicVote = $('#vote-public').hasClass('is-checked'); + this.currentCard.setVoteQuestion(voteQuestion, publicVote); Popup.close(); }, + 'click a.js-toggle-vote-public'(event) { + event.preventDefault(); + $('#vote-public').toggleClass('is-checked'); + }, }, ]; }, -- cgit v1.2.3-1-g7c22 From f583645744be50cba72a3e80ba2d916abb84eaba Mon Sep 17 00:00:00 2001 From: boeserwolf Date: Sun, 19 Apr 2020 10:31:40 +0300 Subject: Make linked card clickable --- client/components/cards/cardDetails.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'client/components/cards/cardDetails.js') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 6ca5d784..9d31fc60 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -379,6 +379,9 @@ BlazeComponent.extendComponent({ this.data().setRequestedBy(''); } }, + 'click .js-go-to-linked-card'() { + Utils.goCardId(this.data().linkedId) + }, 'click .js-member': Popup.open('cardMember'), 'click .js-add-members': Popup.open('cardMembers'), 'click .js-assignee': Popup.open('cardAssignee'), -- 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/cards/cardDetails.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'client/components/cards/cardDetails.js') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 9d31fc60..ce504146 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -727,7 +727,7 @@ BlazeComponent.extendComponent({ _id: { $ne: Meteor.user().getTemplatesBoardId() }, }, { - sort: ['title'], + sort: { sort: 1 /* boards default sorting */ }, }, ); return boards; @@ -903,7 +903,7 @@ BlazeComponent.extendComponent({ }, }, { - sort: ['title'], + sort: { sort: 1 /* boards default sorting */ }, }, ); return boards; @@ -974,7 +974,7 @@ BlazeComponent.extendComponent({ } } }, - 'click .js-delete': Popup.afterConfirm('cardDelete', function () { + 'click .js-delete': Popup.afterConfirm('cardDelete', function() { Popup.close(); Cards.remove(this._id); Utils.goBoardId(this.boardId); -- 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/cards/cardDetails.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'client/components/cards/cardDetails.js') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index ce504146..a578ba7c 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -420,9 +420,9 @@ BlazeComponent.extendComponent({ const forIt = $(e.target).hasClass('js-vote-positive'); let newState = null; if ( - this.voteState() == null || - (this.voteState() == false && forIt) || - (this.voteState() == true && !forIt) + this.voteState() === null || + (this.voteState() === false && forIt) || + (this.voteState() === true && !forIt) ) { newState = forIt; } -- 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/cards/cardDetails.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'client/components/cards/cardDetails.js') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index a578ba7c..b958d5bf 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -56,9 +56,8 @@ BlazeComponent.extendComponent({ }, votePublic() { const card = this.currentData(); - if (card.vote) - return card.vote.public - return null + if (card.vote) return card.vote.public; + return null; }, voteCountPositive() { const card = this.currentData(); @@ -380,7 +379,7 @@ BlazeComponent.extendComponent({ } }, 'click .js-go-to-linked-card'() { - Utils.goCardId(this.data().linkedId) + Utils.goCardId(this.data().linkedId); }, 'click .js-member': Popup.open('cardMember'), 'click .js-add-members': Popup.open('cardMembers'), @@ -391,7 +390,7 @@ BlazeComponent.extendComponent({ 'click .js-start-date': Popup.open('editCardStartDate'), 'click .js-due-date': Popup.open('editCardDueDate'), 'click .js-end-date': Popup.open('editCardEndDate'), - 'click .js-show-positive-votes':Popup.open('positiveVoteMembers'), + 'click .js-show-positive-votes': Popup.open('positiveVoteMembers'), 'click .js-show-negative-votes': Popup.open('negativeVoteMembers'), 'mouseenter .js-card-details'() { const parentComponent = this.parentComponent().parentComponent(); @@ -658,7 +657,7 @@ Template.cardDetailsActionsPopup.events({ }, }); -Template.editCardTitleForm.onRendered(function () { +Template.editCardTitleForm.onRendered(function() { autosize(this.$('.js-edit-card-title')); }); @@ -672,7 +671,7 @@ Template.editCardTitleForm.events({ }, }); -Template.editCardRequesterForm.onRendered(function () { +Template.editCardRequesterForm.onRendered(function() { autosize(this.$('.js-edit-card-requester')); }); @@ -685,7 +684,7 @@ Template.editCardRequesterForm.events({ }, }); -Template.editCardAssignerForm.onRendered(function () { +Template.editCardAssignerForm.onRendered(function() { autosize(this.$('.js-edit-card-assigner')); }); @@ -825,7 +824,7 @@ Template.copyChecklistToManyCardsPopup.events({ // copy subtasks cursor = Cards.find({ parentId: oldId }); - cursor.forEach(function () { + cursor.forEach(function() { 'use strict'; const subtask = arguments[0]; subtask.parentId = _id; -- cgit v1.2.3-1-g7c22 From 981ed546f1cae45ad8b92b393ee29c1a26277f32 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Thu, 23 Apr 2020 00:54:39 +0200 Subject: Newer versions of jQuery sortable use `uiSortable` key Newer versions of jQuery sortable use `uiSortable` as key to store the data. Let's adapt the code. While at it, refactor the code. --- client/components/cards/cardDetails.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'client/components/cards/cardDetails.js') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index b958d5bf..8fc3c12a 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -278,17 +278,12 @@ BlazeComponent.extendComponent({ // Disable sorting if the current user is not a board member this.autorun(() => { - if ($checklistsDom.data('sortable')) { - $checklistsDom.sortable('option', 'disabled', !userIsMember()); + const disabled = !userIsMember() || Utils.isMiniScreen(); + if ($checklistsDom.data('uiSortable')) { + $checklistsDom.sortable('option', 'disabled', disabled); } - if ($subtasksDom.data('sortable')) { - $subtasksDom.sortable('option', 'disabled', !userIsMember()); - } - if ($checklistsDom.data('sortable')) { - $checklistsDom.sortable('option', 'disabled', Utils.isMiniScreen()); - } - if ($subtasksDom.data('sortable')) { - $subtasksDom.sortable('option', 'disabled', Utils.isMiniScreen()); + if ($subtasksDom.data('uiSortable')) { + $subtasksDom.sortable('option', 'disabled', disabled); } }); }, -- cgit v1.2.3-1-g7c22 From 6d1cdebfe214c7f67f8cc396cf880d1b5a18f013 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Sat, 25 Apr 2020 09:48:56 +0200 Subject: Make it compatible with newer and older versions of jQuery sortable While at it, fix comments and prettify it. --- client/components/cards/cardDetails.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'client/components/cards/cardDetails.js') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 8fc3c12a..90014f7d 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -279,10 +279,10 @@ BlazeComponent.extendComponent({ // Disable sorting if the current user is not a board member this.autorun(() => { const disabled = !userIsMember() || Utils.isMiniScreen(); - if ($checklistsDom.data('uiSortable')) { + if ($checklistsDom.data('uiSortable') || $checklistsDom.data('sortable')) { $checklistsDom.sortable('option', 'disabled', disabled); } - if ($subtasksDom.data('uiSortable')) { + if ($subtasksDom.data('uiSortable') || $subtasksDom.data('sortable')) { $subtasksDom.sortable('option', 'disabled', disabled); } }); -- 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/cards/cardDetails.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'client/components/cards/cardDetails.js') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 90014f7d..f31c3890 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -1,5 +1,5 @@ const subManager = new SubsManager(); -const { calculateIndexData, enableClickOnTouch } = Utils; +const { calculateIndexData } = Utils; let cardColors; Meteor.startup(() => { @@ -231,9 +231,6 @@ BlazeComponent.extendComponent({ }, }); - // ugly touch event hotfix - enableClickOnTouch('.card-checklist-items .js-checklist'); - const $subtasksDom = this.$('.card-subtasks-items'); $subtasksDom.sortable({ @@ -269,9 +266,6 @@ BlazeComponent.extendComponent({ }, }); - // ugly touch event hotfix - enableClickOnTouch('.card-subtasks-items .js-subtasks'); - function userIsMember() { return Meteor.user() && Meteor.user().isBoardMember(); } -- cgit v1.2.3-1-g7c22 From 7bb0aa74884d026bb6a0192bd2c4d0fb43f2953b Mon Sep 17 00:00:00 2001 From: Nico Date: Sun, 26 Apr 2020 02:41:26 +0200 Subject: Additional vote features --- client/components/cards/cardDetails.js | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'client/components/cards/cardDetails.js') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index f31c3890..b8c7fa3f 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -54,21 +54,7 @@ BlazeComponent.extendComponent({ } return null; }, - votePublic() { - const card = this.currentData(); - if (card.vote) return card.vote.public; - return null; - }, - voteCountPositive() { - const card = this.currentData(); - if (card.vote && card.vote.positive) return card.vote.positive.length; - return null; - }, - voteCountNegative() { - const card = this.currentData(); - if (card.vote && card.vote.negative) return card.vote.negative.length; - return null; - }, + isWatching() { const card = this.currentData(); return card.findWatcher(Meteor.userId()); @@ -1001,13 +987,18 @@ BlazeComponent.extendComponent({ evt.preventDefault(); const voteQuestion = evt.target.vote.value; const publicVote = $('#vote-public').hasClass('is-checked'); - this.currentCard.setVoteQuestion(voteQuestion, publicVote); + const allowNonBoardMembers = $('#vote-allow-non-members').hasClass('is-checked'); + this.currentCard.setVoteQuestion(voteQuestion, publicVote,allowNonBoardMembers); Popup.close(); }, 'click a.js-toggle-vote-public'(event) { event.preventDefault(); $('#vote-public').toggleClass('is-checked'); }, + 'click a.js-toggle-vote-allow-non-members'(event) { + event.preventDefault(); + $('#vote-allow-non-members').toggleClass('is-checked'); + }, }, ]; }, -- cgit v1.2.3-1-g7c22 From ee106d1cb41b8e7b4ae757936f0f46688325f685 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Mon, 27 Apr 2020 02:54:40 +0300 Subject: Revert In Progress additional vote features. Translations are not removed. Thanks to xet7 ! Related https://github.com/wekan/wekan/pull/3048 --- client/components/cards/cardDetails.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'client/components/cards/cardDetails.js') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index b8c7fa3f..f31c3890 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -54,7 +54,21 @@ BlazeComponent.extendComponent({ } return null; }, - + votePublic() { + const card = this.currentData(); + if (card.vote) return card.vote.public; + return null; + }, + voteCountPositive() { + const card = this.currentData(); + if (card.vote && card.vote.positive) return card.vote.positive.length; + return null; + }, + voteCountNegative() { + const card = this.currentData(); + if (card.vote && card.vote.negative) return card.vote.negative.length; + return null; + }, isWatching() { const card = this.currentData(); return card.findWatcher(Meteor.userId()); @@ -987,18 +1001,13 @@ BlazeComponent.extendComponent({ evt.preventDefault(); const voteQuestion = evt.target.vote.value; const publicVote = $('#vote-public').hasClass('is-checked'); - const allowNonBoardMembers = $('#vote-allow-non-members').hasClass('is-checked'); - this.currentCard.setVoteQuestion(voteQuestion, publicVote,allowNonBoardMembers); + this.currentCard.setVoteQuestion(voteQuestion, publicVote); Popup.close(); }, 'click a.js-toggle-vote-public'(event) { event.preventDefault(); $('#vote-public').toggleClass('is-checked'); }, - 'click a.js-toggle-vote-allow-non-members'(event) { - event.preventDefault(); - $('#vote-allow-non-members').toggleClass('is-checked'); - }, }, ]; }, -- cgit v1.2.3-1-g7c22 From 09666585e22a1250416ec95c1ebb2748e2941d4d Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Mon, 27 Apr 2020 02:56:11 +0300 Subject: Revert part 2, related https://github.com/wekan/wekan/pull/3048 --- client/components/cards/cardDetails.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'client/components/cards/cardDetails.js') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index f31c3890..271fbe2f 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -273,7 +273,10 @@ BlazeComponent.extendComponent({ // Disable sorting if the current user is not a board member this.autorun(() => { const disabled = !userIsMember() || Utils.isMiniScreen(); - if ($checklistsDom.data('uiSortable') || $checklistsDom.data('sortable')) { + if ( + $checklistsDom.data('uiSortable') || + $checklistsDom.data('sortable') + ) { $checklistsDom.sortable('option', 'disabled', disabled); } if ($subtasksDom.data('uiSortable') || $subtasksDom.data('sortable')) { -- cgit v1.2.3-1-g7c22