2023-01-16 23:00:10 +01:00
|
|
|
import { ReactiveCache } from '/imports/reactiveCache';
|
2021-07-10 10:55:54 +02:00
|
|
|
import { TAPi18n } from '/imports/i18n';
|
|
|
|
|
|
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()) &&
|
2023-01-16 23:00:10 +01:00
|
|
|
!ReactiveCache.getCurrentUser().isWorker()
|
2019-06-28 12:52:09 -05:00
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
|
2019-10-29 19:05:44 +02:00
|
|
|
isBoardAdmin() {
|
2023-01-16 23:00:10 +01:00
|
|
|
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
2019-10-29 19:05:44 +02:00
|
|
|
},
|
|
|
|
|
starred(check = undefined) {
|
|
|
|
|
const list = Template.currentData();
|
|
|
|
|
const status = list.isStarred();
|
|
|
|
|
if (check === undefined) {
|
|
|
|
|
// just check
|
|
|
|
|
return status;
|
|
|
|
|
} else {
|
|
|
|
|
list.star(!status);
|
|
|
|
|
return !status;
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-05-04 22:57:13 +03:00
|
|
|
collapsed(check = undefined) {
|
|
|
|
|
const list = Template.currentData();
|
|
|
|
|
const status = list.isCollapsed();
|
2024-04-26 07:33:06 +03:00
|
|
|
if (check === undefined) {
|
|
|
|
|
// just check
|
|
|
|
|
return status;
|
|
|
|
|
} else {
|
2024-05-04 22:57:13 +03:00
|
|
|
list.collapse(!status);
|
2024-04-26 07:33:06 +03:00
|
|
|
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() {
|
2023-01-16 23:00:10 +01:00
|
|
|
const currentUser = ReactiveCache.getCurrentUser();
|
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 (currentUser) {
|
2023-01-16 23:00:10 +01:00
|
|
|
return currentUser.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
|
|
|
|
2023-02-14 18:52:36 +01:00
|
|
|
const ret = list.cards(swimlaneId).length;
|
|
|
|
|
return ret;
|
2018-07-26 15:50:51 +02:00
|
|
|
},
|
|
|
|
|
|
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') &&
|
2023-02-14 18:52:36 +01:00
|
|
|
list.getWipLimit('value') <= list.cards().length
|
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') &&
|
2023-02-14 18:52:36 +01:00
|
|
|
list.getWipLimit('value') < list.cards().length
|
2021-01-21 09:45:53 +01:00
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
|
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
|
|
|
|
2021-09-07 18:13:08 -03:00
|
|
|
cardsCountForListIsOne(count) {
|
|
|
|
|
if (count === 1) {
|
|
|
|
|
return TAPi18n.__('cards-count-one');
|
|
|
|
|
} else {
|
|
|
|
|
return TAPi18n.__('cards-count');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
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());
|
|
|
|
|
},
|
2024-05-04 22:57:13 +03:00
|
|
|
'click .js-collapse'(event) {
|
2024-04-26 07:33:06 +03:00
|
|
|
event.preventDefault();
|
2024-05-04 22:57:13 +03:00
|
|
|
this.collapsed(!this.collapsed());
|
2024-04-26 07:33:06 +03:00
|
|
|
},
|
2019-06-28 12:52:09 -05:00
|
|
|
'click .js-open-list-menu': Popup.open('listAction'),
|
2021-11-27 20:12:01 +01:00
|
|
|
'click .js-add-card.list-header-plus-top'(event) {
|
2019-06-28 12:52:09 -05:00
|
|
|
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() {
|
2023-01-16 23:00:10 +01:00
|
|
|
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
2021-10-13 13:49:15 +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() {
|
2023-01-16 23:00:10 +01:00
|
|
|
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
2020-12-17 21:27:02 +02:00
|
|
|
},
|
|
|
|
|
|
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'() {},
|
2021-11-28 17:37:01 +01:00
|
|
|
'click .js-add-card.list-header-plus-bottom'(event) {
|
|
|
|
|
const listDom = $(`#js-list-${this._id}`)[0];
|
|
|
|
|
const listComponent = BlazeComponent.getComponentForElement(listDom);
|
|
|
|
|
listComponent.openForm({
|
|
|
|
|
position: 'bottom',
|
|
|
|
|
});
|
|
|
|
|
Popup.back();
|
|
|
|
|
},
|
2023-06-12 22:14:06 -05:00
|
|
|
'click .js-set-list-width': Popup.open('setListWidth'),
|
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);
|
2021-10-21 10:35:16 +02:00
|
|
|
Popup.back();
|
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) => {
|
2021-10-21 10:35:16 +02:00
|
|
|
if (!err && ret) Popup.back();
|
2017-06-02 19:18:31 +03:00
|
|
|
});
|
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();
|
2021-10-21 10:35:16 +02:00
|
|
|
Popup.back();
|
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,
|
|
|
|
|
);
|
|
|
|
|
|
2023-02-14 18:52:36 +01:00
|
|
|
if (limit < list.cards().length && !list.getWipLimit('soft')) {
|
2019-06-28 12:52:09 -05:00
|
|
|
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') &&
|
2023-02-14 18:52:36 +01:00
|
|
|
list.getWipLimit('value') < list.cards().length
|
2019-06-28 12:52:09 -05:00
|
|
|
) {
|
2023-02-14 18:52:36 +01:00
|
|
|
list.setWipLimit(list.cards().length);
|
2017-10-31 21:10:36 +00:00
|
|
|
}
|
|
|
|
|
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') &&
|
2023-02-14 18:52:36 +01:00
|
|
|
list.getWipLimit('value') < list.cards().length
|
2019-06-28 12:52:09 -05:00
|
|
|
) {
|
2023-02-14 18:52:36 +01:00
|
|
|
list.setWipLimit(list.cards().length);
|
2017-10-04 17:48:37 +02:00
|
|
|
}
|
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() {
|
2021-10-21 10:35:16 +02:00
|
|
|
Popup.back();
|
2023-02-19 17:43:22 +01:00
|
|
|
const allCards = this.allCards();
|
2020-04-30 01:03:37 +02:00
|
|
|
const allCardIds = _.pluck(allCards, '_id');
|
|
|
|
|
// it's okay if the linked cards are on the same list
|
|
|
|
|
if (
|
2023-02-14 18:52:36 +01:00
|
|
|
ReactiveCache.getCards({
|
2020-04-30 01:03:37 +02:00
|
|
|
$and: [
|
|
|
|
|
{ listId: { $ne: this._id } },
|
|
|
|
|
{ linkedId: { $in: allCardIds } },
|
|
|
|
|
],
|
2023-02-14 18:52:36 +01:00
|
|
|
}).length === 0
|
2020-04-30 01:03:37 +02:00
|
|
|
) {
|
|
|
|
|
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() {
|
2023-01-16 23:00:10 +01:00
|
|
|
return ReactiveCache.getCurrentUser().isBoardAdmin();
|
2020-12-17 21:27:02 +02:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
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());
|
2022-12-22 17:42:07 -03:00
|
|
|
Popup.close();
|
2019-06-28 12:52:09 -05:00
|
|
|
},
|
|
|
|
|
'click .js-remove-color'() {
|
|
|
|
|
this.currentList.setColor(null);
|
2022-12-22 17:42:07 -03:00
|
|
|
Popup.close();
|
2019-06-28 12:52:09 -05:00
|
|
|
},
|
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');
|
2023-06-12 22:14:06 -05:00
|
|
|
|
|
|
|
|
BlazeComponent.extendComponent({
|
|
|
|
|
applyListWidth() {
|
|
|
|
|
const list = Template.currentData();
|
|
|
|
|
const board = list.boardId;
|
|
|
|
|
const width = parseInt(
|
|
|
|
|
Template.instance()
|
|
|
|
|
.$('.list-width-value')
|
|
|
|
|
.val(),
|
|
|
|
|
10,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// FIXME(mark-i-m): where do we put constants?
|
|
|
|
|
if (width < 100 || !width) {
|
|
|
|
|
Template.instance()
|
|
|
|
|
.$('.list-width-error')
|
|
|
|
|
.click();
|
|
|
|
|
} else {
|
|
|
|
|
Meteor.call('applyListWidth', board, list._id, width);
|
|
|
|
|
Popup.back();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
listWidthValue() {
|
|
|
|
|
const list = Template.currentData();
|
|
|
|
|
const board = list.boardId;
|
|
|
|
|
return Meteor.user().getListWidth(board, list._id);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
events() {
|
|
|
|
|
return [
|
|
|
|
|
{
|
|
|
|
|
'click .list-width-apply': this.applyListWidth,
|
|
|
|
|
'click .list-width-error': Popup.open('listWidthError'),
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
},
|
|
|
|
|
}).register('setListWidthPopup');
|