Skip to content

Commit

Permalink
Booking details help text configurable in the booking type (#215)
Browse files Browse the repository at this point in the history
* Booking details help text configurable in the booking type

* Fix imports order

* Translations

* fix

* Fix tests

* testi

---------

Co-authored-by: Mauro Amico <[email protected]>
  • Loading branch information
folix-01 and mamico authored Aug 21, 2024
1 parent 01205ec commit fd8d8d4
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Changelog
2.7.7 (unreleased)
------------------

- Nothing changed yet.
- Bookings details help text in `Tipologia prenotazione`.
[folix-01]


2.7.6 (2024-06-27)
Expand Down
9 changes: 9 additions & 0 deletions src/redturtle/prenotazioni/content/prenotazione_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ class IPrenotazioneType(model.Schema):
# default=[],
# )

booking_details_help_text = RichText(
required=False,
title=_("booking_details_help_text_label", default="Bookign detail help text"),
description=_(
"booking_details_help_text_label_help",
default='This field will be visualized as "Details" helptext during the booking steps',
),
)


@implementer(IPrenotazioneType)
class PrenotazioneType(Item):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-06-27 14:15+0000\n"
"POT-Creation-Date: 2024-08-19 14:54+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -639,6 +639,16 @@ msgstr ""
msgid "booking_deleted_success"
msgstr ""

#. Default: "Bookign detail help text"
#: redturtle/prenotazioni/content/prenotazione_type.py:41
msgid "booking_details_help_text_label"
msgstr ""

#. Default: "This field will be visualized as \"Details\" helptext during the booking steps"
#: redturtle/prenotazioni/content/prenotazione_type.py:42
msgid "booking_details_help_text_label_help"
msgstr ""

#. Default: "Booking fields"
#: redturtle/prenotazioni/content/prenotazioni_folder.py:536
msgid "booking_fields_label"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2024-06-27 14:15+0000\n"
"POT-Creation-Date: 2024-08-19 14:54+0000\n"
"PO-Revision-Date: 2014-05-27 17:36+0200\n"
"Last-Translator: Alessandro Pisa <[email protected]>\n"
"Language-Team: American English <[email protected]>\n"
Expand Down Expand Up @@ -642,6 +642,16 @@ msgstr "Prenotazione creata"
msgid "booking_deleted_success"
msgstr "La tua prenotazione è stata cancellata."

#. Default: "Bookign detail help text"
#: redturtle/prenotazioni/content/prenotazione_type.py:41
msgid "booking_details_help_text_label"
msgstr "Istruzioni per campo dettaglio nella prenotazione"

#. Default: "This field will be visualized as \"Details\" helptext during the booking steps"
#: redturtle/prenotazioni/content/prenotazione_type.py:42
msgid "booking_details_help_text_label_help"
msgstr "Il testo verra visualizzato come testo d'aiuto per la compilazione del campo \"Dettagli\" da parte del cittadino nella form della prenotazione"

#. Default: "Booking fields"
#: redturtle/prenotazioni/content/prenotazioni_folder.py:536
msgid "booking_fields_label"
Expand Down
12 changes: 11 additions & 1 deletion src/redturtle/prenotazioni/locales/redturtle.prenotazioni.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-06-27 14:16+0000\n"
"POT-Creation-Date: 2024-08-19 14:54+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -642,6 +642,16 @@ msgstr ""
msgid "booking_deleted_success"
msgstr ""

#. Default: "Bookign detail help text"
#: redturtle/prenotazioni/content/prenotazione_type.py:41
msgid "booking_details_help_text_label"
msgstr ""

#. Default: "This field will be visualized as \"Details\" helptext during the booking steps"
#: redturtle/prenotazioni/content/prenotazione_type.py:42
msgid "booking_details_help_text_label_help"
msgstr ""

#. Default: "Booking fields"
#: redturtle/prenotazioni/content/prenotazioni_folder.py:536
msgid "booking_fields_label"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from plone import api
from plone.restapi.serializer.converters import json_compatible
from zope.component import adapter
from zope.interface import implementer

Expand All @@ -23,4 +24,7 @@ def __call__(self, *args, **kwargs):
"name": self.context.title,
"duration": str(self.context.duration),
"hidden": hidden,
"booking_details_help_text": json_compatible(
self.context.booking_details_help_text, self.context
),
}
18 changes: 16 additions & 2 deletions src/redturtle/prenotazioni/tests/test_booking_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,14 @@ def test_booking_schema_no_bookable_available(
expected = {
"booking_types": {
"bookable": [],
"unbookable": [{"duration": "30", "name": "Type A", "hidden": True}],
"unbookable": [
{
"duration": "30",
"name": "Type A",
"hidden": True,
"booking_details_help_text": None,
}
],
},
"fields": [
{
Expand Down Expand Up @@ -217,7 +224,14 @@ def test_booking_schema_bookable_available(

expected = {
"booking_types": {
"bookable": [{"duration": "30", "name": "Type A", "hidden": True}],
"bookable": [
{
"duration": "30",
"name": "Type A",
"hidden": True,
"booking_details_help_text": None,
}
],
"unbookable": [],
},
"fields": [
Expand Down

0 comments on commit fd8d8d4

Please sign in to comment.