From 3f0d78d1dee45f1c128db8eae1b3650da0419cd2 Mon Sep 17 00:00:00 2001 From: Bart van der Schoor Date: Wed, 16 Nov 2022 12:34:32 +0100 Subject: [PATCH 1/3] [#906] Added configuration fields for more dynamic texts --- .../templates/components/Product/finder.html | 4 +- .../components/templatetags/product_tags.py | 7 ++- src/open_inwoner/configurations/admin.py | 5 ++ .../0022_siteconfiguration_more_text.py | 62 +++++++++++++++++++ src/open_inwoner/configurations/models.py | 34 ++++++++++ .../templates/pages/plans/create.html | 2 +- .../templates/pages/plans/edit.html | 2 +- .../templates/pages/plans/file.html | 2 +- .../templates/pages/plans/goal_edit.html | 2 +- .../templates/pages/plans/list.html | 2 +- .../templates/pages/user-home.html | 2 +- src/open_inwoner/utils/context_processors.py | 7 +++ 12 files changed, 121 insertions(+), 10 deletions(-) create mode 100644 src/open_inwoner/configurations/migrations/0022_siteconfiguration_more_text.py diff --git a/src/open_inwoner/components/templates/components/Product/finder.html b/src/open_inwoner/components/templates/components/Product/finder.html index 51390c3ce3..e0633a8f16 100644 --- a/src/open_inwoner/components/templates/components/Product/finder.html +++ b/src/open_inwoner/components/templates/components/Product/finder.html @@ -1,8 +1,8 @@ {% load i18n grid_tags form_tags button_tags %} {% render_column span=6 compact=True extra_classes="product-finder" %} -

{% trans "Productzoeker" %}

-

Met een paar simpele vragen ziet u welke producten passen bij uw situatie

+

{{configurable_text.home_page.home_product_finder_title}}

+

{{configurable_text.home_page.home_product_finder_intro|linebreaksbr}}

{% if not conditions_done %} diff --git a/src/open_inwoner/components/templatetags/product_tags.py b/src/open_inwoner/components/templatetags/product_tags.py index d52170911b..3885267787 100644 --- a/src/open_inwoner/components/templatetags/product_tags.py +++ b/src/open_inwoner/components/templatetags/product_tags.py @@ -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. @@ -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 diff --git a/src/open_inwoner/configurations/admin.py b/src/open_inwoner/configurations/admin.py index 4acb046ee3..90b40d1758 100644 --- a/src/open_inwoner/configurations/admin.py +++ b/src/open_inwoner/configurations/admin.py @@ -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", "select_questionnaire_title", "select_questionnaire_subtitle", + "plans_intro", + "plans_no_plans_message", + "plans_edit_message", ), }, ), diff --git a/src/open_inwoner/configurations/migrations/0022_siteconfiguration_more_text.py b/src/open_inwoner/configurations/migrations/0022_siteconfiguration_more_text.py new file mode 100644 index 0000000000..e06028494c --- /dev/null +++ b/src/open_inwoner/configurations/migrations/0022_siteconfiguration_more_text.py @@ -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", + ), + ), + ] diff --git a/src/open_inwoner/configurations/models.py b/src/open_inwoner/configurations/models.py index d2a73c4586..c9b15e66e7 100644 --- a/src/open_inwoner/configurations/models.py +++ b/src/open_inwoner/configurations/models.py @@ -144,6 +144,20 @@ class SiteConfiguration(SingletonModel): verbose_name=_("Home page questionaire sub-title"), help_text=_("Questionnaire sub-title 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?"), @@ -158,6 +172,26 @@ class SiteConfiguration(SingletonModel): verbose_name=_("Questionaire selector widget sub-title"), help_text=_("Questionaire selector sub-title 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="", diff --git a/src/open_inwoner/templates/pages/plans/create.html b/src/open_inwoner/templates/pages/plans/create.html index eb6c3a7cb0..f177428f59 100644 --- a/src/open_inwoner/templates/pages/plans/create.html +++ b/src/open_inwoner/templates/pages/plans/create.html @@ -4,7 +4,7 @@ {% block content %}

{% trans "Samenwerken" %}

- {% trans "Hier werkt u samen met uw contactpersonen aan uw doelen." %} + {{configurable_text.plans_page.plans_intro|linebreaksbr}}

{% render_form id="plan-form" form=form method="POST" %} diff --git a/src/open_inwoner/templates/pages/plans/edit.html b/src/open_inwoner/templates/pages/plans/edit.html index c5a1bfc8d5..8c87e1a8c7 100644 --- a/src/open_inwoner/templates/pages/plans/edit.html +++ b/src/open_inwoner/templates/pages/plans/edit.html @@ -4,7 +4,7 @@ {% block content %}

{% trans "Samenwerken" %}

- {% trans "Hier werkt u samen met uw contactpersonen aan uw doelen." %} + {{configurable_text.plans_page.plans_intro|linebreaksbr}}

{% render_form id="plan-form" form=form method="POST" %} diff --git a/src/open_inwoner/templates/pages/plans/file.html b/src/open_inwoner/templates/pages/plans/file.html index 4daaf0bf4c..d5f4e2041c 100644 --- a/src/open_inwoner/templates/pages/plans/file.html +++ b/src/open_inwoner/templates/pages/plans/file.html @@ -4,7 +4,7 @@ {% block content %}

{% trans "Samenwerken" %}

- {% trans "Hier werkt u samen met uw contactpersonen aan uw doelen." %} + {{configurable_text.plans_page.plans_intro|linebreaksbr}}

{% form id="document-create" form_object=form method="POST" enctype="multipart/form-data" %} diff --git a/src/open_inwoner/templates/pages/plans/goal_edit.html b/src/open_inwoner/templates/pages/plans/goal_edit.html index b758e19199..62435c8a1e 100644 --- a/src/open_inwoner/templates/pages/plans/goal_edit.html +++ b/src/open_inwoner/templates/pages/plans/goal_edit.html @@ -4,7 +4,7 @@ {% block content %}

{% trans "Doel aanpassen" %}

- {% trans "Hier kunt u uw doel aanpassen" %} + {{configurable_text.plans_page.plans_edit_message}}

{% form id="goal-edit" form_object=form method="POST" %} diff --git a/src/open_inwoner/templates/pages/plans/list.html b/src/open_inwoner/templates/pages/plans/list.html index 99d6682ea1..9e64fb0336 100644 --- a/src/open_inwoner/templates/pages/plans/list.html +++ b/src/open_inwoner/templates/pages/plans/list.html @@ -7,7 +7,7 @@

{% button href="plans:plan_create" text=_("Start nieuwe samenwerking") primary=True icon="group" icon_outlined=True %}

- {% trans "Hier werkt u samen met uw contactpersonen aan uw doelen." %} + {{configurable_text.plans_page.plans_intro|linebreaksbr}}

{% card_container plans=object_list columns=2 %} diff --git a/src/open_inwoner/templates/pages/user-home.html b/src/open_inwoner/templates/pages/user-home.html index 1d82a7b91b..74f8aa7d06 100644 --- a/src/open_inwoner/templates/pages/user-home.html +++ b/src/open_inwoner/templates/pages/user-home.html @@ -30,6 +30,6 @@

{{ plan.title }}

{% endfor %}
{% else %} -

{% trans "U heeft nog geen plan gemaakt." %}

+

{{configurable_text.plans_page.plans_no_plans_message}}

{% endif %} {% endblock user_content %} diff --git a/src/open_inwoner/utils/context_processors.py b/src/open_inwoner/utils/context_processors.py index 31fc637419..c3860f9131 100644 --- a/src/open_inwoner/utils/context_processors.py +++ b/src/open_inwoner/utils/context_processors.py @@ -36,11 +36,18 @@ def settings(request): "home_map_intro": config.home_map_intro, "home_questionnaire_title": config.home_questionnaire_title, "home_questionnaire_subtitle": config.home_questionnaire_subtitle, + "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, From 352fa26ed77c10a940ff793e1c4a8c49fe2c5edb Mon Sep 17 00:00:00 2001 From: Bart van der Schoor Date: Wed, 16 Nov 2022 12:46:07 +0100 Subject: [PATCH 2/3] [#906] Renamed home_questionnaire_intro field to be consistent with other code --- src/open_inwoner/configurations/admin.py | 2 +- ...econfiguration_home_questionnaire_intro.py | 18 +++++++++++++ ...econfiguration_home_questionnaire_intro.py | 25 +++++++++++++++++++ src/open_inwoner/configurations/models.py | 7 +++--- src/open_inwoner/templates/pages/home.html | 2 +- src/open_inwoner/utils/context_processors.py | 2 +- 6 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 src/open_inwoner/configurations/migrations/0023_rename_home_questionnaire_subtitle_siteconfiguration_home_questionnaire_intro.py create mode 100644 src/open_inwoner/configurations/migrations/0024_alter_siteconfiguration_home_questionnaire_intro.py diff --git a/src/open_inwoner/configurations/admin.py b/src/open_inwoner/configurations/admin.py index 90b40d1758..f76b859bb2 100644 --- a/src/open_inwoner/configurations/admin.py +++ b/src/open_inwoner/configurations/admin.py @@ -82,7 +82,7 @@ class SiteConfigurarionAdmin(OrderedInlineModelAdminMixin, SingletonModelAdmin): "theme_title", "theme_intro", "home_questionnaire_title", - "home_questionnaire_subtitle", + "home_questionnaire_intro", "select_questionnaire_title", "select_questionnaire_subtitle", "plans_intro", diff --git a/src/open_inwoner/configurations/migrations/0023_rename_home_questionnaire_subtitle_siteconfiguration_home_questionnaire_intro.py b/src/open_inwoner/configurations/migrations/0023_rename_home_questionnaire_subtitle_siteconfiguration_home_questionnaire_intro.py new file mode 100644 index 0000000000..80750db48d --- /dev/null +++ b/src/open_inwoner/configurations/migrations/0023_rename_home_questionnaire_subtitle_siteconfiguration_home_questionnaire_intro.py @@ -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", + ), + ] diff --git a/src/open_inwoner/configurations/migrations/0024_alter_siteconfiguration_home_questionnaire_intro.py b/src/open_inwoner/configurations/migrations/0024_alter_siteconfiguration_home_questionnaire_intro.py new file mode 100644 index 0000000000..46322d989a --- /dev/null +++ b/src/open_inwoner/configurations/migrations/0024_alter_siteconfiguration_home_questionnaire_intro.py @@ -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", + ), + ), + ] diff --git a/src/open_inwoner/configurations/models.py b/src/open_inwoner/configurations/models.py index c9b15e66e7..b4ca970a0e 100644 --- a/src/open_inwoner/configurations/models.py +++ b/src/open_inwoner/configurations/models.py @@ -138,11 +138,10 @@ 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, diff --git a/src/open_inwoner/templates/pages/home.html b/src/open_inwoner/templates/pages/home.html index 789aaa4a81..aceaff8f9b 100644 --- a/src/open_inwoner/templates/pages/home.html +++ b/src/open_inwoner/templates/pages/home.html @@ -31,7 +31,7 @@

{% if questionnaire_roots.exists %}

{{configurable_text.home_page.home_questionnaire_title}}

-

{{configurable_text.home_page.home_questionnaire_subtitle}}

+

{{configurable_text.home_page.home_questionnaire_intro|linebreaksbr}}

{% questionnaire root_nodes=questionnaire_roots %} {% endif %} diff --git a/src/open_inwoner/utils/context_processors.py b/src/open_inwoner/utils/context_processors.py index c3860f9131..ef35d4a626 100644 --- a/src/open_inwoner/utils/context_processors.py +++ b/src/open_inwoner/utils/context_processors.py @@ -35,7 +35,7 @@ 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, }, From c58e012e6203da70315a6293a72957f5776c99a6 Mon Sep 17 00:00:00 2001 From: Bart van der Schoor Date: Wed, 16 Nov 2022 12:50:14 +0100 Subject: [PATCH 3/3] [#906] Renamed select_questionnaire_intro field to be consistent with other code --- src/open_inwoner/configurations/admin.py | 2 +- ...onfiguration_select_questionnaire_intro.py | 18 +++++++++++++ ...onfiguration_select_questionnaire_intro.py | 25 +++++++++++++++++++ src/open_inwoner/configurations/models.py | 7 +++--- .../templates/pages/category/detail.html | 2 +- .../pages/profile/questionnaire.html | 2 +- src/open_inwoner/utils/context_processors.py | 2 +- 7 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 src/open_inwoner/configurations/migrations/0025_rename_select_questionnaire_subtitle_siteconfiguration_select_questionnaire_intro.py create mode 100644 src/open_inwoner/configurations/migrations/0026_alter_siteconfiguration_select_questionnaire_intro.py diff --git a/src/open_inwoner/configurations/admin.py b/src/open_inwoner/configurations/admin.py index f76b859bb2..8d4bf7bf3f 100644 --- a/src/open_inwoner/configurations/admin.py +++ b/src/open_inwoner/configurations/admin.py @@ -84,7 +84,7 @@ class SiteConfigurarionAdmin(OrderedInlineModelAdminMixin, SingletonModelAdmin): "home_questionnaire_title", "home_questionnaire_intro", "select_questionnaire_title", - "select_questionnaire_subtitle", + "select_questionnaire_intro", "plans_intro", "plans_no_plans_message", "plans_edit_message", diff --git a/src/open_inwoner/configurations/migrations/0025_rename_select_questionnaire_subtitle_siteconfiguration_select_questionnaire_intro.py b/src/open_inwoner/configurations/migrations/0025_rename_select_questionnaire_subtitle_siteconfiguration_select_questionnaire_intro.py new file mode 100644 index 0000000000..82101698cc --- /dev/null +++ b/src/open_inwoner/configurations/migrations/0025_rename_select_questionnaire_subtitle_siteconfiguration_select_questionnaire_intro.py @@ -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", + ), + ] diff --git a/src/open_inwoner/configurations/migrations/0026_alter_siteconfiguration_select_questionnaire_intro.py b/src/open_inwoner/configurations/migrations/0026_alter_siteconfiguration_select_questionnaire_intro.py new file mode 100644 index 0000000000..7968cd795a --- /dev/null +++ b/src/open_inwoner/configurations/migrations/0026_alter_siteconfiguration_select_questionnaire_intro.py @@ -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", + ), + ), + ] diff --git a/src/open_inwoner/configurations/models.py b/src/open_inwoner/configurations/models.py index b4ca970a0e..c7f0fa2639 100644 --- a/src/open_inwoner/configurations/models.py +++ b/src/open_inwoner/configurations/models.py @@ -163,13 +163,12 @@ class SiteConfiguration(SingletonModel): 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=_( diff --git a/src/open_inwoner/templates/pages/category/detail.html b/src/open_inwoner/templates/pages/category/detail.html index a58eabda2e..07564c745d 100644 --- a/src/open_inwoner/templates/pages/category/detail.html +++ b/src/open_inwoner/templates/pages/category/detail.html @@ -39,7 +39,7 @@

diff --git a/src/open_inwoner/templates/pages/profile/questionnaire.html b/src/open_inwoner/templates/pages/profile/questionnaire.html index 68b3358731..eff9ab403d 100644 --- a/src/open_inwoner/templates/pages/profile/questionnaire.html +++ b/src/open_inwoner/templates/pages/profile/questionnaire.html @@ -3,7 +3,7 @@ {% block content %}

{{configurable_text.questionnaire_page.select_questionnaire_title}}

-

{{configurable_text.questionnaire_page.select_questionnaire_subtitle}}

+

{{configurable_text.questionnaire_page.select_questionnaire_intro|linebreaksbr}}

{% questionnaire root_nodes=root_nodes %} {% endblock content %} diff --git a/src/open_inwoner/utils/context_processors.py b/src/open_inwoner/utils/context_processors.py index ef35d4a626..620e5fca13 100644 --- a/src/open_inwoner/utils/context_processors.py +++ b/src/open_inwoner/utils/context_processors.py @@ -50,7 +50,7 @@ def settings(request): }, "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,