Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Waypoint triggered by comment-section. Now triggered by social-comment. #158

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion imports/ui_3/views/components/comments-section.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Template.Comments_section.onRendered(function chatboxOnRendered() {
// displayMessage('info', `You just seen ${topicId}`); // debug
Meteor.user().hasNowSeen(topicId);
},
offset: '80%',
offset: 'bottom-in-view',
});
// Above is nicer syntax , but requires bigu:jquery-waypoints https://stackoverflow.com/questions/28975693/using-jquery-waypoints-in-meteor
/* this.waypoint = this.$('.comment-section').waypoint(function (direction) {
Expand Down Expand Up @@ -71,6 +71,14 @@ Template.Comments_section.events({

const MAX_LENGTH = 400;

Template.Comment.onRendered(function () {
Waypoint.refreshAll();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nem kene itt valahova egy subscriptionsReady?
Amikor rajzoljuk ki a kommenteket, es rendereljuk ki oket sorba, mindegyik utan az osszes Waypoint-ot ujra fogjuk szamolni.
Sok comment eseten nem fogja ez baromira belassitani a board kirenderelest?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hát meg lehet azt csinálni valahogy, hogy egy child template onRendered eventje csak azután működjön, hogy a parent template subscriptionReady értéke true?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Biztos meglehet. Csak hivatkozni kene tudni innen a parent-ra.
A Blaze-ben is fel lehet hivatkozni ugy hogy ../
akkor itt is biztos lehet valahogy.
Akkor ugy jo lenne, ha csak akkor fut le, ha mar subscriptionReady van, es nem minden egyes komment utan.

});

Template.Comment.onDestroyed(function () {
Waypoint.refreshAll();
});

Template.Comment.helpers({
textTooLong() {
return this.text.length > MAX_LENGTH;
Expand Down