From bb085aa9a80d9fe63b2510f988638cc0a62e917e Mon Sep 17 00:00:00 2001 From: moanos Date: Wed, 23 Apr 2025 21:12:22 +0200 Subject: [PATCH] feat: Add basic bulma version of comment form --- src/fellchensammlung/forms.py | 2 +- .../details/bulma-detail-adoption-notice.html | 2 +- .../forms/bulma-form-comment.html | 15 +++++++++++ .../bulma-partial-comment-section.html | 25 +++++++++++++++++++ 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 src/fellchensammlung/templates/fellchensammlung/forms/bulma-form-comment.html create mode 100644 src/fellchensammlung/templates/fellchensammlung/partials/bulma-partial-comment-section.html diff --git a/src/fellchensammlung/forms.py b/src/fellchensammlung/forms.py index 839187a..84c8668 100644 --- a/src/fellchensammlung/forms.py +++ b/src/fellchensammlung/forms.py @@ -164,7 +164,7 @@ class CommentForm(forms.ModelForm): self.helper = FormHelper() self.helper.form_class = 'form-comments' self.helper.add_input(Hidden('action', 'comment')) - self.helper.add_input(Submit('submit', _('Kommentieren'), css_class="btn2")) + self.helper.add_input(Submit('submit', _('Kommentieren'), css_class="button is-primary")) class Meta: model = Comment diff --git a/src/fellchensammlung/templates/fellchensammlung/details/bulma-detail-adoption-notice.html b/src/fellchensammlung/templates/fellchensammlung/details/bulma-detail-adoption-notice.html index 0300a86..76f9433 100644 --- a/src/fellchensammlung/templates/fellchensammlung/details/bulma-detail-adoption-notice.html +++ b/src/fellchensammlung/templates/fellchensammlung/details/bulma-detail-adoption-notice.html @@ -126,6 +126,6 @@ {% endfor %} - {% include "fellchensammlung/partials/partial-comment-section.html" %} + {% include "fellchensammlung/partials/bulma-partial-comment-section.html" %} {% endblock %} diff --git a/src/fellchensammlung/templates/fellchensammlung/forms/bulma-form-comment.html b/src/fellchensammlung/templates/fellchensammlung/forms/bulma-form-comment.html new file mode 100644 index 0000000..a62f6f8 --- /dev/null +++ b/src/fellchensammlung/templates/fellchensammlung/forms/bulma-form-comment.html @@ -0,0 +1,15 @@ +{% load i18n %} +{% load crispy_forms_tags %} + +
+
+
+ {% blocktrans %} + Als {{ user }} kommentieren + {% endblocktrans %} +
+
+
+ {% crispy comment_form %} +
+
\ No newline at end of file diff --git a/src/fellchensammlung/templates/fellchensammlung/partials/bulma-partial-comment-section.html b/src/fellchensammlung/templates/fellchensammlung/partials/bulma-partial-comment-section.html new file mode 100644 index 0000000..a855e97 --- /dev/null +++ b/src/fellchensammlung/templates/fellchensammlung/partials/bulma-partial-comment-section.html @@ -0,0 +1,25 @@ +{% load i18n %} + +
+
+

{% translate 'Kommentare' %}

+
+
+ {% if adoption_notice.comments %} + {% for comment in adoption_notice.comments %} + {% include "fellchensammlung/partials/partial-comment.html" %} + {% endfor %} + {% else %} +

{% translate 'Noch keine Kommentare' %}

+ {% endif %} +
+ +
\ No newline at end of file