mirror of
https://github.com/wekan/wekan.git
synced 2025-12-30 22:28:49 +01:00
Fix card infinite scrolling on card activities
I imagine blaze-component changed their Mixins API since I written this code. We need some tests to avoid this kind of regressions when updating dependencies! Fixes #420
This commit is contained in:
parent
8c01d51577
commit
46747b01fb
3 changed files with 8 additions and 11 deletions
|
|
@ -8,8 +8,11 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
calculateNextPeak() {
|
calculateNextPeak() {
|
||||||
const altitude = this.find('.js-card-details').scrollHeight;
|
const cardElement = this.find('.js-card-details');
|
||||||
this.callFirstWith(this, 'setNextPeak', altitude);
|
if (cardElement) {
|
||||||
|
const altitude = cardElement.scrollHeight;
|
||||||
|
this.callFirstWith(this, 'setNextPeak', altitude);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
reachNextPeak() {
|
reachNextPeak() {
|
||||||
|
|
@ -21,6 +24,7 @@ BlazeComponent.extendComponent({
|
||||||
this.isLoaded = new ReactiveVar(false);
|
this.isLoaded = new ReactiveVar(false);
|
||||||
this.parentComponent().showOverlay.set(true);
|
this.parentComponent().showOverlay.set(true);
|
||||||
this.parentComponent().mouseHasEnterCardDetails = false;
|
this.parentComponent().mouseHasEnterCardDetails = false;
|
||||||
|
this.calculateNextPeak();
|
||||||
},
|
},
|
||||||
|
|
||||||
scrollParentContainer() {
|
scrollParentContainer() {
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,6 @@ Mixins.InfiniteScrolling = BlazeComponent.extendComponent({
|
||||||
this._nextPeak = Infinity;
|
this._nextPeak = Infinity;
|
||||||
},
|
},
|
||||||
|
|
||||||
// To be overwritten by consumers of this mixin
|
|
||||||
reachNextPeak() {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
events() {
|
events() {
|
||||||
return [{
|
return [{
|
||||||
scroll(evt) {
|
scroll(evt) {
|
||||||
|
|
@ -29,7 +24,7 @@ Mixins.InfiniteScrolling = BlazeComponent.extendComponent({
|
||||||
let altitude = domElement.scrollTop + domElement.offsetHeight;
|
let altitude = domElement.scrollTop + domElement.offsetHeight;
|
||||||
altitude += peakAnticipation;
|
altitude += peakAnticipation;
|
||||||
if (altitude >= this.callFirstWith(null, 'getNextPeak')) {
|
if (altitude >= this.callFirstWith(null, 'getNextPeak')) {
|
||||||
this.callFirstWith(null, 'reachNextPeak');
|
this.mixinParent().callFirstWith(null, 'reachNextPeak');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}];
|
}];
|
||||||
|
|
|
||||||
|
|
@ -94,9 +94,7 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
events() {
|
events() {
|
||||||
// XXX Hacky, we need some kind of `super`
|
return [{
|
||||||
const mixinEvents = this.getMixin(Mixins.InfiniteScrolling).events();
|
|
||||||
return [...mixinEvents, {
|
|
||||||
'click .js-hide-sidebar': this.hide,
|
'click .js-hide-sidebar': this.hide,
|
||||||
'click .js-toggle-sidebar': this.toggle,
|
'click .js-toggle-sidebar': this.toggle,
|
||||||
'click .js-back-home': this.setView,
|
'click .js-back-home': this.setView,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue