Skip to content

Commit

Permalink
Add options for mailing list footers without subscribe link (#582)
Browse files Browse the repository at this point in the history
* use generated html for TencaListOptionsForm

* Render label as HTML tag connected to the input

* Add field for footer property

Depends on tzwenn/tenca#1

* Use tenca 0.0.3

* Update lockfile

* Run formatter

---------

Co-authored-by: Julian B <jeriox@users.noreply.github.com>
  • Loading branch information
lukasrad02 and jeriox authored Aug 8, 2024
1 parent 755e9af commit ac26ceb
Show file tree
Hide file tree
Showing 6 changed files with 394 additions and 361 deletions.
27 changes: 19 additions & 8 deletions myhpi/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-06-11 11:13+0200\n"
"POT-Creation-Date: 2024-07-29 19:26+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -380,12 +380,16 @@ msgid "Mailing Lists"
msgstr "Mailinglisten"

#: myhpi/tenca_django/forms.py:15
msgid "Not subscribed users are allowed to post."
msgstr "Nichtmitglieder dürfen an diese Liste schreiben."
msgid "Not subscribed users are allowed to post"
msgstr "Nichtmitglieder dürfen an diese Liste schreiben"

#: myhpi/tenca_django/forms.py:18
msgid "Replies are addressed to the list per default."
msgstr "Antworten gehen immer an den Verteiler."
msgid "Replies are addressed to the list per default"
msgstr "Antworten gehen immer an den Verteiler"

#: myhpi/tenca_django/forms.py:21
msgid "Footer contains invitation link"
msgstr "Fußzeile beinhaltet Einladungslink"

#: myhpi/tenca_django/models.py:30
#: myhpi/tenca_django/templates/tenca_django/manage_list.html:6
Expand Down Expand Up @@ -436,7 +440,7 @@ msgstr "Deine Mitgliedschaften"

#: myhpi/tenca_django/templates/tenca_django/delete_list.html:5
#: myhpi/tenca_django/templates/tenca_django/delete_list.html:10
#: myhpi/tenca_django/templates/tenca_django/manage_list.html:48
#: myhpi/tenca_django/templates/tenca_django/manage_list.html:40
msgid "Delete list"
msgstr "Liste Löschen"

Expand All @@ -451,6 +455,13 @@ msgstr ""
"\t\tMöchtest du die Liste %(listname)s wirklich löschen?\n"
"\t"

#: myhpi/tenca_django/templates/tenca_django/delete_list.html:20
#: venv/lib/python3.12/site-packages/django/forms/formsets.py:499
#, fuzzy
#| msgid "Delete list"
msgid "Delete"
msgstr "Liste Löschen"

#: myhpi/tenca_django/templates/tenca_django/delete_list.html:21
msgid "Cancel"
msgstr "Abbrechen"
Expand Down Expand Up @@ -482,11 +493,11 @@ msgstr "Teile diesen Link, um neue Mitglieder einzuladen:"
msgid "List options"
msgstr "Listeneinstellungen"

#: myhpi/tenca_django/templates/tenca_django/manage_list.html:47
#: myhpi/tenca_django/templates/tenca_django/manage_list.html:39
msgid "Save"
msgstr "Speichern"

#: myhpi/tenca_django/templates/tenca_django/manage_list.html:51
#: myhpi/tenca_django/templates/tenca_django/manage_list.html:43
msgid "Members"
msgstr "Mitglieder"

Expand Down
8 changes: 6 additions & 2 deletions myhpi/tenca_django/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ class TencaNewListForm(Form):

class TencaListOptionsForm(Form):
notsubscribed_allowed_to_post = BooleanField(
label=_("Not subscribed users are allowed to post."), required=False
label=_("Not subscribed users are allowed to post"), required=False
)
replies_addressed_to_list = BooleanField(
label=_("Replies are addressed to the list per default."), required=False
label=_("Replies are addressed to the list per default"), required=False
)
footer_has_subscribe_link = BooleanField(
label=_("Footer contains invitation link"), required=False
)
# Fields should be named according to their respective setting on the tenca list object

Expand All @@ -24,6 +27,7 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for key, field in self.fields.items():
field.initial = getattr(mailing_list, key)
self.label_suffix = ""


class TencaMemberEditForm(Form):
Expand Down
22 changes: 7 additions & 15 deletions myhpi/tenca_django/templates/tenca_django/manage_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,13 @@ <h3>{% trans "Invite Link" %}</h3>
<h3>{% trans "List options" %}</h3>
<form method="post">
{% csrf_token %}
<div class="form-group">
<div class="form-check">
<input type="checkbox" name="notsubscribed_allowed_to_post" class="form-check-input" id="id_notsubscribed_allowed_to_post" checked="">
<label class="form-check-label" for="id_notsubscribed_allowed_to_post">
Not subscribed users are allowed to post.
</label>
</div>
</div>
<div class="form-group">
<div class="form-check">
<input type="checkbox" name="replies_addressed_to_list" class="form-check-input" id="id_replies_addressed_to_list">
<label class="form-check-label" for="id_replies_addressed_to_list">
Replies are addressed to the list per default.
</label>
</div>
<div class="form-group mb-3">
{% for field in form %}
<div class="form-check">
{{ field|addcss:"form-check-input" }}
{{ field.label_tag }}
</div>
{% endfor %}
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">{% trans 'Save' %}</button>
Expand Down
5 changes: 5 additions & 0 deletions myhpi/tenca_django/templatetags/tenca_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ def fqdn_ize(list_id):
from myhpi.tenca_django.connection import connection

return connection.fqdn_ize(list_id)


@register.filter(name="addcss")
def addcss(field, css):
return field.as_widget(attrs={"class": css})
Loading

0 comments on commit ac26ceb

Please sign in to comment.