Skip to content

Commit 136cf58

Browse files
committed
Add custom template for contactformulier plugin
1 parent c5de28e commit 136cf58

File tree

8 files changed

+35
-11
lines changed

8 files changed

+35
-11
lines changed

src/open_inwoner/conf/base.py

+1
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,7 @@
561561

562562
CMS_TEMPLATES = [
563563
("cms/fullwidth.html", "Home page template"),
564+
("cms/basic.html", "Base template for CMS pages"),
564565
]
565566
CMS_PLACEHOLDER_CONF = {
566567
# TODO properly configure this based on actual available plugins

src/open_inwoner/openklant/cms_plugins.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,11 @@ class ContactFormPlugin(CMSPluginBase):
4444
form = ContactFormConfigForm
4545
name = _("Contact form plugin")
4646
render_template = "pages/contactform/form.html"
47+
# render_template = "cms/contactform/form.html"
4748
cache = False
4849

4950
fieldsets = ((None, {"fields": ("title", "description")}),)
5051

51-
# def get_render_template(self, context, instance, placeholder):
52-
# request = context["request"]
53-
# if request.path == "/contactform/":
54-
# return "pages/contactform/form.html"
55-
# return ""
56-
5752
def render(self, context, instance, placeholder):
5853
config = OpenKlantConfig.get_solo()
5954
context.update(
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{% extends 'master.html' %}
2+
{% load i18n cms_tags sekizai_tags static %}
3+
4+
5+
{% block extra_head %}
6+
{% page_attribute "meta_description" as meta_description %}
7+
{{ block.super }}
8+
<meta name="description" content="{{ meta_description }}" />
9+
{% endblock extra_head %}
10+
11+
{% block title %}{% page_attribute "title" as title %}{% page_attribute "page_title" as page_title %}{% if page_title %}{{ page_title }}{% else %}{{ title }}{% endif %} - {{ site_name }}{% endblock title %}
12+
{% block content %}
13+
{% placeholder 'content' or %}{% trans "There is no content." %}{% endplaceholder %}
14+
{% endblock content %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{% load cms_tags i18n render_tags %}
2+
3+
{% block content %}
4+
{% if has_form_configuration %}
5+
<h1 class="utrecht-heading-1">
6+
{% trans "Contactformulier" %}
7+
</h1>
8+
<p class="utrecht-paragraph">{{ instance.description|ckeditor_content|safe }}</p>
9+
{% include "components/Contact/ContactForm.html" with form_object=form has_form_configuration=has_form_configuration csrf_token=csrf_token only %}
10+
{% else %}
11+
<p class="utrecht-paragraph">{% trans "Contact formulier niet geconfigureerd." %}</p>
12+
{% endif %}
13+
{% endblock content %}

src/open_inwoner/templates/cms/footer/footer_pages_plugin.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<ul class="footer__list">
44
{% if has_form_configuration %}
55
<li class="footer__list-item">
6-
{% link text=_("Contact formulier") secondary=True href="contactform" %}
6+
{% link text=_("Contact formulier") secondary=True href="contactforms" %}
77
</li>
88
{% endif %}
99
{% for flatpage in flatpages %}

src/open_inwoner/templates/cms/fullwidth.html

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
{% block title %}{% page_attribute "title" as title %}{% page_attribute "page_title" as page_title %}{% if page_title %}{{ page_title }}{% else %}{{ title }}{% endif %} - {{ site_name }}{% endblock title %}
1212

13-
1413
{% block header_image %}
1514
{% if request.user.is_authenticated %}
1615
{% placeholder 'banner_image' %}

src/open_inwoner/templates/master.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
</head>
6464

6565
<body hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}' class="utrecht-page">
66-
66+
6767
{% if cookiebanner_enabled %}
6868
{# render cookiebanner first #}
6969
<div class="cookie-banner" id="cookie-banner" aria-labelledby="cookie-banner__title" aria-describedby="cookie-banner__text">
@@ -79,7 +79,7 @@
7979
</div>
8080
</div>
8181
{% endif %}
82-
82+
8383
{% include "components/Header/AccessibilitySkipLink.html" %}
8484

8585
{% if warning_banner_enabled %}
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
{% load cms_tags i18n render_tags %}
22

3+
{% block content %}
34
{% if has_form_configuration %}
45
<h1 class="utrecht-heading-1">
5-
{% trans "Contactformulier" %}
6+
{% if instance.title %}{{ instance.title }}{% else %}{% trans "Contactformulier" %}{% endif %}
67
</h1>
78
<p class="utrecht-paragraph">{{ instance.description|ckeditor_content|safe }}</p>
89
{% include "components/Contact/ContactForm.html" with form_object=form has_form_configuration=has_form_configuration csrf_token=csrf_token only %}
910
{% else %}
1011
<p class="utrecht-paragraph">{% trans "Contact formulier niet geconfigureerd." %}</p>
1112
{% endif %}
13+
{% endblock content %}

0 commit comments

Comments
 (0)