2018-03-20 00:13:42 -03:00
|
|
|
const subManager = new SubsManager();
|
2019-01-30 16:25:23 +01:00
|
|
|
const InfiniteScrollIter = 10;
|
2018-03-20 00:13:42 -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
|
|
|
BlazeComponent.extendComponent({
|
2019-01-30 16:25:23 +01:00
|
|
|
onCreated() {
|
|
|
|
// for infinite scrolling
|
|
|
|
this.cardlimit = new ReactiveVar(InfiniteScrollIter);
|
2019-03-26 15:54:53 +01:00
|
|
|
},
|
|
|
|
|
2015-09-03 23:12:46 +02:00
|
|
|
mixins() {
|
2020-08-28 11:46:51 +01:00
|
|
|
return [];
|
2015-05-24 21:40:21 +02:00
|
|
|
},
|
|
|
|
|
2015-09-03 23:12:46 +02:00
|
|
|
openForm(options) {
|
2015-05-23 19:57:47 +02:00
|
|
|
options = options || {};
|
|
|
|
options.position = options.position || 'top';
|
|
|
|
|
2015-10-31 09:26:55 -07:00
|
|
|
const forms = this.childComponents('inlinedForm');
|
2019-06-28 12:52:09 -05:00
|
|
|
let form = forms.find(component => {
|
2015-05-23 19:57:47 +02:00
|
|
|
return component.data().position === options.position;
|
|
|
|
});
|
2015-09-03 23:12:46 +02:00
|
|
|
if (!form && forms.length > 0) {
|
2015-05-23 19:57:47 +02:00
|
|
|
form = forms[0];
|
|
|
|
}
|
|
|
|
form.open();
|
|
|
|
},
|
|
|
|
|
2015-09-03 23:12:46 +02:00
|
|
|
addCard(evt) {
|
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
|
|
|
evt.preventDefault();
|
2015-09-03 23:12:46 +02:00
|
|
|
const firstCardDom = this.find('.js-minicard:first');
|
|
|
|
const lastCardDom = this.find('.js-minicard:last');
|
|
|
|
const textarea = $(evt.currentTarget).find('textarea');
|
2015-10-13 19:56:04 +02:00
|
|
|
const position = this.currentData().position;
|
2015-10-31 09:26:55 -07:00
|
|
|
const title = textarea.val().trim();
|
|
|
|
|
|
|
|
const formComponent = this.childComponents('addCardForm')[0];
|
2015-09-03 23:12:46 +02:00
|
|
|
let sortIndex;
|
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
|
|
|
if (position === 'top') {
|
2015-09-03 23:12:46 +02:00
|
|
|
sortIndex = Utils.calculateIndex(null, firstCardDom).base;
|
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
|
|
|
} else if (position === 'bottom') {
|
2015-09-03 23:12:46 +02:00
|
|
|
sortIndex = Utils.calculateIndex(lastCardDom, null).base;
|
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
|
|
|
}
|
2015-10-08 13:10:46 -06:00
|
|
|
|
2015-10-31 09:26:55 -07:00
|
|
|
const members = formComponent.members.get();
|
|
|
|
const labelIds = formComponent.labels.get();
|
2017-08-30 02:54:54 +02:00
|
|
|
const customFields = formComponent.customFields.get();
|
2015-10-03 15:58:36 -06:00
|
|
|
|
2019-02-23 12:14:37 +01:00
|
|
|
const board = this.data().board();
|
|
|
|
let linkedId = '';
|
2018-01-22 23:43:47 -03:00
|
|
|
let swimlaneId = '';
|
2019-02-23 01:40:11 +01:00
|
|
|
let cardType = 'cardType-card';
|
2015-10-23 16:56:55 +02:00
|
|
|
if (title) {
|
2019-02-23 12:14:37 +01:00
|
|
|
if (board.isTemplatesBoard()) {
|
2019-06-28 12:52:09 -05:00
|
|
|
swimlaneId = this.parentComponent()
|
|
|
|
.parentComponent()
|
|
|
|
.data()._id; // Always swimlanes view
|
2019-02-23 12:14:37 +01:00
|
|
|
const swimlane = Swimlanes.findOne(swimlaneId);
|
|
|
|
// If this is the card templates swimlane, insert a card template
|
2019-06-28 12:52:09 -05:00
|
|
|
if (swimlane.isCardTemplatesSwimlane()) cardType = 'template-card';
|
2019-02-23 12:14:37 +01:00
|
|
|
// If this is the board templates swimlane, insert a board template and a linked card
|
|
|
|
else if (swimlane.isBoardTemplatesSwimlane()) {
|
2019-02-24 00:13:35 +01:00
|
|
|
linkedId = Boards.insert({
|
|
|
|
title,
|
|
|
|
permission: 'private',
|
|
|
|
type: 'template-board',
|
|
|
|
});
|
|
|
|
Swimlanes.insert({
|
|
|
|
title: TAPi18n.__('default'),
|
|
|
|
boardId: linkedId,
|
|
|
|
});
|
|
|
|
cardType = 'cardType-linkedBoard';
|
2019-02-23 12:14:37 +01:00
|
|
|
}
|
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 if (Utils.boardView() === 'board-view-swimlanes')
|
2019-06-28 12:52:09 -05:00
|
|
|
swimlaneId = this.parentComponent()
|
|
|
|
.parentComponent()
|
|
|
|
.data()._id;
|
|
|
|
else if (
|
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
|
|
|
Utils.boardView() === 'board-view-lists' ||
|
|
|
|
Utils.boardView() === 'board-view-cal' ||
|
2020-05-13 12:44:40 +02:00
|
|
|
!Utils.boardView()
|
2019-06-28 12:52:09 -05:00
|
|
|
)
|
2019-02-23 12:14:37 +01:00
|
|
|
swimlaneId = board.getDefaultSwimline()._id;
|
|
|
|
|
2015-09-03 23:12:46 +02:00
|
|
|
const _id = Cards.insert({
|
|
|
|
title,
|
2015-10-31 09:26:55 -07:00
|
|
|
members,
|
|
|
|
labelIds,
|
2017-08-30 02:54:54 +02:00
|
|
|
customFields,
|
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
|
|
|
listId: this.data()._id,
|
2019-02-23 12:14:37 +01:00
|
|
|
boardId: board._id,
|
2015-09-03 23:12:46 +02:00
|
|
|
sort: sortIndex,
|
2018-01-22 15:31:33 -03:00
|
|
|
swimlaneId,
|
2019-02-23 01:40:11 +01:00
|
|
|
type: cardType,
|
2019-02-23 12:14:37 +01:00
|
|
|
linkedId,
|
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
|
|
|
});
|
2018-11-05 21:46:57 +01:00
|
|
|
|
2019-01-30 16:25:23 +01:00
|
|
|
// if the displayed card count is less than the total cards in the list,
|
|
|
|
// we need to increment the displayed card count to prevent the spinner
|
|
|
|
// to appear
|
2019-06-28 12:52:09 -05:00
|
|
|
const cardCount = this.data()
|
|
|
|
.cards(this.idOrNull(swimlaneId))
|
|
|
|
.count();
|
2019-01-30 16:25:23 +01:00
|
|
|
if (this.cardlimit.get() < cardCount) {
|
|
|
|
this.cardlimit.set(this.cardlimit.get() + InfiniteScrollIter);
|
|
|
|
}
|
2018-11-05 21:46:57 +01:00
|
|
|
|
2015-05-29 23:35:30 +02:00
|
|
|
// In case the filter is active we need to add the newly inserted card in
|
|
|
|
// the list of exceptions -- cards that are not filtered. Otherwise the
|
|
|
|
// card will disappear instantly.
|
2015-08-28 09:50:41 +02:00
|
|
|
// See https://github.com/wekan/wekan/issues/80
|
2015-05-29 23:35:30 +02:00
|
|
|
Filter.addException(_id);
|
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
|
|
|
|
|
|
|
// We keep the form opened, empty it, and scroll to it.
|
|
|
|
textarea.val('').focus();
|
2015-12-09 22:55:30 -05:00
|
|
|
autosize.update(textarea);
|
2015-05-27 17:17:00 +02:00
|
|
|
if (position === 'bottom') {
|
|
|
|
this.scrollToBottom();
|
|
|
|
}
|
2015-10-31 09:26:55 -07:00
|
|
|
|
|
|
|
formComponent.reset();
|
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
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-09-03 23:12:46 +02:00
|
|
|
scrollToBottom() {
|
|
|
|
const container = this.firstNode();
|
2015-05-27 17:17:00 +02:00
|
|
|
$(container).animate({
|
2015-09-03 23:12:46 +02:00
|
|
|
scrollTop: container.scrollHeight,
|
2015-05-24 21:40:21 +02:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2015-09-03 23:12:46 +02:00
|
|
|
clickOnMiniCard(evt) {
|
2015-06-07 18:55:26 +02:00
|
|
|
if (MultiSelection.isActive() || evt.shiftKey) {
|
|
|
|
evt.stopImmediatePropagation();
|
|
|
|
evt.preventDefault();
|
2015-09-06 22:47:29 +02:00
|
|
|
const methodName = evt.shiftKey ? 'toggleRange' : 'toggle';
|
2015-06-07 18:55:26 +02:00
|
|
|
MultiSelection[methodName](this.currentData()._id);
|
|
|
|
|
2019-02-24 00:13:35 +01:00
|
|
|
// If the card is already selected, we want to de-select it.
|
|
|
|
// XXX We should probably modify the minicard href attribute instead of
|
|
|
|
// overwriting the event in case the card is already selected.
|
2015-06-07 18:55:26 +02:00
|
|
|
} else if (Session.equals('currentCard', this.currentData()._id)) {
|
|
|
|
evt.stopImmediatePropagation();
|
|
|
|
evt.preventDefault();
|
|
|
|
Utils.goBoardId(Session.get('currentBoard'));
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-09-03 23:12:46 +02:00
|
|
|
cardIsSelected() {
|
2015-06-07 18:55:26 +02:00
|
|
|
return Session.equals('currentCard', this.currentData()._id);
|
|
|
|
},
|
|
|
|
|
2015-09-03 23:12:46 +02:00
|
|
|
toggleMultiSelection(evt) {
|
2015-06-07 18:55:26 +02:00
|
|
|
evt.stopPropagation();
|
|
|
|
evt.preventDefault();
|
2015-09-06 22:47:29 +02:00
|
|
|
MultiSelection.toggle(this.currentData()._id);
|
2015-06-07 18:55:26 +02:00
|
|
|
},
|
|
|
|
|
2018-01-22 23:35:23 -03:00
|
|
|
idOrNull(swimlaneId) {
|
2019-06-28 12:52:09 -05:00
|
|
|
if (
|
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
|
|
|
Utils.boardView() === 'board-view-swimlanes' ||
|
2019-06-28 12:52:09 -05:00
|
|
|
this.data()
|
|
|
|
.board()
|
|
|
|
.isTemplatesBoard()
|
|
|
|
)
|
2018-01-22 23:35:23 -03:00
|
|
|
return swimlaneId;
|
|
|
|
return undefined;
|
|
|
|
},
|
|
|
|
|
2019-01-30 16:25:23 +01:00
|
|
|
cardsWithLimit(swimlaneId) {
|
|
|
|
const limit = this.cardlimit.get();
|
|
|
|
const selector = {
|
|
|
|
listId: this.currentData()._id,
|
|
|
|
archived: false,
|
|
|
|
};
|
2019-06-28 12:52:09 -05:00
|
|
|
if (swimlaneId) selector.swimlaneId = swimlaneId;
|
2019-01-30 16:25:23 +01:00
|
|
|
return Cards.find(Filter.mongoSelector(selector), {
|
|
|
|
sort: ['sort'],
|
|
|
|
limit,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
showSpinner(swimlaneId) {
|
|
|
|
const list = Template.currentData();
|
|
|
|
return list.cards(swimlaneId).count() > this.cardlimit.get();
|
|
|
|
},
|
|
|
|
|
2017-10-04 17:48:37 +02:00
|
|
|
canSeeAddCard() {
|
2019-06-28 12:52:09 -05:00
|
|
|
return (
|
|
|
|
!this.reachedWipLimit() &&
|
|
|
|
Meteor.user() &&
|
|
|
|
Meteor.user().isBoardMember() &&
|
2020-01-05 21:28:14 +02:00
|
|
|
!Meteor.user().isCommentOnly() &&
|
|
|
|
!Meteor.user().isWorker()
|
2019-06-28 12:52:09 -05:00
|
|
|
);
|
2017-10-04 17:48:37 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
reachedWipLimit() {
|
|
|
|
const list = Template.currentData();
|
2019-06-28 12:52:09 -05:00
|
|
|
return (
|
|
|
|
!list.getWipLimit('soft') &&
|
|
|
|
list.getWipLimit('enabled') &&
|
|
|
|
list.getWipLimit('value') <= list.cards().count()
|
|
|
|
);
|
2017-10-04 17:48:37 +02:00
|
|
|
},
|
|
|
|
|
2015-09-03 23:12:46 +02:00
|
|
|
events() {
|
2019-06-28 12:52:09 -05:00
|
|
|
return [
|
|
|
|
{
|
|
|
|
'click .js-minicard': this.clickOnMiniCard,
|
|
|
|
'click .js-toggle-multi-selection': this.toggleMultiSelection,
|
|
|
|
'click .open-minicard-composer': this.scrollToBottom,
|
|
|
|
submit: this.addCard,
|
|
|
|
},
|
|
|
|
];
|
2015-09-03 23:12:46 +02:00
|
|
|
},
|
2015-05-23 19:57:47 +02:00
|
|
|
}).register('listBody');
|
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
|
|
|
|
2015-10-31 09:26:55 -07:00
|
|
|
function toggleValueInReactiveArray(reactiveValue, value) {
|
|
|
|
const array = reactiveValue.get();
|
|
|
|
const valueIndex = array.indexOf(value);
|
|
|
|
if (valueIndex === -1) {
|
|
|
|
array.push(value);
|
|
|
|
} else {
|
|
|
|
array.splice(valueIndex, 1);
|
|
|
|
}
|
|
|
|
reactiveValue.set(array);
|
|
|
|
}
|
|
|
|
|
2015-05-23 19:57:47 +02:00
|
|
|
BlazeComponent.extendComponent({
|
2015-10-31 09:26:55 -07:00
|
|
|
onCreated() {
|
|
|
|
this.labels = new ReactiveVar([]);
|
|
|
|
this.members = new ReactiveVar([]);
|
2017-08-30 02:54:54 +02:00
|
|
|
this.customFields = new ReactiveVar([]);
|
2018-11-05 21:46:57 +01:00
|
|
|
|
|
|
|
const currentBoardId = Session.get('currentBoard');
|
2018-11-07 18:23:28 +01:00
|
|
|
arr = [];
|
2019-06-28 12:52:09 -05:00
|
|
|
_.forEach(
|
|
|
|
Boards.findOne(currentBoardId)
|
|
|
|
.customFields()
|
|
|
|
.fetch(),
|
|
|
|
function(field) {
|
2021-01-22 21:28:37 +02:00
|
|
|
if (field.automaticallyOnCard || field.alwaysOnCard)
|
2019-06-28 12:52:09 -05:00
|
|
|
arr.push({ _id: field._id, value: null });
|
|
|
|
},
|
|
|
|
);
|
2018-11-05 21:46:57 +01:00
|
|
|
this.customFields.set(arr);
|
2015-10-31 09:26:55 -07:00
|
|
|
},
|
2015-10-03 15:58:36 -06:00
|
|
|
|
2015-10-31 09:26:55 -07:00
|
|
|
reset() {
|
|
|
|
this.labels.set([]);
|
|
|
|
this.members.set([]);
|
2017-08-30 02:54:54 +02:00
|
|
|
this.customFields.set([]);
|
2015-10-31 09:26:55 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
getLabels() {
|
|
|
|
const currentBoardId = Session.get('currentBoard');
|
2019-06-28 12:52:09 -05:00
|
|
|
return Boards.findOne(currentBoardId).labels.filter(label => {
|
2015-10-31 09:26:55 -07:00
|
|
|
return this.labels.get().indexOf(label._id) > -1;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
pressKey(evt) {
|
2015-05-23 19:57:47 +02:00
|
|
|
// Pressing Enter should submit the card
|
2019-02-01 17:03:59 +02:00
|
|
|
if (evt.keyCode === 13 && !evt.shiftKey) {
|
2015-05-23 19:57:47 +02:00
|
|
|
evt.preventDefault();
|
2015-09-03 23:12:46 +02:00
|
|
|
const $form = $(evt.currentTarget).closest('form');
|
2015-05-27 17:17:00 +02:00
|
|
|
// XXX For some reason $form.submit() does not work (it's probably a bug
|
|
|
|
// of blaze-component related to the fact that the submit event is non-
|
|
|
|
// bubbling). This is why we click on the submit button instead -- which
|
|
|
|
// work.
|
|
|
|
$form.find('button[type=submit]').click();
|
2015-05-23 19:57:47 +02:00
|
|
|
|
2019-02-24 00:13:35 +01:00
|
|
|
// Pressing Tab should open the form of the next column, and Maj+Tab go
|
|
|
|
// in the reverse order
|
2015-05-23 19:57:47 +02:00
|
|
|
} else if (evt.keyCode === 9) {
|
|
|
|
evt.preventDefault();
|
2015-09-03 23:12:46 +02:00
|
|
|
const isReverse = evt.shiftKey;
|
|
|
|
const list = $(`#js-list-${this.data().listId}`);
|
|
|
|
const listSelector = '.js-list:not(.js-list-composer)';
|
|
|
|
let nextList = list[isReverse ? 'prev' : 'next'](listSelector).get(0);
|
2015-06-06 12:07:52 +02:00
|
|
|
// If there is no next list, loop back to the beginning.
|
2015-09-03 23:12:46 +02:00
|
|
|
if (!nextList) {
|
2015-05-23 19:57:47 +02:00
|
|
|
nextList = $(listSelector + (isReverse ? ':last' : ':first')).get(0);
|
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
|
|
|
}
|
2015-05-23 19:57:47 +02:00
|
|
|
|
|
|
|
BlazeComponent.getComponentForElement(nextList).openForm({
|
2019-06-28 12:52:09 -05:00
|
|
|
position: this.data().position,
|
2015-05-23 19:57:47 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-09-03 23:12:46 +02:00
|
|
|
events() {
|
2019-06-28 12:52:09 -05:00
|
|
|
return [
|
|
|
|
{
|
|
|
|
keydown: this.pressKey,
|
|
|
|
'click .js-link': Popup.open('linkCard'),
|
|
|
|
'click .js-search': Popup.open('searchElement'),
|
|
|
|
'click .js-card-template': Popup.open('searchElement'),
|
|
|
|
},
|
|
|
|
];
|
2015-09-03 23:12:46 +02:00
|
|
|
},
|
2015-10-03 15:58:36 -06:00
|
|
|
|
|
|
|
onRendered() {
|
2015-10-31 09:26:55 -07:00
|
|
|
const editor = this;
|
2015-12-09 22:55:30 -05:00
|
|
|
const $textarea = this.$('textarea');
|
|
|
|
|
|
|
|
autosize($textarea);
|
|
|
|
|
2019-06-28 12:52:09 -05:00
|
|
|
$textarea.escapeableTextComplete(
|
|
|
|
[
|
|
|
|
// User mentions
|
|
|
|
{
|
|
|
|
match: /\B@([\w.]*)$/,
|
|
|
|
search(term, callback) {
|
|
|
|
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
|
|
|
callback(
|
|
|
|
$.map(currentBoard.activeMembers(), member => {
|
|
|
|
const user = Users.findOne(member.userId);
|
|
|
|
return user.username.indexOf(term) === 0 ? user : null;
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
template(user) {
|
|
|
|
return user.username;
|
|
|
|
},
|
|
|
|
replace(user) {
|
|
|
|
toggleValueInReactiveArray(editor.members, user._id);
|
|
|
|
return '';
|
|
|
|
},
|
|
|
|
index: 1,
|
2015-10-03 15:58:36 -06:00
|
|
|
},
|
|
|
|
|
2019-06-28 12:52:09 -05:00
|
|
|
// Labels
|
|
|
|
{
|
|
|
|
match: /\B#(\w*)$/,
|
|
|
|
search(term, callback) {
|
|
|
|
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
|
|
|
callback(
|
|
|
|
$.map(currentBoard.labels, label => {
|
|
|
|
if (
|
|
|
|
label.name.indexOf(term) > -1 ||
|
|
|
|
label.color.indexOf(term) > -1
|
|
|
|
) {
|
|
|
|
return label;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
template(label) {
|
|
|
|
return Blaze.toHTMLWithData(Template.autocompleteLabelLine, {
|
|
|
|
hasNoName: !label.name,
|
|
|
|
colorName: label.color,
|
|
|
|
labelName: label.name || label.color,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
replace(label) {
|
|
|
|
toggleValueInReactiveArray(editor.labels, label._id);
|
|
|
|
return '';
|
|
|
|
},
|
|
|
|
index: 1,
|
2015-10-03 15:58:36 -06:00
|
|
|
},
|
2019-06-28 12:52:09 -05:00
|
|
|
],
|
|
|
|
{
|
|
|
|
// When the autocomplete menu is shown we want both a press of both `Tab`
|
|
|
|
// or `Enter` to validation the auto-completion. We also need to stop the
|
|
|
|
// event propagation to prevent the card from submitting (on `Enter`) or
|
|
|
|
// going on the next column (on `Tab`).
|
|
|
|
onKeydown(evt, commands) {
|
|
|
|
if (evt.keyCode === 9 || evt.keyCode === 13) {
|
|
|
|
evt.stopPropagation();
|
|
|
|
return commands.KEY_ENTER;
|
|
|
|
}
|
|
|
|
return null;
|
2015-10-03 15:58:36 -06:00
|
|
|
},
|
|
|
|
},
|
2019-06-28 12:52:09 -05:00
|
|
|
);
|
2015-10-03 15:58:36 -06:00
|
|
|
},
|
2015-05-23 19:57:47 +02:00
|
|
|
}).register('addCardForm');
|
2018-03-20 00:13:42 -03:00
|
|
|
|
|
|
|
BlazeComponent.extendComponent({
|
|
|
|
onCreated() {
|
2019-02-23 15:32:44 +01:00
|
|
|
this.selectedBoardId = new ReactiveVar('');
|
2018-03-20 15:56:16 -03:00
|
|
|
this.selectedSwimlaneId = new ReactiveVar('');
|
|
|
|
this.selectedListId = new ReactiveVar('');
|
|
|
|
|
|
|
|
this.boardId = Session.get('currentBoard');
|
|
|
|
// In order to get current board info
|
2019-05-13 11:01:50 +02:00
|
|
|
subManager.subscribe('board', this.boardId, false);
|
2018-04-18 01:42:55 -03:00
|
|
|
this.board = Boards.findOne(this.boardId);
|
2018-03-20 15:56:16 -03:00
|
|
|
// List where to insert card
|
|
|
|
const list = $(Popup._getTopStack().openerElement).closest('.js-list');
|
|
|
|
this.listId = Blaze.getData(list[0])._id;
|
|
|
|
// Swimlane where to insert card
|
2019-06-28 12:52:09 -05:00
|
|
|
const swimlane = $(Popup._getTopStack().openerElement).closest(
|
|
|
|
'.js-swimlane',
|
|
|
|
);
|
2018-03-20 15:56:16 -03:00
|
|
|
this.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')
|
2018-03-20 15:56:16 -03:00
|
|
|
this.swimlaneId = Blaze.getData(swimlane[0])._id;
|
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 if (Utils.boardView() === 'board-view-lists' || !Utils.boardView)
|
2019-06-28 12:52:09 -05:00
|
|
|
this.swimlaneId = Swimlanes.findOne({ boardId: this.boardId })._id;
|
2018-03-20 00:13:42 -03:00
|
|
|
},
|
|
|
|
|
|
|
|
boards() {
|
2019-06-28 12:52:09 -05:00
|
|
|
const boards = Boards.find(
|
|
|
|
{
|
|
|
|
archived: false,
|
|
|
|
'members.userId': Meteor.userId(),
|
|
|
|
_id: { $ne: Session.get('currentBoard') },
|
|
|
|
type: 'board',
|
|
|
|
},
|
|
|
|
{
|
2020-04-19 12:30:21 +03:00
|
|
|
sort: { sort: 1 /* boards default sorting */ },
|
2019-06-28 12:52:09 -05:00
|
|
|
},
|
|
|
|
);
|
2018-03-20 00:13:42 -03:00
|
|
|
return boards;
|
|
|
|
},
|
|
|
|
|
|
|
|
swimlanes() {
|
2019-02-23 15:32:44 +01:00
|
|
|
if (!this.selectedBoardId.get()) {
|
2018-09-12 22:27:24 +02:00
|
|
|
return [];
|
|
|
|
}
|
2019-06-28 12:52:09 -05:00
|
|
|
const swimlanes = Swimlanes.find({ boardId: this.selectedBoardId.get() });
|
2018-03-20 15:56:16 -03:00
|
|
|
if (swimlanes.count())
|
|
|
|
this.selectedSwimlaneId.set(swimlanes.fetch()[0]._id);
|
|
|
|
return swimlanes;
|
2018-03-20 00:13:42 -03:00
|
|
|
},
|
|
|
|
|
|
|
|
lists() {
|
2019-02-23 15:32:44 +01:00
|
|
|
if (!this.selectedBoardId.get()) {
|
2018-09-12 22:27:24 +02:00
|
|
|
return [];
|
|
|
|
}
|
2019-06-28 12:52:09 -05:00
|
|
|
const lists = Lists.find({ boardId: this.selectedBoardId.get() });
|
|
|
|
if (lists.count()) this.selectedListId.set(lists.fetch()[0]._id);
|
2018-03-20 15:56:16 -03:00
|
|
|
return lists;
|
2018-03-20 00:13:42 -03:00
|
|
|
},
|
|
|
|
|
|
|
|
cards() {
|
2018-09-12 22:27:24 +02:00
|
|
|
if (!this.board) {
|
|
|
|
return [];
|
|
|
|
}
|
2019-06-28 12:52:09 -05:00
|
|
|
const ownCardsIds = this.board.cards().map(card => {
|
|
|
|
return card.linkedId || card._id;
|
|
|
|
});
|
2018-03-20 15:56:16 -03:00
|
|
|
return Cards.find({
|
|
|
|
boardId: this.selectedBoardId.get(),
|
|
|
|
swimlaneId: this.selectedSwimlaneId.get(),
|
|
|
|
listId: this.selectedListId.get(),
|
|
|
|
archived: false,
|
2019-06-28 12:52:09 -05:00
|
|
|
linkedId: { $nin: ownCardsIds },
|
|
|
|
_id: { $nin: ownCardsIds },
|
|
|
|
type: { $nin: ['template-card'] },
|
2018-03-20 15:56:16 -03:00
|
|
|
});
|
2018-03-20 00:13:42 -03:00
|
|
|
},
|
|
|
|
|
|
|
|
events() {
|
2019-06-28 12:52:09 -05:00
|
|
|
return [
|
|
|
|
{
|
|
|
|
'change .js-select-boards'(evt) {
|
|
|
|
subManager.subscribe('board', $(evt.currentTarget).val(), false);
|
|
|
|
this.selectedBoardId.set($(evt.currentTarget).val());
|
|
|
|
},
|
|
|
|
'change .js-select-swimlanes'(evt) {
|
|
|
|
this.selectedSwimlaneId.set($(evt.currentTarget).val());
|
|
|
|
},
|
|
|
|
'change .js-select-lists'(evt) {
|
|
|
|
this.selectedListId.set($(evt.currentTarget).val());
|
|
|
|
},
|
|
|
|
'click .js-done'(evt) {
|
|
|
|
// LINK CARD
|
|
|
|
evt.stopPropagation();
|
|
|
|
evt.preventDefault();
|
|
|
|
const linkedId = $('.js-select-cards option:selected').val();
|
|
|
|
if (!linkedId) {
|
|
|
|
Popup.close();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const _id = Cards.insert({
|
|
|
|
title: $('.js-select-cards option:selected').text(), //dummy
|
|
|
|
listId: this.listId,
|
|
|
|
swimlaneId: this.swimlaneId,
|
|
|
|
boardId: this.boardId,
|
|
|
|
sort: Lists.findOne(this.listId)
|
|
|
|
.cards()
|
|
|
|
.count(),
|
|
|
|
type: 'cardType-linkedCard',
|
|
|
|
linkedId,
|
|
|
|
});
|
|
|
|
Filter.addException(_id);
|
2018-09-12 22:27:24 +02:00
|
|
|
Popup.close();
|
2019-06-28 12:52:09 -05:00
|
|
|
},
|
|
|
|
'click .js-link-board'(evt) {
|
|
|
|
//LINK BOARD
|
|
|
|
evt.stopPropagation();
|
|
|
|
evt.preventDefault();
|
|
|
|
const impBoardId = $('.js-select-boards option:selected').val();
|
|
|
|
if (
|
|
|
|
!impBoardId ||
|
|
|
|
Cards.findOne({ linkedId: impBoardId, archived: false })
|
|
|
|
) {
|
|
|
|
Popup.close();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const _id = Cards.insert({
|
|
|
|
title: $('.js-select-boards option:selected').text(), //dummy
|
|
|
|
listId: this.listId,
|
|
|
|
swimlaneId: this.swimlaneId,
|
|
|
|
boardId: this.boardId,
|
|
|
|
sort: Lists.findOne(this.listId)
|
|
|
|
.cards()
|
|
|
|
.count(),
|
|
|
|
type: 'cardType-linkedBoard',
|
|
|
|
linkedId: impBoardId,
|
|
|
|
});
|
|
|
|
Filter.addException(_id);
|
2018-09-12 22:27:24 +02:00
|
|
|
Popup.close();
|
2019-06-28 12:52:09 -05:00
|
|
|
},
|
2018-03-20 00:13:42 -03:00
|
|
|
},
|
2019-06-28 12:52:09 -05:00
|
|
|
];
|
2018-03-20 00:13:42 -03:00
|
|
|
},
|
2018-05-02 15:03:22 -03:00
|
|
|
}).register('linkCardPopup');
|
2018-03-20 00:13:42 -03:00
|
|
|
|
|
|
|
BlazeComponent.extendComponent({
|
|
|
|
mixins() {
|
2020-08-28 11:46:51 +01:00
|
|
|
return [];
|
2018-03-20 00:13:42 -03:00
|
|
|
},
|
|
|
|
|
|
|
|
onCreated() {
|
2019-06-28 12:52:09 -05:00
|
|
|
this.isCardTemplateSearch = $(Popup._getTopStack().openerElement).hasClass(
|
|
|
|
'js-card-template',
|
|
|
|
);
|
|
|
|
this.isListTemplateSearch = $(Popup._getTopStack().openerElement).hasClass(
|
|
|
|
'js-list-template',
|
|
|
|
);
|
|
|
|
this.isSwimlaneTemplateSearch = $(
|
|
|
|
Popup._getTopStack().openerElement,
|
|
|
|
).hasClass('js-open-add-swimlane-menu');
|
|
|
|
this.isBoardTemplateSearch = $(Popup._getTopStack().openerElement).hasClass(
|
|
|
|
'js-add-board',
|
|
|
|
);
|
|
|
|
this.isTemplateSearch =
|
|
|
|
this.isCardTemplateSearch ||
|
2019-02-25 22:48:25 +01:00
|
|
|
this.isListTemplateSearch ||
|
|
|
|
this.isSwimlaneTemplateSearch ||
|
|
|
|
this.isBoardTemplateSearch;
|
2019-02-23 15:32:44 +01:00
|
|
|
let board = {};
|
2019-02-23 16:36:29 +01:00
|
|
|
if (this.isTemplateSearch) {
|
2019-05-09 14:32:38 +03:00
|
|
|
board = Boards.findOne((Meteor.user().profile || {}).templatesBoardId);
|
2019-02-23 15:32:44 +01:00
|
|
|
} else {
|
|
|
|
// Prefetch first non-current board id
|
|
|
|
board = Boards.findOne({
|
|
|
|
archived: false,
|
|
|
|
'members.userId': Meteor.userId(),
|
2019-06-28 12:52:09 -05:00
|
|
|
_id: {
|
|
|
|
$nin: [
|
|
|
|
Session.get('currentBoard'),
|
|
|
|
(Meteor.user().profile || {}).templatesBoardId,
|
|
|
|
],
|
|
|
|
},
|
2019-02-23 15:32:44 +01:00
|
|
|
});
|
|
|
|
}
|
2018-09-12 22:27:24 +02:00
|
|
|
if (!board) {
|
|
|
|
Popup.close();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const boardId = board._id;
|
2018-03-20 15:56:16 -03:00
|
|
|
// Subscribe to this board
|
2019-05-13 11:01:50 +02:00
|
|
|
subManager.subscribe('board', boardId, false);
|
2018-03-20 00:40:24 -03:00
|
|
|
this.selectedBoardId = new ReactiveVar(boardId);
|
2018-03-20 15:56:16 -03:00
|
|
|
|
2019-02-25 22:48:25 +01:00
|
|
|
if (!this.isBoardTemplateSearch) {
|
|
|
|
this.boardId = Session.get('currentBoard');
|
|
|
|
// In order to get current board info
|
2019-05-13 11:01:50 +02:00
|
|
|
subManager.subscribe('board', this.boardId, false);
|
2019-02-25 22:48:25 +01:00
|
|
|
this.swimlaneId = '';
|
|
|
|
// Swimlane where to insert card
|
2019-06-28 12:52:09 -05:00
|
|
|
const swimlane = $(Popup._getTopStack().openerElement).parents(
|
|
|
|
'.js-swimlane',
|
|
|
|
);
|
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-02-25 22:48:25 +01:00
|
|
|
this.swimlaneId = Blaze.getData(swimlane[0])._id;
|
2019-06-28 12:52:09 -05:00
|
|
|
else this.swimlaneId = Swimlanes.findOne({ boardId: this.boardId })._id;
|
2019-02-25 22:48:25 +01:00
|
|
|
// List where to insert card
|
|
|
|
const list = $(Popup._getTopStack().openerElement).closest('.js-list');
|
|
|
|
this.listId = Blaze.getData(list[0])._id;
|
|
|
|
}
|
2018-03-20 00:13:42 -03:00
|
|
|
this.term = new ReactiveVar('');
|
|
|
|
},
|
|
|
|
|
|
|
|
boards() {
|
2019-06-28 12:52:09 -05:00
|
|
|
const boards = Boards.find(
|
|
|
|
{
|
|
|
|
archived: false,
|
|
|
|
'members.userId': Meteor.userId(),
|
|
|
|
_id: { $ne: Session.get('currentBoard') },
|
|
|
|
type: 'board',
|
|
|
|
},
|
|
|
|
{
|
2020-04-19 12:30:21 +03:00
|
|
|
sort: { sort: 1 /* boards default sorting */ },
|
2019-06-28 12:52:09 -05:00
|
|
|
},
|
|
|
|
);
|
2018-03-20 00:13:42 -03:00
|
|
|
return boards;
|
|
|
|
},
|
|
|
|
|
|
|
|
results() {
|
2018-09-12 22:27:24 +02:00
|
|
|
if (!this.selectedBoardId) {
|
|
|
|
return [];
|
|
|
|
}
|
2018-03-20 00:13:42 -03:00
|
|
|
const board = Boards.findOne(this.selectedBoardId.get());
|
2019-02-23 20:41:36 +01:00
|
|
|
if (!this.isTemplateSearch || this.isCardTemplateSearch) {
|
2019-02-24 00:13:35 +01:00
|
|
|
return board.searchCards(this.term.get(), false);
|
2019-02-23 20:41:36 +01:00
|
|
|
} else if (this.isListTemplateSearch) {
|
2019-02-24 00:13:35 +01:00
|
|
|
return board.searchLists(this.term.get());
|
2019-02-23 20:41:36 +01:00
|
|
|
} else if (this.isSwimlaneTemplateSearch) {
|
2019-02-24 00:13:35 +01:00
|
|
|
return board.searchSwimlanes(this.term.get());
|
2019-02-25 22:48:25 +01:00
|
|
|
} else if (this.isBoardTemplateSearch) {
|
|
|
|
const boards = board.searchBoards(this.term.get());
|
2019-06-28 12:52:09 -05:00
|
|
|
boards.forEach(board => {
|
2019-05-13 11:01:50 +02:00
|
|
|
subManager.subscribe('board', board.linkedId, false);
|
2019-02-25 22:48:25 +01:00
|
|
|
});
|
|
|
|
return boards;
|
2019-02-23 20:41:36 +01:00
|
|
|
} else {
|
2019-02-24 00:13:35 +01:00
|
|
|
return [];
|
2019-02-23 20:41:36 +01:00
|
|
|
}
|
2018-03-20 00:13:42 -03:00
|
|
|
},
|
|
|
|
|
|
|
|
events() {
|
2019-06-28 12:52:09 -05:00
|
|
|
return [
|
|
|
|
{
|
|
|
|
'change .js-select-boards'(evt) {
|
|
|
|
subManager.subscribe('board', $(evt.currentTarget).val(), false);
|
|
|
|
this.selectedBoardId.set($(evt.currentTarget).val());
|
|
|
|
},
|
|
|
|
'submit .js-search-term-form'(evt) {
|
|
|
|
evt.preventDefault();
|
|
|
|
this.term.set(evt.target.searchTerm.value);
|
|
|
|
},
|
|
|
|
'click .js-minicard'(evt) {
|
|
|
|
// 0. Common
|
|
|
|
const title = $('.js-element-title')
|
|
|
|
.val()
|
|
|
|
.trim();
|
|
|
|
if (!title) return;
|
|
|
|
const element = Blaze.getData(evt.currentTarget);
|
|
|
|
element.title = title;
|
|
|
|
let _id = '';
|
|
|
|
if (!this.isTemplateSearch || this.isCardTemplateSearch) {
|
|
|
|
// Card insertion
|
|
|
|
// 1. Common
|
|
|
|
element.sort = Lists.findOne(this.listId)
|
|
|
|
.cards()
|
|
|
|
.count();
|
|
|
|
// 1.A From template
|
|
|
|
if (this.isTemplateSearch) {
|
|
|
|
element.type = 'cardType-card';
|
|
|
|
element.linkedId = '';
|
|
|
|
_id = element.copy(this.boardId, this.swimlaneId, this.listId);
|
|
|
|
// 1.B Linked card
|
|
|
|
} else {
|
2020-04-29 22:38:50 +02:00
|
|
|
_id = element.link(this.boardId, this.swimlaneId, this.listId);
|
2019-06-28 12:52:09 -05:00
|
|
|
}
|
|
|
|
Filter.addException(_id);
|
|
|
|
// List insertion
|
|
|
|
} else if (this.isListTemplateSearch) {
|
|
|
|
element.sort = Swimlanes.findOne(this.swimlaneId)
|
|
|
|
.lists()
|
|
|
|
.count();
|
|
|
|
element.type = 'list';
|
|
|
|
_id = element.copy(this.boardId, this.swimlaneId);
|
|
|
|
} else if (this.isSwimlaneTemplateSearch) {
|
|
|
|
element.sort = Boards.findOne(this.boardId)
|
|
|
|
.swimlanes()
|
|
|
|
.count();
|
2020-04-30 01:51:54 +02:00
|
|
|
element.type = 'swimlane';
|
2019-06-28 12:52:09 -05:00
|
|
|
_id = element.copy(this.boardId);
|
|
|
|
} else if (this.isBoardTemplateSearch) {
|
2021-01-22 12:49:48 +02:00
|
|
|
Meteor.call(
|
|
|
|
'copyBoard',
|
|
|
|
element.linkedId,
|
|
|
|
{
|
|
|
|
sort: Boards.find({ archived: false }).count(),
|
|
|
|
type: 'board',
|
|
|
|
title: element.title,
|
|
|
|
},
|
|
|
|
(err, data) => {
|
|
|
|
_id = data;
|
|
|
|
},
|
|
|
|
);
|
2019-02-23 20:41:36 +01:00
|
|
|
}
|
2019-06-28 12:52:09 -05:00
|
|
|
Popup.close();
|
|
|
|
},
|
2018-03-20 00:13:42 -03:00
|
|
|
},
|
2019-06-28 12:52:09 -05:00
|
|
|
];
|
2018-03-20 00:13:42 -03:00
|
|
|
},
|
2019-02-23 23:07:54 +01:00
|
|
|
}).register('searchElementPopup');
|
2019-03-30 19:06:09 +02:00
|
|
|
|
|
|
|
BlazeComponent.extendComponent({
|
|
|
|
onCreated() {
|
|
|
|
this.cardlimit = this.parentComponent().cardlimit;
|
2019-04-01 23:35:12 +02:00
|
|
|
|
|
|
|
this.listId = this.parentComponent().data()._id;
|
|
|
|
this.swimlaneId = '';
|
|
|
|
|
2019-08-26 23:24:13 +03:00
|
|
|
const isSandstorm =
|
|
|
|
Meteor.settings &&
|
|
|
|
Meteor.settings.public &&
|
|
|
|
Meteor.settings.public.sandstorm;
|
|
|
|
|
|
|
|
if (isSandstorm) {
|
|
|
|
const user = Meteor.user();
|
|
|
|
if (user) {
|
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-08-26 23:24:13 +03:00
|
|
|
this.swimlaneId = this.parentComponent()
|
|
|
|
.parentComponent()
|
|
|
|
.parentComponent()
|
|
|
|
.data()._id;
|
|
|
|
}
|
|
|
|
}
|
2019-11-19 21:55:43 +02:00
|
|
|
} else if (Utils.boardView() === 'board-view-swimlanes') {
|
|
|
|
this.swimlaneId = this.parentComponent()
|
|
|
|
.parentComponent()
|
|
|
|
.parentComponent()
|
|
|
|
.data()._id;
|
2019-08-26 10:10:57 +00:00
|
|
|
}
|
2019-03-30 19:06:09 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
onRendered() {
|
2019-04-01 23:35:12 +02:00
|
|
|
this.spinner = this.find('.sk-spinner-list');
|
2020-08-28 11:46:51 +01:00
|
|
|
this.container = this.$(this.spinner).parents('.list-body')[0];
|
2019-03-30 19:06:09 +02:00
|
|
|
|
2019-06-28 12:52:09 -05:00
|
|
|
$(this.container).on(
|
|
|
|
`scroll.spinner_${this.swimlaneId}_${this.listId}`,
|
|
|
|
() => this.updateList(),
|
|
|
|
);
|
|
|
|
$(window).on(`resize.spinner_${this.swimlaneId}_${this.listId}`, () =>
|
|
|
|
this.updateList(),
|
|
|
|
);
|
2019-04-01 23:35:12 +02:00
|
|
|
|
|
|
|
this.updateList();
|
2019-03-30 19:06:09 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
onDestroyed() {
|
2019-04-01 23:35:12 +02:00
|
|
|
$(this.container).off(`scroll.spinner_${this.swimlaneId}_${this.listId}`);
|
|
|
|
$(window).off(`resize.spinner_${this.swimlaneId}_${this.listId}`);
|
2019-03-30 19:06:09 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
updateList() {
|
2020-02-22 16:32:54 +02:00
|
|
|
// Use fallback when requestIdleCallback is not available on iOS and Safari
|
|
|
|
// https://www.afasterweb.com/2017/11/20/utilizing-idle-moments/
|
|
|
|
checkIdleTime =
|
|
|
|
window.requestIdleCallback ||
|
|
|
|
function(handler) {
|
|
|
|
const startTime = Date.now();
|
|
|
|
return setTimeout(function() {
|
|
|
|
handler({
|
|
|
|
didTimeout: false,
|
|
|
|
timeRemaining() {
|
|
|
|
return Math.max(0, 50.0 - (Date.now() - startTime));
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}, 1);
|
|
|
|
};
|
|
|
|
|
2019-04-01 23:35:12 +02:00
|
|
|
if (this.spinnerInView()) {
|
2019-03-30 19:06:09 +02:00
|
|
|
this.cardlimit.set(this.cardlimit.get() + InfiniteScrollIter);
|
2020-02-22 16:32:54 +02:00
|
|
|
checkIdleTime(() => this.updateList());
|
2019-03-30 19:06:09 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2019-04-01 23:35:12 +02:00
|
|
|
spinnerInView() {
|
|
|
|
const parentViewHeight = this.container.clientHeight;
|
|
|
|
const bottomViewPosition = this.container.scrollTop + parentViewHeight;
|
|
|
|
|
|
|
|
const threshold = this.spinner.offsetTop;
|
|
|
|
|
|
|
|
// spinner deleted
|
|
|
|
if (!this.spinner.offsetTop) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bottomViewPosition > threshold;
|
|
|
|
},
|
2019-03-30 19:06:09 +02:00
|
|
|
}).register('spinnerList');
|