Skip to content

Commit

Permalink
feat(questions): allow an admin to add a comment (#2012)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn authored May 29, 2024
1 parent 323abd3 commit 50a1964
Show file tree
Hide file tree
Showing 14 changed files with 201 additions and 80 deletions.
20 changes: 18 additions & 2 deletions contributions/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,35 @@
from core import constants


COMMENT_EDIT_FORM_FIELDS = [
COMMENT_CREATE_FORM_FIELDS = [
field.name for field in Comment._meta.fields if field.name not in Comment.COMMENT_READONLY_FIELDS
]
COMMENT_REPLY_CREATE_FORM_FIELDS = ["type", "text", "author", "parent", "status"]
COMMENT_REPLY_HIDDEN_FORM_FIELDS = ["parent", "status"]


class CommentCreateForm(forms.ModelForm):
class Meta:
model = Comment
fields = COMMENT_CREATE_FORM_FIELDS
widgets = {
"text": forms.Textarea(attrs={"rows": 3}),
"description": forms.Textarea(attrs={"rows": 3}),
}

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for field_name in ["type", "question", "quiz", "author", "publish"]:
self.fields[field_name].disabled = True
# see views.py for exceptions


class CommentEditForm(forms.ModelForm):
# publish = forms.BooleanField(required=False)

class Meta:
model = Comment
fields = COMMENT_EDIT_FORM_FIELDS
fields = COMMENT_CREATE_FORM_FIELDS
widgets = {
"text": forms.Textarea(attrs={"rows": 3}),
"description": forms.Textarea(attrs={"rows": 3}),
Expand Down
Binary file modified locale/de/LC_MESSAGES/django.mo
Binary file not shown.
38 changes: 23 additions & 15 deletions locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: quiz-anthropocene\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-02-21 00:44+0100\n"
"POT-Creation-Date: 2024-05-29 13:26+0200\n"
"PO-Revision-Date: 2024-03-28 17:14\n"
"Last-Translator: Didier Quirin <[email protected]>\n"
"Language-Team: German\n"
Expand Down Expand Up @@ -134,6 +134,15 @@ msgstr "Englisch"
msgid "French"
msgstr "Französisch"

msgid "Spanish"
msgstr "Spanisch"

msgid "Italian"
msgstr "Italienisch"

msgid "German"
msgstr "Deutsch"

msgid "Name"
msgstr "Name"

Expand Down Expand Up @@ -293,15 +302,6 @@ msgstr "In Bearbeitung"
msgid "Ignored"
msgstr "Ignoriert"

msgid "Spanish"
msgstr "Spanisch"

msgid "Italian"
msgstr "Italienisch"

msgid "German"
msgstr "Deutsch"

msgid "Public (exported and in the application)"
msgstr "Öffentlich (exportiert und in der Anwendung)"

Expand Down Expand Up @@ -470,6 +470,9 @@ msgstr "# Like"
msgid "# Dislike"
msgstr "# Dislike"

msgid "Relationship type"
msgstr "Beziehungstyp"

msgid "Quiz background image"
msgstr "Quiz Hintergrundbild"

Expand Down Expand Up @@ -530,9 +533,6 @@ msgstr "Durchschnittliche Zeit (Minuten)"
msgid "Order"
msgstr "Sortierung"

msgid "Relationship type"
msgstr "Beziehungstyp"

msgid "Positive"
msgstr "Positiv"

Expand Down Expand Up @@ -823,7 +823,6 @@ msgstr "Bitte schreibe dein Feedback bei Discord :)"
msgid "Hello %(first_name)s!"
msgstr "Hallo %(first_name)s!"

#| msgid "Welcome to the <strong>contributor interface</strong> of Quiz de l'Anthropocène."
msgid "Welcome to the <strong>contributor interface</strong> of the Anthropocene Quiz."
msgstr "Willkommen im <strong>Contributor Interface</strong> des Anthropozene Quiz."

Expand Down Expand Up @@ -953,6 +952,11 @@ msgstr "Sie können ein <strong>-Bild</strong> am Ende des Formulars hinzufügen
msgid "Quick tool to compress images:"
msgstr "Schnelles Werkzeug, um Bilder zu komprimieren:"

#, fuzzy
#| msgid "All comments"
msgid "Add a note"
msgstr "Alle Kommentare"

msgid "You are the <strong>author</strong> of this question"
msgstr "Sie sind der <strong>Autor</strong> dieser Frage"

Expand Down Expand Up @@ -1112,6 +1116,11 @@ msgstr "Das Glossarelement <strong>{glossary_item_name}</strong> wurde erstellt.
msgid "Author card created!"
msgstr "Autorenkarte erstellt!"

#, fuzzy
#| msgid "Author card created!"
msgid "Author card updated!"
msgstr "Autorenkarte erstellt!"

msgid "The question was updated."
msgstr "Die Frage wurde aktualisiert."

Expand All @@ -1135,4 +1144,3 @@ msgstr "Der Tag wurde aktualisiert."
#, python-brace-format
msgid "The tag <strong>{tag_name}</strong> was created."
msgstr "Der Tag <strong>{tag_name}</strong> wurde erstellt."

32 changes: 19 additions & 13 deletions locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-02-21 00:44+0100\n"
"POT-Creation-Date: 2024-05-29 13:26+0200\n"
"PO-Revision-Date: 2023-02-12 20:12+0100\n"
"Last-Translator: Didier Quirin <[email protected]>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -134,6 +134,15 @@ msgstr ""
msgid "French"
msgstr ""

msgid "Spanish"
msgstr ""

msgid "Italian"
msgstr ""

msgid "German"
msgstr ""

msgid "Name"
msgstr ""

Expand Down Expand Up @@ -293,15 +302,6 @@ msgstr ""
msgid "Ignored"
msgstr ""

msgid "Spanish"
msgstr ""

msgid "Italian"
msgstr ""

msgid "German"
msgstr ""

msgid "Public (exported and in the application)"
msgstr ""

Expand Down Expand Up @@ -470,6 +470,9 @@ msgstr ""
msgid "# Dislike"
msgstr ""

msgid "Relationship type"
msgstr ""

msgid "Quiz background image"
msgstr ""

Expand Down Expand Up @@ -530,9 +533,6 @@ msgstr ""
msgid "Order"
msgstr ""

msgid "Relationship type"
msgstr ""

msgid "Positive"
msgstr ""

Expand Down Expand Up @@ -954,6 +954,9 @@ msgstr ""
msgid "Quick tool to compress images:"
msgstr ""

msgid "Add a note"
msgstr ""

msgid "You are the <strong>author</strong> of this question"
msgstr ""

Expand Down Expand Up @@ -1113,6 +1116,9 @@ msgstr ""
msgid "Author card created!"
msgstr ""

msgid "Author card updated!"
msgstr ""

msgid "The question was updated."
msgstr ""

Expand Down
Binary file modified locale/es/LC_MESSAGES/django.mo
Binary file not shown.
38 changes: 23 additions & 15 deletions locale/es/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: quiz-anthropocene\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-02-21 00:44+0100\n"
"POT-Creation-Date: 2024-05-29 13:26+0200\n"
"PO-Revision-Date: 2024-03-28 17:14\n"
"Last-Translator: Didier Quirin <[email protected]>\n"
"Language-Team: Spanish\n"
Expand Down Expand Up @@ -134,6 +134,15 @@ msgstr "Inglés"
msgid "French"
msgstr "Francés"

msgid "Spanish"
msgstr "Español"

msgid "Italian"
msgstr "Italiano"

msgid "German"
msgstr "Alemán"

msgid "Name"
msgstr "Nombre"

Expand Down Expand Up @@ -293,15 +302,6 @@ msgstr "En progreso"
msgid "Ignored"
msgstr "Ignorado"

msgid "Spanish"
msgstr "Español"

msgid "Italian"
msgstr "Italiano"

msgid "German"
msgstr "Alemán"

msgid "Public (exported and in the application)"
msgstr "Público (exportado y en la aplicación)"

Expand Down Expand Up @@ -470,6 +470,9 @@ msgstr "# Me gusta"
msgid "# Dislike"
msgstr "# Dislike"

msgid "Relationship type"
msgstr "Tipo de relación"

msgid "Quiz background image"
msgstr "Imagen de fondo del cuestionario"

Expand Down Expand Up @@ -530,9 +533,6 @@ msgstr "Tiempo promedio (minutos)"
msgid "Order"
msgstr "Pedido"

msgid "Relationship type"
msgstr "Tipo de relación"

msgid "Positive"
msgstr "Positivo"

Expand Down Expand Up @@ -823,7 +823,6 @@ msgstr "Por favor publica tus comentarios sobre Discord :)"
msgid "Hello %(first_name)s!"
msgstr "¡Hola %(first_name)s!"

#| msgid "Welcome to the <strong>contributor interface</strong> of Quiz de l'Anthropocène."
msgid "Welcome to the <strong>contributor interface</strong> of the Anthropocene Quiz."
msgstr "Bienvenido a la interfaz <strong>contribuidor</strong> de Antropocene."

Expand Down Expand Up @@ -953,6 +952,11 @@ msgstr ""
msgid "Quick tool to compress images:"
msgstr "Herramienta rápida para comprimir imágenes:"

#, fuzzy
#| msgid "All comments"
msgid "Add a note"
msgstr "Todos los comentarios"

msgid "You are the <strong>author</strong> of this question"
msgstr ""

Expand Down Expand Up @@ -1112,6 +1116,11 @@ msgstr "Se ha creado el elemento de glosario <strong>{glossary_item_name}</stron
msgid "Author card created!"
msgstr "¡Tarjeta de autor creada!"

#, fuzzy
#| msgid "Author card created!"
msgid "Author card updated!"
msgstr "¡Tarjeta de autor creada!"

msgid "The question was updated."
msgstr "La pregunta fue actualizada."

Expand All @@ -1135,4 +1144,3 @@ msgstr "La etiqueta fue actualizada."
#, python-brace-format
msgid "The tag <strong>{tag_name}</strong> was created."
msgstr "Se ha creado la etiqueta <strong>{tag_name}</strong>."

Binary file modified locale/fr/LC_MESSAGES/django.mo
Binary file not shown.
Loading

0 comments on commit 50a1964

Please sign in to comment.