django-comments-xtd icon indicating copy to clipboard operation
django-comments-xtd copied to clipboard

Document how to (re)load JavaScript commentbox after page load

Open PetrDlouhy opened this issue 2 years ago • 4 comments

I would like to place the commentbox on modal dialog, so that new comments will show with new modal show for appropriate item. I am a bit confused from the documentation how to achieve that.

I don't see any clear JS call where I can put new window.comments_props or what to call after I change them.

PetrDlouhy avatar Sep 23 '21 08:09 PetrDlouhy

The ReactJS plugin will be gone with v3. I will replace it with a vanilla JavaScript implementation.

The reason is that Django applications are for the backend. And so, adding opinionated frontend code was a wrong decision (like using Twitter-Bootstrap). If the application provides an API, frontend code can access the backend functionality, and that should be enough. Also, using twitter-bootstrap could be done by extending the templates.

So I understand your confusion with the docs. The ReactJS plugin contains hard-coded twitter-bootstrap selectors and hooks, and there's no explanation on how to customize it. The ReactJS plugin is a take-it or leave-it. I don't like it that way, and I don't want to restrict the frontend to ReactJS and Twitter-bootstrap. And that's why v3 will be free of them. There is an open issue about it: #161.

That is just a clarification. Now, I can't quite understand what you want to do, you said that new comments will show with new modal show for appropriate item. Do you want to display comments within a modal, or just the reply form?

danirus avatar Sep 29 '21 06:09 danirus

What I want to do:

  • I have gallery of 3D assets.
  • After user clicks on each asset, it will open modal detail with large thumbnail, asset description and in the future also comments.
  • I want to reload the comments for each asset without need of reloading the whole page.

I did achieve that with the code in #336, but the code might be too hacky to be accepted.

In fact I am quite happy in my project about Twitter-bootstrap and I don't care that much about the ReactJS dependency. But I understand your reasons to change it.

PetrDlouhy avatar Sep 29 '21 07:09 PetrDlouhy

@danirus What is the current status of this issue? I have noticed, that the JS plugin has been rewritten to React Hooks. Was that change made with dynamic reloading in mind? How could the commentbox be reloaded?

Are there still plans to rewrite this once more for V3?

PetrDlouhy avatar Dec 21 '23 14:12 PetrDlouhy

I am not sure. So far I decided to update it and to keep the frontend opinions.

I started a rewrite of all the frontend in django-comments-ink. Also the backend has changed there too, there are additional models to help add more reactions other than like/dislike, and to vote for comments. But it is unfinished and right now I have no time to work on it. I overcomplicated the use of templates. So if I continue the first I will have to do is to review that.

danirus avatar Dec 22 '23 07:12 danirus