Skip to content

Commit

Permalink
Apply update from other branches
Browse files Browse the repository at this point in the history
  • Loading branch information
MizukiTemma committed Nov 6, 2024
1 parent 467e38d commit 231b9ab
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 12 deletions.
15 changes: 15 additions & 0 deletions integreat_cms/cms/models/contact/contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,21 @@ def get_additional_attribute(self) -> str:

return ""

def label_in_reference_list(self) -> str:
"""
This function returns
"""

label = (
_("General contact information")
if not self.point_of_contact_for
else f"{self.point_of_contact_for} {self.name}"
)
if self.archived:
label += " (⚠ " + gettext("Archived") + ")"

return label

def get_repr(self) -> str:
"""
This overwrites the default Django ``__repr__()`` method which would return ``<Contact: Contact object (id)>``.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
{% for contact in poi_form.instance.contacts.all %}
<a href="{% url 'edit_contact' contact_id=contact.id region_slug=request.region.slug %}"
class="block pt-2 hover:underline">
<i icon-name="pen-square" class="mr-2"></i> {{ contact.point_of_contact_for }} {{ contact.name }}
<i icon-name="pen-square" class="mr-2"></i> {{ contact.label_in_reference_list }}
</a>
{% endfor %}
</div>
Expand Down Expand Up @@ -130,7 +130,7 @@
{% for contact in poi_form.instance.contacts.all %}
<a href="{% url 'edit_contact' contact_id=contact.id region_slug=request.region.slug %}"
class="block pt-2 hover:underline">
<i icon-name="pen-square" class="mr-2"></i> {{ contact.point_of_contact_for }} {{ contact.name }}
<i icon-name="pen-square" class="mr-2"></i> {{ contact.label_in_reference_list }}
</a>
{% endfor %}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{% for contact in contacts %}
<a href="{% url 'edit_contact' contact_id=contact.id region_slug=request.region.slug %}"
class="block pt-2 hover:underline">
<i icon-name="pen-square" class="mr-2"></i> {{ contact }}
<i icon-name="pen-square" class="mr-2"></i> {{ contact.label_in_reference_list }}
</a>
{% endfor %}
</div>
Expand Down
13 changes: 7 additions & 6 deletions integreat_cms/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -1640,9 +1640,9 @@ msgstr "Aktiv"
msgid "Hidden"
msgstr "Versteckt"

#: cms/constants/region_status.py cms/models/pages/page_translation.py
#: cms/models/regions/region.py cms/templates/events/event_form.html
#: cms/templates/pages/page_form.html
#: cms/constants/region_status.py cms/models/contact/contact.py
#: cms/models/pages/page_translation.py cms/models/regions/region.py
#: cms/templates/events/event_form.html cms/templates/pages/page_form.html
#: cms/templates/pages/page_tree_archived_node.html
#: cms/templates/pois/poi_form.html
msgid "Archived"
Expand Down Expand Up @@ -2777,6 +2777,10 @@ msgstr "mit Telefonnummer: {}"
msgid "with website: {}"
msgstr "mit Website: {}"

#: cms/models/contact/contact.py
msgid "General contact information"
msgstr "Allgemeine Kontaktinformationen"

#: cms/models/contact/contact.py
msgid "(Copy)"
msgstr "(Kopie)"
Expand Down Expand Up @@ -11022,9 +11026,6 @@ msgstr ""
"Diese Seite konnte nicht importiert werden, da sie zu einer anderen Region "
"gehört ({})."

#~ msgid "General contact information"
#~ msgstr "Allgemeine Kontaktinformationen"

#~ msgid "{}{}"
#~ msgstr "{}{}"

Expand Down
7 changes: 4 additions & 3 deletions tests/cms/views/poi/test_poi_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,10 @@ def test_poi_form_shows_associated_contacts(
# probably needs adjustment after #2958
elif role in HIGH_PRIV_STAFF_ROLES:
for contact in related_contacts:
if contact.title and contact.name:
assert f"{contact.title} {contact.name}" in response.content.decode(
"utf-8"
if contact.point_of_contact_for:
assert (
f"{contact.point_of_contact_for} {contact.name}"
in response.content.decode("utf-8")
)
else:
assert "General contact information" in response.content.decode("utf-8")
Expand Down

0 comments on commit 231b9ab

Please sign in to comment.