2019-01-25 15:56:40 +01:00
|
|
|
let listsColors;
|
|
|
|
Meteor.startup(() => {
|
|
|
|
listsColors = Lists.simpleSchema()._schema.color.allowedValues;
|
|
|
|
});
|
|
|
|
|
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
|
|
|
BlazeComponent.extendComponent({
|
2017-10-31 21:10:36 +00:00
|
|
|
canSeeAddCard() {
|
|
|
|
const list = Template.currentData();
|
2019-06-28 12:52:09 -05:00
|
|
|
return (
|
2020-01-05 21:28:14 +02:00
|
|
|
(!list.getWipLimit('enabled') ||
|
|
|
|
list.getWipLimit('soft') ||
|
|
|
|
!this.reachedWipLimit()) &&
|
|
|
|
!Meteor.user().isWorker()
|
2019-06-28 12:52:09 -05:00
|
|
|
);
|
|
|
|
},
|
|
|
|
|
2019-10-29 19:05:44 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
},
|
2019-06-28 12:52:09 -05:00
|
|
|
editTitle(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
const newTitle = this.childComponents('inlinedForm')[0]
|
|
|
|
.getValue()
|
|
|
|
.trim();
|
2017-06-02 19:18:31 +03:00
|
|
|
const list = this.currentData();
|
|
|
|
if (newTitle) {
|
|
|
|
list.rename(newTitle.trim());
|
|
|
|
}
|
2017-06-02 18:48:04 +03:00
|
|
|
},
|
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
|
|
|
|
2017-06-02 18:48:04 +03:00
|
|
|
isWatching() {
|
2017-06-02 19:18:31 +03:00
|
|
|
const list = this.currentData();
|
|
|
|
return list.findWatcher(Meteor.userId());
|
2017-06-02 18:48:04 +03:00
|
|
|
},
|
2016-01-05 23:26:02 +08:00
|
|
|
|
2017-06-02 18:48:04 +03:00
|
|
|
limitToShowCardsCount() {
|
New feature: Now there is popup selection of Lists/Swimlanes/Calendar/Roles.
New feature, not set visible yet, because switching to it does not
work properly yet: Collapsible Swimlanes #2804
Fix: Public board now loads correctly. When you select one of Lists/Swimlanes/Calendar view and
reload webbrowser page, it can change view. Closes #2311
Fix: List sorting commented out. Closes #2800
Fix: Errors hasHiddenMinicardText, hasShowDragHandles, showSort, hasSortBy, profile,
FirefoxAndroid/IE11/Vivaldi/Chromium browsers not working by using
cookies instead of database.
More details at https://github.com/wekan/wekan/issues/2643#issuecomment-554907955
Note: Cookie changes are not always immediate, if there is no effect,
you may need to reload webbrowser page.
Closes #2643 .
Thanks to xet7 !
2019-11-18 22:23:49 +02:00
|
|
|
const currentUser = Meteor.user();
|
|
|
|
if (currentUser) {
|
|
|
|
return Meteor.user().getLimitToShowCardsCount();
|
2019-11-20 21:10:11 +02:00
|
|
|
} else {
|
|
|
|
return false;
|
New feature: Now there is popup selection of Lists/Swimlanes/Calendar/Roles.
New feature, not set visible yet, because switching to it does not
work properly yet: Collapsible Swimlanes #2804
Fix: Public board now loads correctly. When you select one of Lists/Swimlanes/Calendar view and
reload webbrowser page, it can change view. Closes #2311
Fix: List sorting commented out. Closes #2800
Fix: Errors hasHiddenMinicardText, hasShowDragHandles, showSort, hasSortBy, profile,
FirefoxAndroid/IE11/Vivaldi/Chromium browsers not working by using
cookies instead of database.
More details at https://github.com/wekan/wekan/issues/2643#issuecomment-554907955
Note: Cookie changes are not always immediate, if there is no effect,
you may need to reload webbrowser page.
Closes #2643 .
Thanks to xet7 !
2019-11-18 22:23:49 +02:00
|
|
|
}
|
2017-06-02 18:48:04 +03:00
|
|
|
},
|
2016-11-25 21:45:11 +01:00
|
|
|
|
2018-07-26 15:50:51 +02:00
|
|
|
cardsCount() {
|
|
|
|
const list = Template.currentData();
|
|
|
|
let swimlaneId = '';
|
New feature: Now there is popup selection of Lists/Swimlanes/Calendar/Roles.
New feature, not set visible yet, because switching to it does not
work properly yet: Collapsible Swimlanes #2804
Fix: Public board now loads correctly. When you select one of Lists/Swimlanes/Calendar view and
reload webbrowser page, it can change view. Closes #2311
Fix: List sorting commented out. Closes #2800
Fix: Errors hasHiddenMinicardText, hasShowDragHandles, showSort, hasSortBy, profile,
FirefoxAndroid/IE11/Vivaldi/Chromium browsers not working by using
cookies instead of database.
More details at https://github.com/wekan/wekan/issues/2643#issuecomment-554907955
Note: Cookie changes are not always immediate, if there is no effect,
you may need to reload webbrowser page.
Closes #2643 .
Thanks to xet7 !
2019-11-18 22:23:49 +02:00
|
|
|
if (Utils.boardView() === 'board-view-swimlanes')
|
2019-06-28 12:52:09 -05:00
|
|
|
swimlaneId = this.parentComponent()
|
|
|
|
.parentComponent()
|
|
|
|
.data()._id;
|
2018-07-26 15:50:51 +02:00
|
|
|
|
|
|
|
return list.cards(swimlaneId).count();
|
|
|
|
},
|
|
|
|
|
2017-10-31 21:10:36 +00:00
|
|
|
reachedWipLimit() {
|
|
|
|
const list = Template.currentData();
|
2019-06-28 12:52:09 -05:00
|
|
|
return (
|
2019-11-26 02:29:36 +02:00
|
|
|
list.getWipLimit('enabled') &&
|
|
|
|
list.getWipLimit('value') <= list.cards().count()
|
2019-06-28 12:52:09 -05:00
|
|
|
);
|
2017-10-31 21:10:36 +00:00
|
|
|
},
|
|
|
|
|
2021-01-21 09:45:53 +01:00
|
|
|
exceededWipLimit() {
|
|
|
|
const list = Template.currentData();
|
|
|
|
return (
|
|
|
|
list.getWipLimit('enabled') &&
|
|
|
|
list.getWipLimit('value') < list.cards().count()
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
2017-06-02 18:48:04 +03:00
|
|
|
showCardsCountForList(count) {
|
2018-04-15 23:26:46 -03:00
|
|
|
const limit = this.limitToShowCardsCount();
|
2021-02-13 01:13:10 +01:00
|
|
|
return limit >= 0 && count >= limit;
|
2017-06-02 18:48:04 +03:00
|
|
|
},
|
2016-11-25 21:45:11 +01:00
|
|
|
|
2017-06-02 18:48:04 +03:00
|
|
|
events() {
|
2019-06-28 12:52:09 -05:00
|
|
|
return [
|
|
|
|
{
|
2019-10-29 19:05:44 +02:00
|
|
|
'click .js-list-star'(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
this.starred(!this.starred());
|
|
|
|
},
|
2019-06-28 12:52:09 -05:00
|
|
|
'click .js-open-list-menu': Popup.open('listAction'),
|
|
|
|
'click .js-add-card'(event) {
|
|
|
|
const listDom = $(event.target).parents(
|
|
|
|
`#js-list-${this.currentData()._id}`,
|
|
|
|
)[0];
|
|
|
|
const listComponent = BlazeComponent.getComponentForElement(listDom);
|
|
|
|
listComponent.openForm({
|
|
|
|
position: 'top',
|
|
|
|
});
|
|
|
|
},
|
|
|
|
'click .js-unselect-list'() {
|
|
|
|
Session.set('currentList', null);
|
|
|
|
},
|
|
|
|
submit: this.editTitle,
|
2017-09-24 15:17:14 +02:00
|
|
|
},
|
2019-06-28 12:52:09 -05:00
|
|
|
];
|
2017-06-02 18:48:04 +03:00
|
|
|
},
|
Renaissance
_,,ad8888888888bba,_
,ad88888I888888888888888ba,
,88888888I88888888888888888888a,
,d888888888I8888888888888888888888b,
d88888PP"""" ""YY88888888888888888888b,
,d88"'__,,--------,,,,.;ZZZY8888888888888,
,8IIl'" ;;l"ZZZIII8888888888,
,I88l;' ;lZZZZZ888III8888888,
,II88Zl;. ;llZZZZZ888888I888888,
,II888Zl;. .;;;;;lllZZZ888888I8888b
,II8888Z;; `;;;;;''llZZ8888888I8888,
II88888Z;' .;lZZZ8888888I888b
II88888Z; _,aaa, .,aaaaa,__.l;llZZZ88888888I888
II88888IZZZZZZZZZ, .ZZZZZZZZZZZZZZ;llZZ88888888I888,
II88888IZZ<'(@@>Z| |ZZZ<'(@@>ZZZZ;;llZZ888888888I88I
,II88888; `""" ;| |ZZ; `""" ;;llZ8888888888I888
II888888l `;; .;llZZ8888888888I888,
,II888888Z; ;;; .;;llZZZ8888888888I888I
III888888Zl; .., `;; ,;;lllZZZ88888888888I888
II88888888Z;;...;(_ _) ,;;;llZZZZ88888888888I888,
II88888888Zl;;;;;' `--'Z;. .,;;;;llZZZZ88888888888I888b
]I888888888Z;;;;' ";llllll;..;;;lllZZZZ88888888888I8888,
II888888888Zl.;;"Y88bd888P";;,..;lllZZZZZ88888888888I8888I
II8888888888Zl;.; `"PPP";;;,..;lllZZZZZZZ88888888888I88888
II888888888888Zl;;. `;;;l;;;;lllZZZZZZZZW88888888888I88888
`II8888888888888Zl;. ,;;lllZZZZZZZZWMZ88888888888I88888
II8888888888888888ZbaalllZZZZZZZZZWWMZZZ8888888888I888888,
`II88888888888888888b"WWZZZZZWWWMMZZZZZZI888888888I888888b
`II88888888888888888;ZZMMMMMMZZZZZZZZllI888888888I8888888
`II8888888888888888 `;lZZZZZZZZZZZlllll888888888I8888888,
II8888888888888888, `;lllZZZZllllll;;.Y88888888I8888888b,
,II8888888888888888b .;;lllllll;;;.;..88888888I88888888b,
II888888888888888PZI;. .`;;;.;;;..; ...88888888I8888888888,
II888888888888PZ;;';;. ;. .;. .;. .. Y8888888I88888888888b,
,II888888888PZ;;' `8888888I8888888888888b,
II888888888' 888888I8888888888888888
,II888888888 ,888888I8888888888888888
,d88888888888 d888888I8888888888ZZZZZZ
,ad888888888888I 8888888I8888ZZZZZZZZZZZZ
888888888888888' 888888IZZZZZZZZZZZZZZZZZ
8888888888P'8P' Y888ZZZZZZZZZZZZZZZZZZZZ
888888888, " ,ZZZZZZZZZZZZZZZZZZZZZZZ
8888888888, ,ZZZZZZZZZZZZZZZZZZZZZZZZZZ
888888888888a, _ ,ZZZZZZZZZZZZZZZZZZZZ88888888
888888888888888ba,_d' ,ZZZZZZZZZZZZZZZZZ8888888888888
8888888888888888888888bbbaaa,,,______,ZZZZZZZZZZZZZZZ88888888888888888
88888888888888888888888888888888888ZZZZZZZZZZZZZZZ88888888888888888888
8888888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888
888888888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888888888
8888888888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888
88888888888888888888888888888ZZZZZZZZZZZZZZ888888888888888888888888888
8888888888888888888888888888ZZZZZZZZZZZZZZ88888888888888888 Normand 8
88888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888 Veilleux 8
8888888888888888888888888ZZZZZZZZZZZZZZ8888888888888888888888888888888
2015-05-12 19:20:58 +02:00
|
|
|
}).register('listHeader');
|
2015-08-28 06:21:30 +02:00
|
|
|
|
2019-10-29 19:05:44 +02:00
|
|
|
Template.listHeader.helpers({
|
2020-12-17 21:27:02 +02:00
|
|
|
isBoardAdmin() {
|
|
|
|
return Meteor.user().isBoardAdmin();
|
|
|
|
},
|
|
|
|
|
2019-10-29 19:05:44 +02:00
|
|
|
showDesktopDragHandles() {
|
2019-11-19 14:09:36 +02:00
|
|
|
currentUser = Meteor.user();
|
|
|
|
if (currentUser) {
|
|
|
|
return (currentUser.profile || {}).showDesktopDragHandles;
|
2020-10-28 15:45:37 +02:00
|
|
|
} else if (window.localStorage.getItem('showDesktopDragHandles')) {
|
2020-01-03 06:49:35 +02:00
|
|
|
return true;
|
New feature: Now there is popup selection of Lists/Swimlanes/Calendar/Roles.
New feature, not set visible yet, because switching to it does not
work properly yet: Collapsible Swimlanes #2804
Fix: Public board now loads correctly. When you select one of Lists/Swimlanes/Calendar view and
reload webbrowser page, it can change view. Closes #2311
Fix: List sorting commented out. Closes #2800
Fix: Errors hasHiddenMinicardText, hasShowDragHandles, showSort, hasSortBy, profile,
FirefoxAndroid/IE11/Vivaldi/Chromium browsers not working by using
cookies instead of database.
More details at https://github.com/wekan/wekan/issues/2643#issuecomment-554907955
Note: Cookie changes are not always immediate, if there is no effect,
you may need to reload webbrowser page.
Closes #2643 .
Thanks to xet7 !
2019-11-18 22:23:49 +02:00
|
|
|
} else {
|
2020-01-03 06:49:35 +02:00
|
|
|
return false;
|
New feature: Now there is popup selection of Lists/Swimlanes/Calendar/Roles.
New feature, not set visible yet, because switching to it does not
work properly yet: Collapsible Swimlanes #2804
Fix: Public board now loads correctly. When you select one of Lists/Swimlanes/Calendar view and
reload webbrowser page, it can change view. Closes #2311
Fix: List sorting commented out. Closes #2800
Fix: Errors hasHiddenMinicardText, hasShowDragHandles, showSort, hasSortBy, profile,
FirefoxAndroid/IE11/Vivaldi/Chromium browsers not working by using
cookies instead of database.
More details at https://github.com/wekan/wekan/issues/2643#issuecomment-554907955
Note: Cookie changes are not always immediate, if there is no effect,
you may need to reload webbrowser page.
Closes #2643 .
Thanks to xet7 !
2019-11-18 22:23:49 +02:00
|
|
|
}
|
2019-10-29 19:05:44 +02:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2016-01-05 23:26:02 +08:00
|
|
|
Template.listActionPopup.helpers({
|
2020-12-17 21:27:02 +02:00
|
|
|
isBoardAdmin() {
|
|
|
|
return Meteor.user().isBoardAdmin();
|
|
|
|
},
|
|
|
|
|
2017-10-04 11:12:52 +02:00
|
|
|
isWipLimitEnabled() {
|
2017-10-05 16:46:55 +02:00
|
|
|
return Template.currentData().getWipLimit('enabled');
|
2017-09-29 16:52:53 +02:00
|
|
|
},
|
2017-10-04 17:48:37 +02:00
|
|
|
|
2017-06-02 18:48:04 +03:00
|
|
|
isWatching() {
|
2017-06-02 19:18:31 +03:00
|
|
|
return this.findWatcher(Meteor.userId());
|
2017-06-02 18:48:04 +03:00
|
|
|
},
|
2016-01-05 23:26:02 +08:00
|
|
|
});
|
|
|
|
|
2015-08-28 06:21:30 +02:00
|
|
|
Template.listActionPopup.events({
|
2019-06-28 12:52:09 -05:00
|
|
|
'click .js-list-subscribe'() {},
|
2019-01-25 15:56:40 +01:00
|
|
|
'click .js-set-color-list': Popup.open('setListColor'),
|
2019-06-28 12:52:09 -05:00
|
|
|
'click .js-select-cards'() {
|
|
|
|
const cardIds = this.allCards().map(card => card._id);
|
2017-06-02 19:18:31 +03:00
|
|
|
MultiSelection.add(cardIds);
|
|
|
|
Popup.close();
|
2017-06-02 18:48:04 +03:00
|
|
|
},
|
2019-06-28 12:52:09 -05:00
|
|
|
'click .js-toggle-watch-list'() {
|
2017-06-02 19:18:31 +03:00
|
|
|
const currentList = this;
|
|
|
|
const level = currentList.findWatcher(Meteor.userId()) ? null : 'watching';
|
|
|
|
Meteor.call('watch', 'list', currentList._id, level, (err, ret) => {
|
|
|
|
if (!err && ret) Popup.close();
|
|
|
|
});
|
2017-06-02 18:48:04 +03:00
|
|
|
},
|
2019-06-28 12:52:09 -05:00
|
|
|
'click .js-close-list'(event) {
|
|
|
|
event.preventDefault();
|
2017-06-02 19:18:31 +03:00
|
|
|
this.archive();
|
|
|
|
Popup.close();
|
2017-06-02 18:48:04 +03:00
|
|
|
},
|
2017-09-28 16:59:53 +02:00
|
|
|
'click .js-set-wip-limit': Popup.open('setWipLimit'),
|
2017-06-02 18:48:04 +03:00
|
|
|
'click .js-more': Popup.open('listMore'),
|
2015-08-28 06:21:30 +02:00
|
|
|
});
|
2017-06-02 10:29:48 +02:00
|
|
|
|
2017-10-04 11:12:52 +02:00
|
|
|
BlazeComponent.extendComponent({
|
2017-10-04 17:48:37 +02:00
|
|
|
applyWipLimit() {
|
|
|
|
const list = Template.currentData();
|
2019-06-28 12:52:09 -05:00
|
|
|
const limit = parseInt(
|
|
|
|
Template.instance()
|
|
|
|
.$('.wip-limit-value')
|
|
|
|
.val(),
|
|
|
|
10,
|
|
|
|
);
|
|
|
|
|
|
|
|
if (limit < list.cards().count() && !list.getWipLimit('soft')) {
|
|
|
|
Template.instance()
|
|
|
|
.$('.wip-limit-error')
|
|
|
|
.click();
|
2017-10-04 17:48:37 +02:00
|
|
|
} else {
|
2017-10-05 16:46:55 +02:00
|
|
|
Meteor.call('applyWipLimit', list._id, limit);
|
|
|
|
Popup.back();
|
2017-10-04 17:48:37 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-10-31 21:10:36 +00:00
|
|
|
enableSoftLimit() {
|
|
|
|
const list = Template.currentData();
|
|
|
|
|
2019-06-28 12:52:09 -05:00
|
|
|
if (
|
2019-11-26 02:29:36 +02:00
|
|
|
list.getWipLimit('soft') &&
|
|
|
|
list.getWipLimit('value') < list.cards().count()
|
2019-06-28 12:52:09 -05:00
|
|
|
) {
|
2017-10-31 21:10:36 +00:00
|
|
|
list.setWipLimit(list.cards().count());
|
|
|
|
}
|
|
|
|
Meteor.call('enableSoftLimit', Template.currentData()._id);
|
|
|
|
},
|
|
|
|
|
2017-10-04 17:48:37 +02:00
|
|
|
enableWipLimit() {
|
|
|
|
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
|
2019-06-28 12:52:09 -05:00
|
|
|
if (
|
2019-11-26 02:29:36 +02:00
|
|
|
!list.getWipLimit('enabled') &&
|
|
|
|
list.getWipLimit('value') < list.cards().count()
|
2019-06-28 12:52:09 -05:00
|
|
|
) {
|
2017-10-04 17:48:37 +02:00
|
|
|
list.setWipLimit(list.cards().count());
|
|
|
|
}
|
2017-10-05 17:22:03 +02:00
|
|
|
Meteor.call('enableWipLimit', list._id);
|
2017-10-05 16:46:55 +02:00
|
|
|
},
|
|
|
|
|
2017-10-31 21:10:36 +00:00
|
|
|
isWipLimitSoft() {
|
|
|
|
return Template.currentData().getWipLimit('soft');
|
|
|
|
},
|
|
|
|
|
2017-10-05 16:46:55 +02:00
|
|
|
isWipLimitEnabled() {
|
|
|
|
return Template.currentData().getWipLimit('enabled');
|
|
|
|
},
|
2017-10-04 17:48:37 +02:00
|
|
|
|
2019-06-28 12:52:09 -05:00
|
|
|
wipLimitValue() {
|
2017-10-05 16:46:55 +02:00
|
|
|
return Template.currentData().getWipLimit('value');
|
2017-10-04 11:12:52 +02:00
|
|
|
},
|
2017-10-04 17:48:37 +02:00
|
|
|
|
2017-10-04 11:12:52 +02:00
|
|
|
events() {
|
2019-06-28 12:52:09 -05:00
|
|
|
return [
|
|
|
|
{
|
|
|
|
'click .js-enable-wip-limit': this.enableWipLimit,
|
|
|
|
'click .wip-limit-apply': this.applyWipLimit,
|
|
|
|
'click .wip-limit-error': Popup.open('wipLimitError'),
|
|
|
|
'click .materialCheckBox': this.enableSoftLimit,
|
|
|
|
},
|
|
|
|
];
|
2017-10-04 11:12:52 +02:00
|
|
|
},
|
|
|
|
}).register('setWipLimitPopup');
|
|
|
|
|
2017-06-02 10:29:48 +02:00
|
|
|
Template.listMorePopup.events({
|
2019-06-28 12:52:09 -05:00
|
|
|
'click .js-delete': Popup.afterConfirm('listDelete', function() {
|
2017-06-02 19:18:31 +03:00
|
|
|
Popup.close();
|
2020-04-30 01:03:37 +02:00
|
|
|
// TODO how can we avoid the fetch call?
|
|
|
|
const allCards = this.allCards().fetch();
|
|
|
|
const allCardIds = _.pluck(allCards, '_id');
|
|
|
|
// it's okay if the linked cards are on the same list
|
|
|
|
if (
|
|
|
|
Cards.find({
|
|
|
|
$and: [
|
|
|
|
{ listId: { $ne: this._id } },
|
|
|
|
{ linkedId: { $in: allCardIds } },
|
|
|
|
],
|
|
|
|
}).count() === 0
|
|
|
|
) {
|
|
|
|
allCardIds.map(_id => Cards.remove(_id));
|
|
|
|
Lists.remove(this._id);
|
|
|
|
} else {
|
2020-05-14 01:04:52 +03:00
|
|
|
// TODO: Figure out more informative message.
|
|
|
|
// Popup with a hint that the list cannot be deleted as there are
|
2020-04-30 01:03:37 +02:00
|
|
|
// linked cards. We can adapt the query above so we can list the linked
|
|
|
|
// cards.
|
2020-05-14 01:04:52 +03:00
|
|
|
// Related:
|
|
|
|
// client/components/cards/cardDetails.js about line 969
|
|
|
|
// https://github.com/wekan/wekan/issues/2785
|
|
|
|
const message = `${TAPi18n.__(
|
|
|
|
'delete-linked-cards-before-this-list',
|
|
|
|
)} linkedId: ${
|
|
|
|
this._id
|
|
|
|
} at client/components/lists/listHeader.js and https://github.com/wekan/wekan/issues/2785`;
|
|
|
|
alert(message);
|
2020-04-30 01:03:37 +02:00
|
|
|
}
|
2017-06-02 19:18:31 +03:00
|
|
|
Utils.goBoardId(this.boardId);
|
2017-06-02 18:48:04 +03:00
|
|
|
}),
|
|
|
|
});
|
2019-01-25 15:56:40 +01:00
|
|
|
|
2020-12-17 21:27:02 +02:00
|
|
|
Template.listHeader.helpers({
|
|
|
|
isBoardAdmin() {
|
|
|
|
return Meteor.user().isBoardAdmin();
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2019-01-25 15:56:40 +01:00
|
|
|
BlazeComponent.extendComponent({
|
|
|
|
onCreated() {
|
|
|
|
this.currentList = this.currentData();
|
|
|
|
this.currentColor = new ReactiveVar(this.currentList.color);
|
|
|
|
},
|
|
|
|
|
|
|
|
colors() {
|
2019-06-28 12:52:09 -05:00
|
|
|
return listsColors.map(color => ({ color, name: '' }));
|
2019-01-25 15:56:40 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
isSelected(color) {
|
2021-01-06 22:15:06 +02:00
|
|
|
if (this.currentColor.get() === null) {
|
|
|
|
return color === 'white';
|
|
|
|
} else {
|
|
|
|
return this.currentColor.get() === color;
|
|
|
|
}
|
2019-01-25 15:56:40 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
events() {
|
2019-06-28 12:52:09 -05:00
|
|
|
return [
|
|
|
|
{
|
|
|
|
'click .js-palette-color'() {
|
|
|
|
this.currentColor.set(this.currentData().color);
|
|
|
|
},
|
|
|
|
'click .js-submit'() {
|
|
|
|
this.currentList.setColor(this.currentColor.get());
|
|
|
|
Popup.close();
|
|
|
|
},
|
|
|
|
'click .js-remove-color'() {
|
|
|
|
this.currentList.setColor(null);
|
|
|
|
Popup.close();
|
|
|
|
},
|
2019-01-25 15:56:40 +01:00
|
|
|
},
|
2019-06-28 12:52:09 -05:00
|
|
|
];
|
2019-01-25 15:56:40 +01:00
|
|
|
},
|
|
|
|
}).register('setListColorPopup');
|