Revert In Progress additional vote features. Translations are not removed.

Thanks to xet7 !

Related https://github.com/wekan/wekan/pull/3048
This commit is contained in:
Lauri Ojansivu 2020-04-27 02:54:40 +03:00
parent 8ef435c83e
commit ee106d1cb4
5 changed files with 37 additions and 61 deletions

View file

@ -212,8 +212,6 @@ template(name="cardDetails")
else else
.card-label.card-label-green {{ voteCountPositive }} .card-label.card-label-green {{ voteCountPositive }}
.card-label.card-label-red {{ voteCountNegative }} .card-label.card-label-red {{ voteCountNegative }}
unless ($and currentBoard.isPublic voteAllowNonBoardMembers )
.card-label.card-label-gray {{ voteCount }} {{_ 'r-of' }} {{ currentBoard.activeMembers.length }}
+viewer +viewer
= getVoteQuestion = getVoteQuestion
button.card-details-green.js-vote.js-vote-positive(class="{{#if voteState}}voted{{/if}}") {{_ 'vote-for-it'}} button.card-details-green.js-vote.js-vote-positive(class="{{#if voteState}}voted{{/if}}") {{_ 'vote-for-it'}}
@ -574,15 +572,12 @@ template(name="cardStartVotingPopup")
.fields .fields
label(for="vote") {{_ 'vote-question'}} label(for="vote") {{_ 'vote-question'}}
input.js-vote-field#vote(type="text" name="vote" value="{{card.getVoteQuestion}}" autofocus) input.js-vote-field#vote(type="text" name="vote" value="{{card.getVoteQuestion}}" autofocus)
.check-div label(for="vote-public") {{_ 'vote-public'}}
a.flex.js-toggle-vote-public a.js-toggle-vote-public
.materialCheckBox#vote-public(name="vote-public") .materialCheckBox#vote-public(name="vote-public")
span {{_ 'vote-public'}}
.check-div
a.flex.js-toggle-vote-allow-non-members
.materialCheckBox#vote-allow-non-members(name="vote-allow-non-members")
span {{_ 'allowNonBoardMembers'}}
button.primary.confirm.js-submit {{_ 'save'}} button.primary.confirm.js-submit {{_ 'save'}}
//- button.js-remove-color.negate.wide.right {{_ 'delete'}}
template(name="positiveVoteMembersPopup") template(name="positiveVoteMembersPopup")
ul.pop-over-list.js-card-member-list ul.pop-over-list.js-card-member-list

View file

@ -54,7 +54,21 @@ BlazeComponent.extendComponent({
} }
return null; 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() { isWatching() {
const card = this.currentData(); const card = this.currentData();
return card.findWatcher(Meteor.userId()); return card.findWatcher(Meteor.userId());
@ -987,18 +1001,13 @@ BlazeComponent.extendComponent({
evt.preventDefault(); evt.preventDefault();
const voteQuestion = evt.target.vote.value; const voteQuestion = evt.target.vote.value;
const publicVote = $('#vote-public').hasClass('is-checked'); const publicVote = $('#vote-public').hasClass('is-checked');
const allowNonBoardMembers = $('#vote-allow-non-members').hasClass('is-checked'); this.currentCard.setVoteQuestion(voteQuestion, publicVote);
this.currentCard.setVoteQuestion(voteQuestion, publicVote,allowNonBoardMembers);
Popup.close(); Popup.close();
}, },
'click a.js-toggle-vote-public'(event) { 'click a.js-toggle-vote-public'(event) {
event.preventDefault(); event.preventDefault();
$('#vote-public').toggleClass('is-checked'); $('#vote-public').toggleClass('is-checked');
}, },
'click a.js-toggle-vote-allow-non-members'(event) {
event.preventDefault();
$('#vote-allow-non-members').toggleClass('is-checked');
},
}, },
]; ];
}, },

View file

@ -4,10 +4,9 @@ template(name="editCardSpentTime")
.fields .fields
label(for="time") {{_ 'time'}} label(for="time") {{_ 'time'}}
input.js-time-field#time(type="number" step="0.01" name="time" value="{{card.getSpentTime}}" placeholder=timeFormat autofocus) input.js-time-field#time(type="number" step="0.01" name="time" value="{{card.getSpentTime}}" placeholder=timeFormat autofocus)
.check-div label(for="overtime") {{_ 'overtime'}}
a.flex.js-toggle-overtime a.js-toggle-overtime
.materialCheckBox#overtime(class="{{#if getIsOvertime}}is-checked{{/if}}" name="overtime") .materialCheckBox#overtime(class="{{#if getIsOvertime}}is-checked{{/if}}" name="overtime")
span {{_ 'overtime'}}
if error.get if error.get
.warning {{_ error.get}} .warning {{_ error.get}}

View file

@ -103,9 +103,7 @@ template(name="minicard")
if getVoteQuestion if getVoteQuestion
.badge.badge-state-image-only(title=getVoteQuestion) .badge.badge-state-image-only(title=getVoteQuestion)
span.badge-icon.fa.fa-thumbs-up span.badge-icon.fa.fa-thumbs-up
span.badge-text {{ voteCountPositive }}
span.badge-icon.fa.fa-thumbs-down span.badge-icon.fa.fa-thumbs-down
span.badge-text {{ voteCountNegative }}
if attachments.count if attachments.count
.badge .badge
span.badge-icon.fa.fa-paperclip span.badge-icon.fa.fa-paperclip

View file

@ -340,10 +340,6 @@ Cards.attachSchema(
type: Boolean, type: Boolean,
defaultValue: false, defaultValue: false,
}, },
'vote.allowNonBoardMembers': {
type: Boolean,
defaultValue: false,
},
}), }),
); );
@ -351,8 +347,8 @@ Cards.allow({
insert(userId, doc) { insert(userId, doc) {
return allowIsBoardMember(userId, Boards.findOne(doc.boardId)); return allowIsBoardMember(userId, Boards.findOne(doc.boardId));
}, },
update(userId, doc, fields) { update(userId, doc) {
return allowIsBoardMember(userId, Boards.findOne(doc.boardId)) || _.isEqual(fields, ['vote', 'modifiedAt', 'dateLastActivity']); return allowIsBoardMember(userId, Boards.findOne(doc.boardId));
}, },
remove(userId, doc) { remove(userId, doc) {
return allowIsBoardMember(userId, Boards.findOne(doc.boardId)); return allowIsBoardMember(userId, Boards.findOne(doc.boardId));
@ -736,7 +732,7 @@ Cards.helpers({
parentString(sep) { parentString(sep) {
return this.parentList() return this.parentList()
.map(function (elem) { .map(function(elem) {
return elem.title; return elem.title;
}) })
.join(sep); .join(sep);
@ -1156,26 +1152,6 @@ Cards.helpers({
isTemplateCard() { isTemplateCard() {
return this.type === 'template-card'; return this.type === 'template-card';
}, },
votePublic() {
if (this.vote) return this.vote.public;
return null;
},
voteAllowNonBoardMembers() {
if (this.vote) return this.vote.allowNonBoardMembers;
return null;
},
voteCountNegative() {
if (this.vote && this.vote.negative) return this.vote.negative.length;
return null;
},
voteCountPositive() {
if (this.vote && this.vote.positive) return this.vote.positive.length;
return null;
},
voteCount() {
return this.voteCountPositive() + this.voteCountNegative()
},
}); });
Cards.mutations({ Cards.mutations({
@ -1499,13 +1475,12 @@ Cards.mutations({
}, },
}; };
}, },
setVoteQuestion(question, public, allowNonBoardMembers) { setVoteQuestion(question, public) {
return { return {
$set: { $set: {
vote: { vote: {
question, question,
public, public,
allowNonBoardMembers,
positive: [], positive: [],
negative: [], negative: [],
}, },
@ -1954,7 +1929,7 @@ if (Meteor.isServer) {
}); });
//New activity for card moves //New activity for card moves
Cards.after.update(function (userId, doc, fieldNames) { Cards.after.update(function(userId, doc, fieldNames) {
const oldListId = this.previous.listId; const oldListId = this.previous.listId;
const oldSwimlaneId = this.previous.swimlaneId; const oldSwimlaneId = this.previous.swimlaneId;
const oldBoardId = this.previous.boardId; const oldBoardId = this.previous.boardId;
@ -2000,7 +1975,7 @@ if (Meteor.isServer) {
// change list modifiedAt, when user modified the key values in timingaction array, if it's endAt, put the modifiedAt of list back to one year ago for sorting purpose // change list modifiedAt, when user modified the key values in timingaction array, if it's endAt, put the modifiedAt of list back to one year ago for sorting purpose
const modifiedAt = new Date( const modifiedAt = new Date(
new Date(value).getTime() - new Date(value).getTime() -
(action === 'endAt' ? 365 * 24 * 3600 * 1e3 : 0), (action === 'endAt' ? 365 * 24 * 3600 * 1e3 : 0),
); // set it as 1 year before ); // set it as 1 year before
const boardId = list.boardId; const boardId = list.boardId;
Lists.direct.update( Lists.direct.update(
@ -2054,7 +2029,7 @@ if (Meteor.isServer) {
JsonRoutes.add( JsonRoutes.add(
'GET', 'GET',
'/api/boards/:boardId/swimlanes/:swimlaneId/cards', '/api/boards/:boardId/swimlanes/:swimlaneId/cards',
function (req, res) { function(req, res) {
const paramBoardId = req.params.boardId; const paramBoardId = req.params.boardId;
const paramSwimlaneId = req.params.swimlaneId; const paramSwimlaneId = req.params.swimlaneId;
Authentication.checkBoardAccess(req.userId, paramBoardId); Authentication.checkBoardAccess(req.userId, paramBoardId);
@ -2064,7 +2039,7 @@ if (Meteor.isServer) {
boardId: paramBoardId, boardId: paramBoardId,
swimlaneId: paramSwimlaneId, swimlaneId: paramSwimlaneId,
archived: false, archived: false,
}).map(function (doc) { }).map(function(doc) {
return { return {
_id: doc._id, _id: doc._id,
title: doc.title, title: doc.title,
@ -2088,7 +2063,7 @@ if (Meteor.isServer) {
* title: string, * title: string,
* description: string}] * description: string}]
*/ */
JsonRoutes.add('GET', '/api/boards/:boardId/lists/:listId/cards', function ( JsonRoutes.add('GET', '/api/boards/:boardId/lists/:listId/cards', function(
req, req,
res, res,
) { ) {
@ -2101,7 +2076,7 @@ if (Meteor.isServer) {
boardId: paramBoardId, boardId: paramBoardId,
listId: paramListId, listId: paramListId,
archived: false, archived: false,
}).map(function (doc) { }).map(function(doc) {
return { return {
_id: doc._id, _id: doc._id,
title: doc.title, title: doc.title,
@ -2123,7 +2098,7 @@ if (Meteor.isServer) {
JsonRoutes.add( JsonRoutes.add(
'GET', 'GET',
'/api/boards/:boardId/lists/:listId/cards/:cardId', '/api/boards/:boardId/lists/:listId/cards/:cardId',
function (req, res) { function(req, res) {
const paramBoardId = req.params.boardId; const paramBoardId = req.params.boardId;
const paramListId = req.params.listId; const paramListId = req.params.listId;
const paramCardId = req.params.cardId; const paramCardId = req.params.cardId;
@ -2155,7 +2130,7 @@ if (Meteor.isServer) {
* @param {string} [assignees] the array of maximum one ID of assignee of the new card * @param {string} [assignees] the array of maximum one ID of assignee of the new card
* @return_type {_id: string} * @return_type {_id: string}
*/ */
JsonRoutes.add('POST', '/api/boards/:boardId/lists/:listId/cards', function ( JsonRoutes.add('POST', '/api/boards/:boardId/lists/:listId/cards', function(
req, req,
res, res,
) { ) {
@ -2262,7 +2237,7 @@ if (Meteor.isServer) {
JsonRoutes.add( JsonRoutes.add(
'PUT', 'PUT',
'/api/boards/:boardId/lists/:listId/cards/:cardId', '/api/boards/:boardId/lists/:listId/cards/:cardId',
function (req, res) { function(req, res) {
Authentication.checkUserId(req.userId); Authentication.checkUserId(req.userId);
const paramBoardId = req.params.boardId; const paramBoardId = req.params.boardId;
const paramCardId = req.params.cardId; const paramCardId = req.params.cardId;
@ -2561,7 +2536,7 @@ if (Meteor.isServer) {
JsonRoutes.add( JsonRoutes.add(
'DELETE', 'DELETE',
'/api/boards/:boardId/lists/:listId/cards/:cardId', '/api/boards/:boardId/lists/:listId/cards/:cardId',
function (req, res) { function(req, res) {
Authentication.checkUserId(req.userId); Authentication.checkUserId(req.userId);
const paramBoardId = req.params.boardId; const paramBoardId = req.params.boardId;
const paramListId = req.params.listId; const paramListId = req.params.listId;