summaryrefslogtreecommitdiffstats
path: root/client/components/lists/listHeader.js
diff options
context:
space:
mode:
author蔡仲明 (Romulus Urakagi Tsai) <urakagi@gmail.com>2019-11-21 11:25:56 +0800
committerGitHub <noreply@github.com>2019-11-21 11:25:56 +0800
commit3e0bedd8c7a6dec97352212adb1cbde1ade44190 (patch)
tree651ff30d25ddb0416444370368d699e597c142d7 /client/components/lists/listHeader.js
parent9bbeb73db1cd0ce1caaaca8dfb14ea92131bbf9d (diff)
parent4f5de87cc4c2281bd576548693de7c94e6a988c6 (diff)
downloadwekan-3e0bedd8c7a6dec97352212adb1cbde1ade44190.tar.gz
wekan-3e0bedd8c7a6dec97352212adb1cbde1ade44190.tar.bz2
wekan-3e0bedd8c7a6dec97352212adb1cbde1ade44190.zip
Merge pull request #1 from wekan/master
Update master
Diffstat (limited to 'client/components/lists/listHeader.js')
-rw-r--r--client/components/lists/listHeader.js63
1 files changed, 51 insertions, 12 deletions
diff --git a/client/components/lists/listHeader.js b/client/components/lists/listHeader.js
index e8a82499..34322fa9 100644
--- a/client/components/lists/listHeader.js
+++ b/client/components/lists/listHeader.js
@@ -7,12 +7,26 @@ BlazeComponent.extendComponent({
canSeeAddCard() {
const list = Template.currentData();
return (
- !list.getWipLimit('enabled') ||
- list.getWipLimit('soft') ||
- !this.reachedWipLimit()
+ !list.getWipLimit('enabled')
+ || list.getWipLimit('soft')
+ || !this.reachedWipLimit()
);
},
+ isBoardAdmin() {
+ return Meteor.user().isBoardAdmin();
+ },
+ starred(check = undefined) {
+ const list = Template.currentData();
+ const status = list.isStarred();
+ if (check === undefined) {
+ // just check
+ return status;
+ } else {
+ list.star(!status);
+ return !status;
+ }
+ },
editTitle(event) {
event.preventDefault();
const newTitle = this.childComponents('inlinedForm')[0]
@@ -30,14 +44,18 @@ BlazeComponent.extendComponent({
},
limitToShowCardsCount() {
- return Meteor.user().getLimitToShowCardsCount();
+ const currentUser = Meteor.user();
+ if (currentUser) {
+ return Meteor.user().getLimitToShowCardsCount();
+ } else {
+ return false;
+ }
},
cardsCount() {
const list = Template.currentData();
let swimlaneId = '';
- const boardView = (Meteor.user().profile || {}).boardView;
- if (boardView === 'board-view-swimlanes')
+ if (Utils.boardView() === 'board-view-swimlanes')
swimlaneId = this.parentComponent()
.parentComponent()
.data()._id;
@@ -48,8 +66,8 @@ BlazeComponent.extendComponent({
reachedWipLimit() {
const list = Template.currentData();
return (
- list.getWipLimit('enabled') &&
- list.getWipLimit('value') <= list.cards().count()
+ list.getWipLimit('enabled')
+ && list.getWipLimit('value') <= list.cards().count()
);
},
@@ -61,6 +79,10 @@ BlazeComponent.extendComponent({
events() {
return [
{
+ 'click .js-list-star'(event) {
+ event.preventDefault();
+ this.starred(!this.starred());
+ },
'click .js-open-list-menu': Popup.open('listAction'),
'click .js-add-card'(event) {
const listDom = $(event.target).parents(
@@ -80,6 +102,23 @@ BlazeComponent.extendComponent({
},
}).register('listHeader');
+Template.listHeader.helpers({
+ showDesktopDragHandles() {
+ currentUser = Meteor.user();
+ if (currentUser) {
+ return (currentUser.profile || {}).showDesktopDragHandles;
+ } else {
+ import { Cookies } from 'meteor/ostrio:cookies';
+ const cookies = new Cookies();
+ if (cookies.has('showDesktopDragHandles')) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ },
+});
+
Template.listActionPopup.helpers({
isWipLimitEnabled() {
return Template.currentData().getWipLimit('enabled');
@@ -138,8 +177,8 @@ BlazeComponent.extendComponent({
const list = Template.currentData();
if (
- list.getWipLimit('soft') &&
- list.getWipLimit('value') < list.cards().count()
+ list.getWipLimit('soft')
+ && list.getWipLimit('value') < list.cards().count()
) {
list.setWipLimit(list.cards().count());
}
@@ -150,8 +189,8 @@ BlazeComponent.extendComponent({
const list = Template.currentData();
// Prevent user from using previously stored wipLimit.value if it is less than the current number of cards in the list
if (
- !list.getWipLimit('enabled') &&
- list.getWipLimit('value') < list.cards().count()
+ !list.getWipLimit('enabled')
+ && list.getWipLimit('value') < list.cards().count()
) {
list.setWipLimit(list.cards().count());
}