mirror of
https://github.com/wekan/wekan.git
synced 2025-04-23 21:47:10 -04:00
comment only working, naive implementation complete
This commit is contained in:
parent
ec9498fa62
commit
de10be6a21
13 changed files with 64 additions and 18 deletions
|
@ -65,7 +65,7 @@ template(name="boardHeaderBar")
|
|||
if $eq watchLevel "muted"
|
||||
i.fa.fa-bell-slash
|
||||
span {{_ watchLevel}}
|
||||
|
||||
|
||||
else
|
||||
a.board-header-btn.js-log-in(
|
||||
title="{{_ 'log-in'}}")
|
||||
|
@ -81,7 +81,7 @@ template(name="boardHeaderBar")
|
|||
a.board-header-btn-close.js-filter-reset(title="{{_ 'filter-clear'}}")
|
||||
i.fa.fa-times-thin
|
||||
|
||||
if currentUser.isBoardMember
|
||||
if canModifyBoard
|
||||
a.board-header-btn.js-multiselection-activate(
|
||||
title="{{#if MultiSelection.isActive}}{{_ 'multi-selection-on'}}{{else}}{{_ 'multi-selection'}}{{/if}}"
|
||||
class="{{#if MultiSelection.isActive}}emphasis{{/if}}")
|
||||
|
|
|
@ -97,6 +97,12 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
}).register('boardHeaderBar');
|
||||
|
||||
Template.boardHeaderBar.helpers({
|
||||
canModifyBoard() {
|
||||
return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
|
||||
},
|
||||
});
|
||||
|
||||
BlazeComponent.extendComponent({
|
||||
backgroundColors() {
|
||||
return Boards.simpleSchema()._schema.color.allowedValues;
|
||||
|
|
|
@ -15,6 +15,12 @@ template(name="editCardDate")
|
|||
button.js-delete-date.negate.wide.right.js-delete-date {{_ 'delete'}}
|
||||
|
||||
template(name="dateBadge")
|
||||
a.js-edit-date.card-date(title="{{showTitle}}" class="{{classes}}")
|
||||
time(datetime="{{showISODate}}")
|
||||
| {{showDate}}
|
||||
if canModifyCard
|
||||
a.js-edit-date.card-date(title="{{showTitle}}" class="{{classes}}")
|
||||
time(datetime="{{showISODate}}")
|
||||
| {{showDate}}
|
||||
else
|
||||
a.card-date(title="{{showTitle}}" class="{{classes}}")
|
||||
time(datetime="{{showISODate}}")
|
||||
| {{showDate}}
|
||||
|
||||
|
|
|
@ -86,6 +86,12 @@ const EditCardDate = BlazeComponent.extendComponent({
|
|||
},
|
||||
});
|
||||
|
||||
Template.dateBadge.helpers({
|
||||
canModifyCard() {
|
||||
return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
|
||||
},
|
||||
});
|
||||
|
||||
// editCardStartDatePopup
|
||||
(class extends EditCardDate {
|
||||
onCreated() {
|
||||
|
|
|
@ -28,7 +28,7 @@ template(name="cardDetails")
|
|||
|
||||
.card-details-item.card-details-item-labels
|
||||
h3.card-details-item-title {{_ 'labels'}}
|
||||
a(class="{{#if currentUser.isBoardMember}}js-add-labels{{else}}is-disabled{{/if}}" title="{{_ 'card-labels-title'}}")
|
||||
a(class="{{#if canModifyCard}}js-add-labels{{else}}is-disabled{{/if}}" title="{{_ 'card-labels-title'}}")
|
||||
each labels
|
||||
span.card-label(class="card-label-{{color}}" title=name)= name
|
||||
if canModifyCard
|
||||
|
|
|
@ -144,6 +144,10 @@ Template.cardDetailsActionsPopup.helpers({
|
|||
isWatching() {
|
||||
return this.findWatcher(Meteor.userId());
|
||||
},
|
||||
|
||||
canModifyCard() {
|
||||
return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
|
||||
},
|
||||
});
|
||||
|
||||
Template.cardDetailsActionsPopup.events({
|
||||
|
|
|
@ -17,9 +17,13 @@ template(name="checklistDetail")
|
|||
else
|
||||
.checklist-title
|
||||
.checkbox.fa.fa-check-square-o
|
||||
a.js-delete-checklist {{_ "delete"}}...
|
||||
if canModifyCard
|
||||
a.js-delete-checklist {{_ "delete"}}...
|
||||
span.checklist-stat(class="{{#if checklist.isFinished}}is-finished{{/if}}") {{checklist.finishedCount}}/{{checklist.itemCount}}
|
||||
h2.title.js-open-inlined-form.is-editable {{checklist.title}}
|
||||
if canModifyCard
|
||||
h2.title.js-open-inlined-form.is-editable {{checklist.title}}
|
||||
else
|
||||
h2.title {{checklist.title}}
|
||||
+checklistItems(checklist = checklist)
|
||||
|
||||
template(name="addChecklistItemForm")
|
||||
|
@ -38,7 +42,7 @@ template(name="editChecklistItemForm")
|
|||
button.primary.confirm.js-submit-edit-checklist-item-form(type="submit") {{_ 'save'}}
|
||||
a.fa.fa-times-thin.js-close-inlined-form
|
||||
span(title=createdAt) {{ moment createdAt }}
|
||||
if currentUser.isBoardMember
|
||||
if canModifyCard
|
||||
a.js-delete-checklist-item {{_ "delete"}}...
|
||||
|
||||
template(name="checklistItems")
|
||||
|
@ -48,7 +52,7 @@ template(name="checklistItems")
|
|||
+editChecklistItemForm(type = 'item' item = item checklist = checklist)
|
||||
else
|
||||
+itemDetail(item = item checklist = checklist)
|
||||
if currentUser.isBoardMember
|
||||
if canModifyCard
|
||||
+inlinedForm(classNames="js-add-checklist-item" checklist = checklist)
|
||||
+addChecklistItemForm
|
||||
else
|
||||
|
@ -58,5 +62,10 @@ template(name="checklistItems")
|
|||
|
||||
template(name='itemDetail')
|
||||
.item
|
||||
.check-box.materialCheckBox(class="{{#if item.isFinished }}is-checked{{/if}}")
|
||||
.item-title.js-open-inlined-form.is-editable(class="{{#if item.isFinished }}is-checked{{/if}}") {{item.title}}
|
||||
if canModifyCard
|
||||
.check-box.materialCheckBox(class="{{#if item.isFinished }}is-checked{{/if}}")
|
||||
.item-title.js-open-inlined-form.is-editable(class="{{#if item.isFinished }}is-checked{{/if}}") {{item.title}}
|
||||
else
|
||||
.materialCheckBox(class="{{#if item.isFinished }}is-checked{{/if}}")
|
||||
.item-title(class="{{#if item.isFinished }}is-checked{{/if}}") {{item.title}}
|
||||
|
||||
|
|
|
@ -77,6 +77,12 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
}).register('checklists');
|
||||
|
||||
Template.itemDetail.helpers({
|
||||
canModifyCard() {
|
||||
return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
|
||||
},
|
||||
});
|
||||
|
||||
BlazeComponent.extendComponent({
|
||||
toggleItem() {
|
||||
const checklist = this.currentData().checklist;
|
||||
|
|
|
@ -79,10 +79,10 @@ BlazeComponent.extendComponent({
|
|||
});
|
||||
|
||||
function userIsMember() {
|
||||
return Meteor.user() && Meteor.user().isBoardMember();
|
||||
return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly();
|
||||
}
|
||||
|
||||
// Disable drag-dropping if the current user is not a board member
|
||||
// Disable drag-dropping if the current user is not a board member or is comment only
|
||||
this.autorun(() => {
|
||||
$cards.sortable('option', 'disabled', !userIsMember());
|
||||
});
|
||||
|
|
|
@ -60,7 +60,7 @@ template(name="labelsWidget")
|
|||
.board-widget-content
|
||||
each currentBoard.labels
|
||||
a.card-label(class="card-label-{{color}}"
|
||||
class="{{#if currentUser.isBoardMember}}js-label{{/if}}")
|
||||
class="{{#if currentUser.isNotCommentOnly}}js-label{{/if}}")
|
||||
span.card-label-name= name
|
||||
if currentUser.isBoardAdmin
|
||||
a.card-label.add-label.js-add-label
|
||||
|
|
|
@ -46,13 +46,13 @@ Lists.attachSchema(new SimpleSchema({
|
|||
|
||||
Lists.allow({
|
||||
insert(userId, doc) {
|
||||
return allowIsBoardMember(userId, Boards.findOne(doc.boardId));
|
||||
return allowIsBoardMemberNonComment(userId, Boards.findOne(doc.boardId));
|
||||
},
|
||||
update(userId, doc) {
|
||||
return allowIsBoardMember(userId, Boards.findOne(doc.boardId));
|
||||
return allowIsBoardMemberNonComment(userId, Boards.findOne(doc.boardId));
|
||||
},
|
||||
remove(userId, doc) {
|
||||
return allowIsBoardMember(userId, Boards.findOne(doc.boardId));
|
||||
return allowIsBoardMemberNonComment(userId, Boards.findOne(doc.boardId));
|
||||
},
|
||||
fetch: ['boardId'],
|
||||
});
|
||||
|
|
|
@ -117,6 +117,11 @@ if (Meteor.isClient) {
|
|||
return board && board.hasMember(this._id);
|
||||
},
|
||||
|
||||
isNotCommentOnly() {
|
||||
const board = Boards.findOne(Session.get('currentBoard'));
|
||||
return board && board.hasMember(this._id) && !board.hasCommentOnly(this._id);
|
||||
},
|
||||
|
||||
isCommentOnly() {
|
||||
const board = Boards.findOne(Session.get('currentBoard'));
|
||||
return board && board.hasCommentOnly(this._id);
|
||||
|
|
|
@ -6,6 +6,10 @@ allowIsBoardMember = function(userId, board) {
|
|||
return board && board.hasMember(userId);
|
||||
};
|
||||
|
||||
allowIsBoardMemberNonComment = function(userId, board) {
|
||||
return board && board.hasMember(userId) && !board.hasCommentOnly(userId);
|
||||
};
|
||||
|
||||
allowIsBoardMemberByCard = function(userId, card) {
|
||||
const board = card.board();
|
||||
return board && board.hasMember(userId);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue