danirus / django-comments-xtd

A pluggable Django comments application with thread support, follow-up notifications, mail confirmation, like/dislike flags, moderation, a ReactJS plugin and Bootstrap 5.3.
https://django-comments-xtd.readthedocs.io
BSD 2-Clause "Simplified" License
595 stars 158 forks source link

feat(react): on the fly #419

Open Mte90 opened 5 months ago

Mte90 commented 5 months ago

Ref: https://github.com/danirus/django-comments-xtd/issues/418

So this PR implements:

This requires some updates to the documentation:

<div class="comments-wrapper">
  <span class="comments-props" data-comments='{% get_commentbox_props for object %}'></span>

  <div class="comments">
    {% render_xtdcomment_tree for object allow_flagging allow_feedback %}
  </div>
</div>
Mte90 commented 5 months ago

I am working on a fix to avoid a new app execution.

danirus commented 4 months ago

This solution, trying to combine the case in which the hook for the ReactJS plugin does not exist with the case in which it does exist is overcomplicated. If you need the JavaScript plugin to be loaded when certain conditions are met, you could inject the plugin then instead.

Covering the two cases makes the code difficult to understand, specially when it is not documented. I appreciate your willing to help extend the functionality of this application. I thank you for that. But frontend-wise, it's much cleaner to fork the project and build the frontend plugin the way you want it apart. The backend code won't change much since it is stable since very long ago.

For an extended explanation on why I don't want to over complicate the frontend code, please read my comment in the PR #420.

Thank you again.

Mte90 commented 4 months ago

Inject the plugin is not an easy task as depends on how the UI is built, instead in this way the library itself monitor for new stuff in the DOM and supports also this way to load the options.

I can document it better if this is the problem. I understand your issue to not overcomplicate the frontende code but looking at the tickets and the project history (to develop a new UI) those changes are tiny workaround that let's to get everything without to wait for a new one.