Skip to content

Commit

Permalink
Don't show the page translation alternatives linklist if it is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
david-venhoff committed May 11, 2022
1 parent db1f9a2 commit b7a7103
Show file tree
Hide file tree
Showing 8 changed files with 481 additions and 18 deletions.
4 changes: 4 additions & 0 deletions integreat_cms/cms/models/pages/page_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ def display_content(self):
for translation in self.page.prefetched_public_translations_by_language_slug.values()
if translation.content and not translation.content.isspace()
]

if not fallback_translations:
return self.content

return render_to_string(
"pages/_page_content_alternatives.html",
{
Expand Down
10 changes: 5 additions & 5 deletions integreat_cms/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: 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-05-10 12:46+0000\n"
"POT-Creation-Date: 2022-05-11 14:50+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Integreat <info@integreat-app.de>\n"
"Language-Team: Integreat <info@integreat-app.de>\n"
Expand Down Expand Up @@ -2232,7 +2232,7 @@ msgstr "Angebotslisten-Feedback"

#: cms/models/feedback/page_feedback.py:19
#: cms/models/pages/abstract_base_page_translation.py:79
#: cms/models/pages/page_translation.py:323
#: cms/models/pages/page_translation.py:327
msgid "page translation"
msgstr "Seiten-Übersetzung"

Expand Down Expand Up @@ -2567,7 +2567,7 @@ msgid "with the title in"
msgstr "mit dem Titel auf"

#: cms/models/pages/abstract_base_page_translation.py:81
#: cms/models/pages/page_translation.py:325
#: cms/models/pages/page_translation.py:329
msgid "page translations"
msgstr "Seiten-Übersetzungen"

Expand Down Expand Up @@ -2690,11 +2690,11 @@ msgstr "Titel der Seite"
msgid "content of the page"
msgstr "Inhalt der Seite"

#: cms/models/pages/page_translation.py:226
#: cms/models/pages/page_translation.py:230
msgid "Live content"
msgstr "Live-Inhalt"

#: cms/models/pages/page_translation.py:229
#: cms/models/pages/page_translation.py:233
msgid "Empty"
msgstr "Leer"

Expand Down
6 changes: 6 additions & 0 deletions tests/api/api_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
"tests/api/expected-outputs/augsburg_de_pages.json",
200,
),
(
"/api/augsburg/ar/pages/",
"/augsburg/ar/wp-json/extensions/v3/pages/",
"tests/api/expected-outputs/augsburg_ar_pages.json",
200,
),
(
"/api/augsburg/de/locations/",
"/augsburg/de/wp-json/extensions/v3/locations/",
Expand Down
10 changes: 5 additions & 5 deletions tests/api/expected-outputs/api_augsburg_de_children_depth_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
"title": "Beh\u00f6rden und Beratung",
"modified_gmt": "2022-01-16T16:36:26.985Z",
"excerpt": "",
"content": "\n\n\n<p>Die Seite existiert nicht in der ausgew\u00e4hlten Sprache. Sie ist aber in diesen Sprachen verf\u00fcgbar:</p>\n<ul>\n \n</ul>",
"content": "",
"parent": {
"id": 0,
"url": null,
Expand Down Expand Up @@ -208,7 +208,7 @@
"title": "Beh\u00f6rden",
"modified_gmt": "2022-01-16T16:36:57.038Z",
"excerpt": "",
"content": "\n\n\n<p>Die Seite existiert nicht in der ausgew\u00e4hlten Sprache. Sie ist aber in diesen Sprachen verf\u00fcgbar:</p>\n<ul>\n \n</ul>",
"content": "",
"parent": {
"id": 14,
"url": "http://localhost:8000/augsburg/de/beh\u00f6rden-und-beratung/",
Expand Down Expand Up @@ -242,7 +242,7 @@
"title": "Deutsche Sprache",
"modified_gmt": "2022-01-16T16:52:15.815Z",
"excerpt": "",
"content": "\n\n\n<p>Die Seite existiert nicht in der ausgew\u00e4hlten Sprache. Sie ist aber in diesen Sprachen verf\u00fcgbar:</p>\n<ul>\n \n</ul>",
"content": "",
"parent": {
"id": 0,
"url": null,
Expand Down Expand Up @@ -310,7 +310,7 @@
"title": "Sprachkurse",
"modified_gmt": "2022-01-16T16:55:55.501Z",
"excerpt": "",
"content": "\n\n\n<p>Die Seite existiert nicht in der ausgew\u00e4hlten Sprache. Sie ist aber in diesen Sprachen verf\u00fcgbar:</p>\n<ul>\n \n</ul>",
"content": "",
"parent": {
"id": 18,
"url": "http://localhost:8000/augsburg/de/deutsche-sprache/",
Expand Down Expand Up @@ -373,7 +373,7 @@
"title": "Dolmetschen und \u00dcbersetzen",
"modified_gmt": "2022-01-16T17:00:04.994Z",
"excerpt": "",
"content": "\n\n\n<p>Die Seite existiert nicht in der ausgew\u00e4hlten Sprache. Sie ist aber in diesen Sprachen verf\u00fcgbar:</p>\n<ul>\n \n</ul>",
"content": "",
"parent": {
"id": 18,
"url": "http://localhost:8000/augsburg/de/deutsche-sprache/",
Expand Down
453 changes: 453 additions & 0 deletions tests/api/expected-outputs/augsburg_ar_pages.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/api/expected-outputs/augsburg_de_children.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"title": "Beh\u00f6rden und Beratung",
"modified_gmt": "2022-01-16T16:36:26.985Z",
"excerpt": "",
"content": "\n\n\n<p>Die Seite existiert nicht in der ausgew\u00e4hlten Sprache. Sie ist aber in diesen Sprachen verf\u00fcgbar:</p>\n<ul>\n \n</ul>",
"content": "",
"parent": {
"id": 0,
"url": null,
Expand Down Expand Up @@ -74,7 +74,7 @@
"title": "Deutsche Sprache",
"modified_gmt": "2022-01-16T16:52:15.815Z",
"excerpt": "",
"content": "\n\n\n<p>Die Seite existiert nicht in der ausgew\u00e4hlten Sprache. Sie ist aber in diesen Sprachen verf\u00fcgbar:</p>\n<ul>\n \n</ul>",
"content": "",
"parent": {
"id": 0,
"url": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"url": "http://localhost:8000/augsburg/fa/\u0627\u062f\u0627\u0631\u0627\u062a-\u0648-\u0645\u0634\u0627\u0648\u0631\u0647/\u0627\u062f\u0627\u0631\u0627\u062a/"
}
},
"content": "\n\n\n<p>Die Seite existiert nicht in der ausgew\u00e4hlten Sprache. Sie ist aber in diesen Sprachen verf\u00fcgbar:</p>\n<ul>\n \n</ul>",
"content": "",
"excerpt": "",
"hash": null,
"id": 35,
Expand Down
10 changes: 5 additions & 5 deletions tests/api/expected-outputs/augsburg_de_pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
"title": "Beh\u00f6rden und Beratung",
"modified_gmt": "2022-01-16T16:36:26.985Z",
"excerpt": "",
"content": "\n\n\n<p>Die Seite existiert nicht in der ausgew\u00e4hlten Sprache. Sie ist aber in diesen Sprachen verf\u00fcgbar:</p>\n<ul>\n \n</ul>",
"content": "",
"parent": {
"id": 0,
"url": null,
Expand Down Expand Up @@ -208,7 +208,7 @@
"title": "Beh\u00f6rden",
"modified_gmt": "2022-01-16T16:36:57.038Z",
"excerpt": "",
"content": "\n\n\n<p>Die Seite existiert nicht in der ausgew\u00e4hlten Sprache. Sie ist aber in diesen Sprachen verf\u00fcgbar:</p>\n<ul>\n \n</ul>",
"content": "",
"parent": {
"id": 14,
"url": "http://localhost:8000/augsburg/de/beh\u00f6rden-und-beratung/",
Expand Down Expand Up @@ -310,7 +310,7 @@
"title": "Deutsche Sprache",
"modified_gmt": "2022-01-16T16:52:15.815Z",
"excerpt": "",
"content": "\n\n\n<p>Die Seite existiert nicht in der ausgew\u00e4hlten Sprache. Sie ist aber in diesen Sprachen verf\u00fcgbar:</p>\n<ul>\n \n</ul>",
"content": "",
"parent": {
"id": 0,
"url": null,
Expand Down Expand Up @@ -378,7 +378,7 @@
"title": "Sprachkurse",
"modified_gmt": "2022-01-16T16:55:55.501Z",
"excerpt": "",
"content": "\n\n\n<p>Die Seite existiert nicht in der ausgew\u00e4hlten Sprache. Sie ist aber in diesen Sprachen verf\u00fcgbar:</p>\n<ul>\n \n</ul>",
"content": "",
"parent": {
"id": 18,
"url": "http://localhost:8000/augsburg/de/deutsche-sprache/",
Expand Down Expand Up @@ -441,7 +441,7 @@
"title": "Dolmetschen und \u00dcbersetzen",
"modified_gmt": "2022-01-16T17:00:04.994Z",
"excerpt": "",
"content": "\n\n\n<p>Die Seite existiert nicht in der ausgew\u00e4hlten Sprache. Sie ist aber in diesen Sprachen verf\u00fcgbar:</p>\n<ul>\n \n</ul>",
"content": "",
"parent": {
"id": 18,
"url": "http://localhost:8000/augsburg/de/deutsche-sprache/",
Expand Down

0 comments on commit b7a7103

Please sign in to comment.