Skip to content

Commit a661b54

Browse files
committed
refactor: [#2081] refactor template structure and names
CMS templates are moved to their app template folders, and template names are updated to be uniform and recognizable (e.g. 'status_inner.html' -> 'aanvragen_detail.html') for the mijn_aanvragen detail template. The tempate which overrides Django's default flatpage template (flatpages/default.html) is deleted because it is no longer used (flatpages have been migrated to CMS).
1 parent ce52b73 commit a661b54

File tree

82 files changed

+134
-127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+134
-127
lines changed

src/open_inwoner/accounts/cms/mijn_profiel/cms_plugins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class UserAppointmentsPlugin(CMSPluginBase):
1616
model = UserAppointments
1717
module = _("Profile")
1818
name = _("My appointments")
19-
render_template = "cms/plugins/appointments/appointments.html"
19+
render_template = "mijn_profiel/appointments.html"
2020

2121
def render(self, context, instance, placeholder):
2222
request = context["request"]

src/open_inwoner/templates/cms/plugins/appointments/appointments.html renamed to src/open_inwoner/accounts/cms/mijn_profiel/templates/mijn_profiel/appointments.html

File renamed without changes.

src/open_inwoner/components/templatetags/file_tags.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from filer.models.filemodels import File
88

9-
from open_inwoner.mijn_aanvragen.views.zaken_detail import SimpleFile
9+
from open_inwoner.mijn_aanvragen.views.aanvragen_detail import SimpleFile
1010
from open_inwoner.utils.time import instance_is_new
1111

1212
register = template.Library()

src/open_inwoner/components/tests/test_menu_tags.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def setUp(self):
3636
# Create home page with correct reverse_id
3737
self.home_page = api.create_page(
3838
"Home",
39-
"cms/fullwidth.html",
39+
"core/cms/pages/fullwidth.html",
4040
"nl",
4141
reverse_id="home",
4242
in_navigation=True,
@@ -63,7 +63,7 @@ def _get_menu_data(self, user, path="/"):
6363
def test_draft_page_visibility_differs_for_staff_and_regular_users(self):
6464
published_page = api.create_page(
6565
"Published Page",
66-
"cms/fullwidth.html",
66+
"core/cms/pages/fullwidth.html",
6767
"nl",
6868
parent=self.home_page,
6969
in_navigation=True,
@@ -72,7 +72,7 @@ def test_draft_page_visibility_differs_for_staff_and_regular_users(self):
7272

7373
draft_page = api.create_page(
7474
"Draft Page",
75-
"cms/fullwidth.html",
75+
"core/cms/pages/fullwidth.html",
7676
"nl",
7777
parent=self.home_page,
7878
in_navigation=True,
@@ -115,7 +115,7 @@ def test_draft_page_visibility_differs_for_staff_and_regular_users(self):
115115
def test_menu_icons_from_draft_page_common_extension(self):
116116
page_with_icon = api.create_page(
117117
"Page With Icon",
118-
"cms/fullwidth.html",
118+
"core/cms/pages/fullwidth.html",
119119
"nl",
120120
parent=self.home_page,
121121
in_navigation=True,
@@ -165,7 +165,7 @@ def test_menu_icons_from_draft_page_common_extension(self):
165165
def test_menu_icons_on_draft_only_pages_for_staff(self):
166166
draft_page = api.create_page(
167167
"Draft Page With Icon",
168-
"cms/fullwidth.html",
168+
"core/cms/pages/fullwidth.html",
169169
"nl",
170170
parent=self.home_page,
171171
in_navigation=True,
@@ -201,7 +201,7 @@ def test_menu_icons_on_draft_only_pages_for_staff(self):
201201
def test_menu_pages_without_common_extension_show_no_icon(self):
202202
page_without_icon = api.create_page(
203203
"Page Without Icon",
204-
"cms/fullwidth.html",
204+
"core/cms/pages/fullwidth.html",
205205
"nl",
206206
parent=self.home_page,
207207
in_navigation=True,
@@ -247,7 +247,7 @@ def test_menu_icon_fallback_between_draft_and_public_versions(self):
247247
# Create page with icon on draft (most common)
248248
page_draft_icon = api.create_page(
249249
"Page Draft Icon",
250-
"cms/fullwidth.html",
250+
"core/cms/pages/fullwidth.html",
251251
"nl",
252252
parent=self.home_page,
253253
in_navigation=True,
@@ -297,7 +297,7 @@ def test_menu_counters_are_calculated_from_user_specific_data(self):
297297
# Create page with inbox message indicator
298298
inbox_page = api.create_page(
299299
"My Messages",
300-
"cms/fullwidth.html",
300+
"core/cms/pages/fullwidth.html",
301301
"nl",
302302
parent=self.home_page,
303303
in_navigation=True,
@@ -335,7 +335,7 @@ def test_current_page_is_highlighted_when_user_visits_that_page(self):
335335
# Create two pages to test current detection
336336
visited_page = api.create_page(
337337
"Visited Page",
338-
"cms/fullwidth.html",
338+
"core/cms/pages/fullwidth.html",
339339
"nl",
340340
parent=self.home_page,
341341
in_navigation=True,
@@ -345,7 +345,7 @@ def test_current_page_is_highlighted_when_user_visits_that_page(self):
345345

346346
other_page = api.create_page(
347347
"Other Page",
348-
"cms/fullwidth.html",
348+
"core/cms/pages/fullwidth.html",
349349
"nl",
350350
parent=self.home_page,
351351
in_navigation=True,
@@ -384,7 +384,7 @@ def test_current_page_is_highlighted_when_user_visits_that_page(self):
384384
def test_pages_only_published_in_other_languages_are_hidden_from_menu(self):
385385
dutch_page = api.create_page(
386386
"Dutch Page",
387-
"cms/fullwidth.html",
387+
"core/cms/pages/fullwidth.html",
388388
"nl",
389389
parent=self.home_page,
390390
in_navigation=True,
@@ -393,7 +393,7 @@ def test_pages_only_published_in_other_languages_are_hidden_from_menu(self):
393393

394394
en_page = api.create_page(
395395
"English Only Page",
396-
"cms/fullwidth.html",
396+
"core/cms/pages/fullwidth.html",
397397
"en",
398398
parent=self.home_page,
399399
in_navigation=True,
@@ -420,7 +420,7 @@ def test_pages_only_published_in_other_languages_are_hidden_from_menu(self):
420420
def test_invalid_counter_values_are_handled_gracefully(self):
421421
page_with_broken_counter = api.create_page(
422422
"Broken Counter Page",
423-
"cms/fullwidth.html",
423+
"core/cms/pages/fullwidth.html",
424424
"nl",
425425
parent=self.home_page,
426426
in_navigation=True,

src/open_inwoner/conf/base.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,12 @@
214214
"custom_migrations",
215215
"objectsapiclient",
216216
*default_health_check_apps,
217-
# Project applications.
218-
"open_inwoner.core",
217+
# Project applications - sorted alphabetically
218+
"open_inwoner._legacy.cms.plugins", # Legacy - migrations only
219+
"open_inwoner.accounts.cms.mijn_profiel",
219220
"open_inwoner.components",
221+
"open_inwoner.configurations",
222+
"open_inwoner.core",
220223
"open_inwoner.core.cms.cms_plugins.banner",
221224
"open_inwoner.core.cms.cms_plugins.extensions",
222225
"open_inwoner.core.cms.cms_plugins.footer",
@@ -229,27 +232,24 @@
229232
"open_inwoner.haalcentraal",
230233
"open_inwoner.kvk",
231234
"open_inwoner.laposta",
232-
"open_inwoner.qmatic",
233-
"open_inwoner.search",
234-
"open_inwoner.utils",
235-
"open_inwoner.configurations",
236-
"open_inwoner.openklant",
237-
"open_inwoner.soap",
238-
"open_inwoner.questionnaire",
239235
"open_inwoner.mail",
240236
"open_inwoner.media",
241-
"open_inwoner.userfeed",
237+
"open_inwoner.mijn_aanvragen.cms.apps.MijnAanvragenCmsConfig",
242238
"open_inwoner.mijn_afval",
243239
"open_inwoner.mijn_afval.cms",
244-
"open_inwoner.mijn_uitkeringen",
245240
"open_inwoner.mijn_samenwerkingen",
241+
"open_inwoner.mijn_uitkeringen",
246242
"open_inwoner.onderwerpen",
247-
"open_inwoner.accounts.cms.mijn_profiel",
248-
"open_inwoner.mijn_aanvragen.cms.apps.MijnAanvragenCmsConfig",
249-
"open_inwoner._legacy.cms.plugins", # Legacy - migrations only
250-
"djchoices",
243+
"open_inwoner.openklant",
244+
"open_inwoner.qmatic",
245+
"open_inwoner.questionnaire",
246+
"open_inwoner.search",
247+
"open_inwoner.soap",
248+
"open_inwoner.userfeed",
249+
"open_inwoner.utils",
251250
"django_celery_beat",
252251
"django_celery_monitor",
252+
"djchoices",
253253
# Temporary fix: the notifications lib interferes with
254254
# celery's task loading meachanism, which prevents certain
255255
# tasks from showing up in the admin when OIP is run with
@@ -648,9 +648,9 @@
648648
CMS_PLUGIN_CACHE = False
649649

650650
CMS_TEMPLATES = [
651-
("cms/fullwidth.html", "Home page template"),
652-
("cms/cms_flatpage_template.html", "CMS Flatpage Template"),
653-
("cms/contactform/form_outer.html", "CMS Contactformulier Template"),
651+
("core/cms/pages/fullwidth.html", "Home page template"),
652+
("core/cms/footer/cms_flatpage_template.html", "CMS Flatpage Template"),
653+
("openklant/contactform/form_outer.html", "CMS Contactformulier Template"),
654654
]
655655
CMS_PLACEHOLDER_CONF = {
656656
# TODO properly configure this based on actual available plugins

src/open_inwoner/configurations/tests/test_custom_javascript.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def setUp(self):
2020

2121
self.page = api.create_page(
2222
title="Test Page",
23-
template="cms/fullwidth.html",
23+
template="core/cms/pages/fullwidth.html",
2424
language="nl",
2525
in_navigation=True,
2626
)

src/open_inwoner/core/cms/cms_plugins/banner/cms_plugins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class BannerImagePlugin(CMSPluginBase):
1212
model = BannerImage
1313
form = BannerImageForm
1414
name = _("Banner Image Plugin")
15-
render_template = "cms/banner/banner_image_plugin.html"
15+
render_template = "core/cms/banner/banner_image_plugin.html"
1616
cache = False
1717

1818

@@ -21,5 +21,5 @@ class BannerTextPlugin(CMSPluginBase):
2121
model = BannerText
2222
form = BannerTextForm
2323
name = _("Banner Text Plugin")
24-
render_template = "cms/banner/banner_text_plugin.html"
24+
render_template = "core/cms/banner/banner_text_plugin.html"
2525
cache = False

src/open_inwoner/core/cms/cms_plugins/footer/cms_plugins.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
@plugin_pool.register_plugin
1818
class FooterPagesPlugin(CMSPluginBase):
1919
name = _("Pages List")
20-
render_template = "cms/footer/footer_pages_plugin.html"
20+
render_template = "core/cms/footer/footer_pages_plugin.html"
2121
cache = False
2222

2323
def render(self, context, instance, placeholder):
@@ -35,7 +35,7 @@ def render(self, context, instance, placeholder):
3535
cms_pages.remove(page)
3636

3737
contact_form_pages = Page.objects.filter(
38-
template="cms/contactform/form_outer.html", publisher_is_draft=False
38+
template="openklant/contactform/form_outer.html", publisher_is_draft=False
3939
)
4040

4141
# Use the first page if it exists
@@ -50,7 +50,7 @@ def render(self, context, instance, placeholder):
5050
class CMSFlatPagePlugin(CMSPluginBase):
5151
name = _("CMS Flatpage Plugin")
5252
model = CMSFlatPageModel
53-
render_template = "cms/cms_flatpage.html"
53+
render_template = "core/cms/footer/cms_flatpage.html"
5454

5555
def render(self, context, instance, placeholder):
5656
cms_plugin_placeholder = instance.placeholder

src/open_inwoner/core/cms/cms_plugins/footer/migrations/0002_migrate_flatpages_content_to_cms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def create_cms_pages(apps, schema_editor):
2121

2222
page = create_page(
2323
title=title,
24-
template="cms/cms_flatpage_template.html",
24+
template="core/cms/footer/cms_flatpage_template.html",
2525
language=language,
2626
slug=slug,
2727
published=True,

src/open_inwoner/core/cms/cms_plugins/link/cms_plugins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@plugin_pool.register_plugin
1515
class CMSLinkPlugin(CMSPluginBase):
1616
model = LinkPluginConfig
17-
render_template = "cms/plugins/links/external-links.html"
17+
render_template = "core/cms/link/external-links.html"
1818
module = _("General")
1919
name = _("External Link Plugin")
2020
allow_children = True

0 commit comments

Comments
 (0)