summaryrefslogtreecommitdiffstats
path: root/client/components/sidebar
diff options
context:
space:
mode:
authorRyan Helsing <ryanhelsing@gmail.com>2017-03-18 14:59:28 -0400
committerRyan Helsing <ryanhelsing@gmail.com>2017-03-18 14:59:28 -0400
commite6276271b1a49bb705ef8777150634c8704bdc9b (patch)
treefd9b8bee05ca464bc50cf76b8ca319700f345888 /client/components/sidebar
parent4a0474dfc3ce2dcb0c6de21163879d7cf3084a35 (diff)
downloadwekan-e6276271b1a49bb705ef8777150634c8704bdc9b.tar.gz
wekan-e6276271b1a49bb705ef8777150634c8704bdc9b.tar.bz2
wekan-e6276271b1a49bb705ef8777150634c8704bdc9b.zip
ability to store comment only, actual prevention next
Diffstat (limited to 'client/components/sidebar')
-rw-r--r--client/components/sidebar/sidebar.jade8
-rw-r--r--client/components/sidebar/sidebar.js28
2 files changed, 32 insertions, 4 deletions
diff --git a/client/components/sidebar/sidebar.jade b/client/components/sidebar/sidebar.jade
index 8e1fecaa..3894de5e 100644
--- a/client/components/sidebar/sidebar.jade
+++ b/client/components/sidebar/sidebar.jade
@@ -138,9 +138,15 @@ template(name="changePermissionsPopup")
li
a(class="{{#if isLastAdmin}}disabled{{else}}js-set-normal{{/if}}")
| {{_ 'normal'}}
- unless isAdmin
+ if isNormal
i.fa.fa-check
span.sub-name {{_ 'normal-desc'}}
+ li
+ a(class="{{#if isLastAdmin}}disabled{{else}}js-set-comment-only{{/if}}")
+ | {{_ 'comment-only'}}
+ if isCommentOnly
+ i.fa.fa-check
+ span.sub-name {{_ 'comment-only-desc'}}
if isLastAdmin
hr
p.quiet.bottom {{_ 'last-admin-desc'}}
diff --git a/client/components/sidebar/sidebar.js b/client/components/sidebar/sidebar.js
index f649b4ad..043662a2 100644
--- a/client/components/sidebar/sidebar.js
+++ b/client/components/sidebar/sidebar.js
@@ -121,7 +121,17 @@ Template.memberPopup.helpers({
},
memberType() {
const type = Users.findOne(this.userId).isBoardAdmin() ? 'admin' : 'normal';
- return TAPi18n.__(type).toLowerCase();
+ if(type == 'normal'){
+ const currentBoard = Boards.findOne(Session.get('currentBoard'));
+ const commentOnly = currentBoard.hasCommentOnly(this.userId)
+ if(commentOnly){
+ return TAPi18n.__('comment-only').toLowerCase();
+ } else {
+ return TAPi18n.__(type).toLowerCase();
+ }
+ } else {
+ return TAPi18n.__(type).toLowerCase();
+ }
},
isInvited() {
return Users.findOne(this.userId).isInvitedTo(Session.get('currentBoard'));
@@ -308,11 +318,13 @@ BlazeComponent.extendComponent({
}).register('addMemberPopup');
Template.changePermissionsPopup.events({
- 'click .js-set-admin, click .js-set-normal'(event) {
+ 'click .js-set-admin, click .js-set-normal, click .js-set-comment-only'(event) {
const currentBoard = Boards.findOne(Session.get('currentBoard'));
const memberId = this.userId;
const isAdmin = $(event.currentTarget).hasClass('js-set-admin');
- currentBoard.setMemberPermission(memberId, isAdmin);
+ const isCommentOnly = $(event.currentTarget).hasClass('js-set-comment-only');
+ console.log(isCommentOnly)
+ currentBoard.setMemberPermission(memberId, isAdmin, isCommentOnly);
Popup.back(1);
},
});
@@ -323,6 +335,16 @@ Template.changePermissionsPopup.helpers({
return currentBoard.hasAdmin(this.userId);
},
+ isNormal() {
+ const currentBoard = Boards.findOne(Session.get('currentBoard'));
+ return !currentBoard.hasAdmin(this.userId) && !currentBoard.hasCommentOnly(this.userId);
+ },
+
+ isCommentOnly() {
+ const currentBoard = Boards.findOne(Session.get('currentBoard'));
+ return !currentBoard.hasAdmin(this.userId) && currentBoard.hasCommentOnly(this.userId);
+ },
+
isLastAdmin() {
const currentBoard = Boards.findOne(Session.get('currentBoard'));
return currentBoard.hasAdmin(this.userId) && (currentBoard.activeAdmins() === 1);