Skip to content

Commit

Permalink
Merge pull request #330 from maykinmedia/issue/906-more-editable-text
Browse files Browse the repository at this point in the history
[#906] Added configuration fields for more dynamic texts
  • Loading branch information
alextreme authored Nov 17, 2022
2 parents 997d774 + c58e012 commit 0109b0d
Show file tree
Hide file tree
Showing 19 changed files with 220 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% load i18n grid_tags form_tags button_tags %}

{% render_column span=6 compact=True extra_classes="product-finder" %}
<h2 class="h2">{% trans "Productzoeker" %}</h2>
<p class="p">Met een paar simpele vragen ziet u welke producten passen bij uw situatie</p>
<h2 class="h2">{{configurable_text.home_page.home_product_finder_title}}</h2>
<p class="p">{{configurable_text.home_page.home_product_finder_intro|linebreaksbr}}</p>

<div class="product-finder__form">
{% if not conditions_done %}
Expand Down
7 changes: 5 additions & 2 deletions src/open_inwoner/components/templatetags/product_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
register = template.Library()


@register.inclusion_tag("components/Product/finder.html")
def product_finder(condition, form, form_action=".", primary_text=None, **kwargs):
@register.inclusion_tag("components/Product/finder.html", takes_context=True)
def product_finder(
context, condition, form, form_action=".", primary_text=None, **kwargs
):
"""
Renders the actions in a filterable table.
Expand All @@ -31,5 +33,6 @@ def product_finder(condition, form, form_action=".", primary_text=None, **kwargs
form=form,
form_action=form_action,
primary_text=primary_text,
configurable_text=context["configurable_text"],
)
return kwargs
9 changes: 7 additions & 2 deletions src/open_inwoner/configurations/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,17 @@ class SiteConfigurarionAdmin(OrderedInlineModelAdminMixin, SingletonModelAdmin):
"home_theme_intro",
"home_map_title",
"home_map_intro",
"home_product_finder_title",
"home_product_finder_intro",
"theme_title",
"theme_intro",
"home_questionnaire_title",
"home_questionnaire_subtitle",
"home_questionnaire_intro",
"select_questionnaire_title",
"select_questionnaire_subtitle",
"select_questionnaire_intro",
"plans_intro",
"plans_no_plans_message",
"plans_edit_message",
),
},
),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Generated by Django 3.2.15 on 2022-11-16 11:30

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("configurations", "0021_siteconfiguration_more_titles"),
]

operations = [
migrations.AddField(
model_name="siteconfiguration",
name="home_product_finder_intro",
field=models.TextField(
blank=True,
default="Met een paar simpele vragen ziet u welke producten passen bij uw situatie",
help_text="Product finder's intro text on the home page.",
verbose_name="Home product finder intro",
),
),
migrations.AddField(
model_name="siteconfiguration",
name="home_product_finder_title",
field=models.CharField(
default="Productzoeker",
help_text="Product finder's title on the home page.",
max_length=255,
verbose_name="Product finder title",
),
),
migrations.AddField(
model_name="siteconfiguration",
name="plans_edit_message",
field=models.CharField(
default="Hier kunt u uw doel aanpassen",
help_text="The message when a user edits a goal.",
max_length=255,
verbose_name="Edit goal message",
),
),
migrations.AddField(
model_name="siteconfiguration",
name="plans_intro",
field=models.TextField(
default="Hier werkt u aan uw doelen. Dit doet u samen met uw contactpersoon bij de gemeente. ",
help_text="The sub-title for the plan page.",
verbose_name="Plan pages intro",
),
),
migrations.AddField(
model_name="siteconfiguration",
name="plans_no_plans_message",
field=models.CharField(
default="U heeft nog geen plan gemaakt.",
help_text="The message in the plans listing when user has no plans.",
max_length=255,
verbose_name="No plans message",
),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.15 on 2022-11-16 11:41

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("configurations", "0022_siteconfiguration_more_text"),
]

operations = [
migrations.RenameField(
model_name="siteconfiguration",
old_name="home_questionnaire_subtitle",
new_name="home_questionnaire_intro",
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 3.2.15 on 2022-11-16 11:42

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
(
"configurations",
"0023_rename_home_questionnaire_subtitle_siteconfiguration_home_questionnaire_intro",
),
]

operations = [
migrations.AlterField(
model_name="siteconfiguration",
name="home_questionnaire_intro",
field=models.TextField(
default="Test met een paar simpele vragen of u recht heeft op een product",
help_text="Questionnaire intro text on the home page.",
verbose_name="Home page questionaire intro",
),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.15 on 2022-11-16 11:48

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("configurations", "0024_alter_siteconfiguration_home_questionnaire_intro"),
]

operations = [
migrations.RenameField(
model_name="siteconfiguration",
old_name="select_questionnaire_subtitle",
new_name="select_questionnaire_intro",
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 3.2.15 on 2022-11-16 11:49

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
(
"configurations",
"0025_rename_select_questionnaire_subtitle_siteconfiguration_select_questionnaire_intro",
),
]

operations = [
migrations.AlterField(
model_name="siteconfiguration",
name="select_questionnaire_intro",
field=models.TextField(
default="Kies hieronder één van de volgende vragenlijsten om de zelfdiagnose te starten.",
help_text="Questionaire selector intro on the theme and profile pages.",
verbose_name="Questionaire selector widget intro",
),
),
]
48 changes: 40 additions & 8 deletions src/open_inwoner/configurations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,26 +138,58 @@ class SiteConfiguration(SingletonModel):
verbose_name=_("Home page questionaire title"),
help_text=_("Questionnaire title on the home page."),
)
home_questionnaire_subtitle = models.CharField(
max_length=255,
home_questionnaire_intro = models.TextField(
default=_("Test met een paar simpele vragen of u recht heeft op een product"),
verbose_name=_("Home page questionaire sub-title"),
help_text=_("Questionnaire sub-title on the home page."),
verbose_name=_("Home page questionaire intro"),
help_text=_("Questionnaire intro text on the home page."),
)
home_product_finder_title = models.CharField(
max_length=255,
default=_("Productzoeker"),
verbose_name=_("Product finder title"),
help_text=_("Product finder's title on the home page."),
)
home_product_finder_intro = models.TextField(
default=_(
"Met een paar simpele vragen ziet u welke producten passen bij uw situatie"
),
verbose_name=_("Home product finder intro"),
blank=True,
help_text=_("Product finder's intro text on the home page."),
)
select_questionnaire_title = models.CharField(
max_length=255,
default=_("Keuze zelfdiagnose?"),
verbose_name=_("Questionaire selector widget title"),
help_text=_("Questionaire selector title on the theme and profile pages."),
)
select_questionnaire_subtitle = models.CharField(
max_length=255,
select_questionnaire_intro = models.TextField(
default=_(
"Kies hieronder één van de volgende vragenlijsten om de zelfdiagnose te starten."
),
verbose_name=_("Questionaire selector widget sub-title"),
help_text=_("Questionaire selector sub-title on the theme and profile pages."),
verbose_name=_("Questionaire selector widget intro"),
help_text=_("Questionaire selector intro on the theme and profile pages."),
)
plans_intro = models.TextField(
default=_(
"Hier werkt u aan uw doelen. Dit doet u samen met uw contactpersoon bij de gemeente. "
),
verbose_name=_("Plan pages intro"),
help_text=_("The sub-title for the plan page."),
)
plans_no_plans_message = models.CharField(
max_length=255,
default=_("U heeft nog geen plan gemaakt."),
verbose_name=_("No plans message"),
help_text=_("The message in the plans listing when user has no plans."),
)
plans_edit_message = models.CharField(
max_length=255,
default=_("Hier kunt u uw doel aanpassen"),
verbose_name=_("Edit goal message"),
help_text=_("The message when a user edits a goal."),
)

footer_visiting_title = models.CharField(
max_length=255,
default="",
Expand Down
2 changes: 1 addition & 1 deletion src/open_inwoner/templates/pages/category/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ <h1 class="h1">
<div class="column column--start-1 column--span-6 ">
<aside class="questionnaire">
<h2 class="h2">{{configurable_text.questionnaire_page.select_questionnaire_title}}</h2>
<p class="p">{{configurable_text.questionnaire_page.select_questionnaire_subtitle}}</p>
<p class="p">{{configurable_text.questionnaire_page.select_questionnaire_intro|linebreaksbr}}</p>
{% questionnaire root_nodes=questionnaire_roots %}
</aside>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/open_inwoner/templates/pages/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h2 class="h2">

{% if questionnaire_roots.exists %}
<h2 class="h2">{{configurable_text.home_page.home_questionnaire_title}}</h2>
<p class="p">{{configurable_text.home_page.home_questionnaire_subtitle}}</p>
<p class="p">{{configurable_text.home_page.home_questionnaire_intro|linebreaksbr}}</p>

{% questionnaire root_nodes=questionnaire_roots %}
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion src/open_inwoner/templates/pages/plans/create.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{% block content %}
<h1 class="h1">{% trans "Samenwerken" %}</h1>
<p class="p">
{% trans "Hier werkt u samen met uw contactpersonen aan uw doelen." %}
{{configurable_text.plans_page.plans_intro|linebreaksbr}}
</p>

{% render_form id="plan-form" form=form method="POST" %}
Expand Down
2 changes: 1 addition & 1 deletion src/open_inwoner/templates/pages/plans/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{% block content %}
<h1 class="h1">{% trans "Samenwerken" %}</h1>
<p class="p">
{% trans "Hier werkt u samen met uw contactpersonen aan uw doelen." %}
{{configurable_text.plans_page.plans_intro|linebreaksbr}}
</p>

{% render_form id="plan-form" form=form method="POST" %}
Expand Down
2 changes: 1 addition & 1 deletion src/open_inwoner/templates/pages/plans/file.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{% block content %}
<h1 class="h1">{% trans "Samenwerken" %}</h1>
<p class="p">
{% trans "Hier werkt u samen met uw contactpersonen aan uw doelen." %}
{{configurable_text.plans_page.plans_intro|linebreaksbr}}
</p>

{% form id="document-create" form_object=form method="POST" enctype="multipart/form-data" %}
Expand Down
2 changes: 1 addition & 1 deletion src/open_inwoner/templates/pages/plans/goal_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{% block content %}
<h1 class="h1">{% trans "Doel aanpassen" %}</h1>
<p class="p">
{% trans "Hier kunt u uw doel aanpassen" %}
{{configurable_text.plans_page.plans_edit_message}}
</p>

{% form id="goal-edit" form_object=form method="POST" %}
Expand Down
2 changes: 1 addition & 1 deletion src/open_inwoner/templates/pages/plans/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ <h1 class="h1">
{% button href="plans:plan_create" text=_("Start nieuwe samenwerking") primary=True icon="group" icon_outlined=True %}
</h1>
<p class="p">
{% trans "Hier werkt u samen met uw contactpersonen aan uw doelen." %}
{{configurable_text.plans_page.plans_intro|linebreaksbr}}
</p>

{% card_container plans=object_list columns=2 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{% block content %}
<h1 class="h1">{{configurable_text.questionnaire_page.select_questionnaire_title}}</h1>
<p class="p">{{configurable_text.questionnaire_page.select_questionnaire_subtitle}}</p>
<p class="p">{{configurable_text.questionnaire_page.select_questionnaire_intro|linebreaksbr}}</p>

{% questionnaire root_nodes=root_nodes %}
{% endblock content %}
2 changes: 1 addition & 1 deletion src/open_inwoner/templates/pages/user-home.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ <h3 class="h3">{{ plan.title }}</h3>
{% endfor %}
</div>
{% else %}
<p class="p">{% trans "U heeft nog geen plan gemaakt." %}</p>
<p class="p">{{configurable_text.plans_page.plans_no_plans_message}}</p>
{% endif %}
{% endblock user_content %}
11 changes: 9 additions & 2 deletions src/open_inwoner/utils/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,22 @@ def settings(request):
"home_map_title": config.home_map_title,
"home_map_intro": config.home_map_intro,
"home_questionnaire_title": config.home_questionnaire_title,
"home_questionnaire_subtitle": config.home_questionnaire_subtitle,
"home_questionnaire_intro": config.home_questionnaire_intro,
"home_product_finder_title": config.home_product_finder_title,
"home_product_finder_intro": config.home_product_finder_intro,
},
"theme_page": {
"theme_title": config.theme_title,
"theme_intro": config.theme_intro,
},
"plans_page": {
"plans_intro": config.plans_intro,
"plans_no_plans_message": config.plans_no_plans_message,
"plans_edit_message": config.plans_edit_message,
},
"questionnaire_page": {
"select_questionnaire_title": config.select_questionnaire_title,
"select_questionnaire_subtitle": config.select_questionnaire_subtitle,
"select_questionnaire_intro": config.select_questionnaire_intro,
},
"footer": {
"footer_visiting_title": config.footer_visiting_title,
Expand Down

0 comments on commit 0109b0d

Please sign in to comment.