Skip to content

Commit

Permalink
Merge pull request #3 from RedTurtle/uo_ct
Browse files Browse the repository at this point in the history
Uo ct
  • Loading branch information
folix-01 authored Jul 12, 2024
2 parents 969839c + 2a1a790 commit c1ee8a0
Show file tree
Hide file tree
Showing 24 changed files with 3,840 additions and 23 deletions.
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
iosanita.contenttypes
50 changes: 50 additions & 0 deletions src/iosanita/contenttypes/behaviors/address.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
from zope.component import adapter
from zope.interface import implementer
from zope.interface import provider
from z3c.relationfield.schema import RelationChoice, RelationList
from plone.app.z3cform.widget import RelatedItemsFieldWidget
from plone.autoform import directives as form


class IAddressNomeSede(model.Schema):
Expand Down Expand Up @@ -85,6 +88,43 @@ class IAddressEvent(IAddress, IAddressNomeSede, IAddressLocal):
class IAddressPersona(IAddress, IAddressNomeSede, IAddressLocal):
""""""

model.fieldset(
"dove",
label=_("dove_label", default="Dove"),
fields=[
"nome_sede",
"street",
"zip_code",
"city",
"quartiere",
"circoscrizione",
"country",
],
)


@provider(IFormFieldProvider)
class IAddressUnitaOrganizzativa(IAddress, IAddressNomeSede, IAddressLocal):
""""""

structure = RelationList(
title=_("strutura_label", default="Structure"),
value_type=RelationChoice(
title=_("structure_relation_label"),
vocabulary="plone.app.vocabularies.Catalog",
),
required=False,
default=[],
)
form.widget(
"structure",
RelatedItemsFieldWidget,
vocabulary="plone.app.vocabularies.Catalog",
pattern_options={
"maximumSelectionSize": 1,
"selectableTypes": ["Struttura"],
},
)
model.fieldset(
"dove",
label=_("struttura_label", default="Dove"),
Expand All @@ -96,6 +136,7 @@ class IAddressPersona(IAddress, IAddressNomeSede, IAddressLocal):
"quartiere",
"circoscrizione",
"country",
"structure",
],
)

Expand Down Expand Up @@ -125,3 +166,12 @@ class AddressPersona(object):

def __init__(self, context):
self.context = context


@implementer(IAddressUnitaOrganizzativa)
@adapter(IDexterityContent)
class AddressUnitaOrganizzativa(object):
""" """

def __init__(self, context):
self.context = context
17 changes: 16 additions & 1 deletion src/iosanita/contenttypes/behaviors/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,14 @@
provides=".descrizione_estesa.IDescrizioneEstesa"
marker=".descrizione_estesa.IDescrizioneEstesa"
/>

<plone:behavior
name="iosanita.contenttypes.behavior.contatti_uo"
title="Contatti"
description="Behavior contatti per UO."
factory=".contatti.ContattiUnitaOrganizzativa"
provides=".contatti.IContattiUnitaOrganizzativa"
marker=".contatti.IContattiUnitaOrganizzativa"
/>
<plone:behavior
name="iosanita.contenttypes.behavior.contatti_step"
title="Contatti"
Expand All @@ -102,6 +109,14 @@
provides=".address.IAddressPersona"
marker=".address.IAddressPersona"
/>
<plone:behavior
name="iosanita.contenttypes.behavior.address_unita_organizzativa"
title="Address Unita Organizzativa"
description="Behavior address per Unita Organizzativa."
factory=".address.AddressUnitaOrganizzativa"
provides=".address.IAddressUnitaOrganizzativa"
marker=".address.IAddressUnitaOrganizzativa"
/>
<plone:behavior
name="iosanita.contenttypes.behavior.contatti_event"
title="Contatti"
Expand Down
72 changes: 64 additions & 8 deletions src/iosanita/contenttypes/behaviors/contatti.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# -*- coding: utf-8 -*-
from iosanita.contenttypes import _
from iosanita.contenttypes.interfaces.step import IStep
from iosanita.contenttypes.interfaces.persona import IPersona
from plone.app.z3cform.widget import RelatedItemsFieldWidget
from plone.autoform import directives as form
from plone.autoform.interfaces import IFormFieldProvider
Expand All @@ -11,6 +8,56 @@
from zope.component import adapter
from zope.interface import implementer
from zope.interface import provider
from plone.app.dexterity import textindexer
from collective.volto.blocksfield.field import BlocksField

from iosanita.contenttypes import _
from iosanita.contenttypes.interfaces.persona import IPersona
from iosanita.contenttypes.interfaces.unita_organizzativa import IUnitaOrganizzativa


@provider(IFormFieldProvider)
class IContattiUnitaOrganizzativa(model.Schema):
contact_info = RelationList(
title=_(
"contact_unita_organizzativa_info_label",
default="Punti di contatto dell'unità organizzativa",
),
description=_(
"contact_unita_organizzativa_info_help",
default="Contatti dell'unità organizzativa.",
),
required=True,
default=[],
value_type=RelationChoice(
title=_("Informazioni di contatto"),
vocabulary="plone.app.vocabularies.Catalog",
),
)
orario_pubblico = BlocksField(
title=_("orario_pubblico_label", default="Orario per il pubblico"),
description=_(
"orario_pubblico_help",
default="Indicare eventuali orari di accesso al pubblico",
),
required=True,
)

form.widget(
"contact_info",
RelatedItemsFieldWidget,
vocabulary="plone.app.vocabularies.Catalog",
pattern_options={
"selectableTypes": ["PuntoDiContatto"],
},
)
model.fieldset(
"contatti",
label=_("contatti_label", default="Contatti"),
fields=["contact_info", "orario_pubblico"],
)

textindexer.searchable("orario_pubblico")


@provider(IFormFieldProvider)
Expand All @@ -21,7 +68,7 @@ class IContattiStep(model.Schema):
default="Contatti",
),
description=_(
"contact_info_help",
"contatti_step_contact_info_help",
default="I contatti per questo step.",
),
)
Expand All @@ -31,11 +78,11 @@ class IContattiStep(model.Schema):
class IContattiEvent(model.Schema):
contact_info = RelationList(
title=_(
"contact_info_label",
"contatti_event_contact_info_label",
default="Punti di contatto",
),
description=_(
"contact_info_help",
"contatti_event_contact_info_help",
default="Relazione con i punti di contatto dell'evento.",
),
required=True,
Expand Down Expand Up @@ -64,7 +111,7 @@ class IContattiEvent(model.Schema):
class IContattiPersona(model.Schema):
contact_info = RelationList(
title=_(
"contact_info_label",
"contatti_persona_contact_info_label",
default="Punti di contatto",
),
description=_(
Expand Down Expand Up @@ -94,11 +141,20 @@ class IContattiPersona(model.Schema):
)


@implementer(IContattiUnitaOrganizzativa)
@adapter(IUnitaOrganizzativa)
class ContattiUnitaOrganizzativa(object):
""" """

def __init__(self, context):
self.context = context


@implementer(IContattiStep)
@adapter(IContattiStep)
class ContattiStep(object):
""" """

def __init__(self, context):
self.context = context

Expand Down
4 changes: 2 additions & 2 deletions src/iosanita/contenttypes/behaviors/evento.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class IEvento(model.Schema):
"""Marker inteerface for content type Evento"""

descrizione_estesa = BlocksField(
title=_("descrizione_estesa", default="Cosa è"),
title=_("event_descrizione_estesa", default="Cosa è"),
required=True,
description=_(
"descrizione_estesa_help",
"evento_descrizione_estesa_help",
default="Descrizione dettagliata e completa.",
),
)
Expand Down
13 changes: 10 additions & 3 deletions src/iosanita/contenttypes/behaviors/news_additional_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
@provider(IFormFieldProvider)
class INewsAdditionalFields(model.Schema):
descrizione_estesa = BlocksField(
title=_("descrizione_estesa", default="Descrizione estesa"),
title=_(
"new_additional_fields_descrizione_estesa", default="Descrizione estesa"
),
required=True,
description=_(
"descrizione_estesa_help",
"new_additional_fields_descrizione_estesa_help",
default="Descrizione dettagliata e completa.",
),
)
Expand Down Expand Up @@ -146,7 +148,12 @@ class INewsAdditionalFields(model.Schema):
model.fieldset(
"correlati",
label=_("correlati_label", default="Contenuti collegati"),
fields=["a_cura_di_persone", "notizie_correlate", "servizi_correlati", "documenti"],
fields=[
"a_cura_di_persone",
"notizie_correlate",
"servizi_correlati",
"documenti",
],
)
# custom fieldsets and order
form.order_before(descrizione_estesa="ILeadImageBehavior.image")
Expand Down
2 changes: 1 addition & 1 deletion src/iosanita/contenttypes/behaviors/strutture_correlate.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class IStruttureCorrelate(model.Schema):

model.fieldset(
"correlati",
label=_("struttura_label", default="Contenuti collegati"),
label=_("sturetture_correlate_struttura_label", default="Contenuti collegati"),
fields=["strutture_correlate"],
)

Expand Down
9 changes: 9 additions & 0 deletions src/iosanita/contenttypes/content/unita_organizzativa.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
from iosanita.contenttypes.interfaces.unita_organizzativa import IUnitaOrganizzativa
from plone.dexterity.content import Container
from zope.interface import implementer


@implementer(IUnitaOrganizzativa)
class UnitaOrganizzativa(Container):
""" """
10 changes: 5 additions & 5 deletions src/iosanita/contenttypes/interfaces/come_fare_per.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class IComeFarePer(model.Schema, IIosanitaContenttypes):
)

descrizione_estesa = BlocksField(
title=_("descrizione_estesa_label", default="Panoramica"),
title=_("come_fare_per_descrizione_estesa_label", default="Panoramica"),
description=_(
"descrizione_estesa_help",
"come_fare_per_descrizione_estesa_help",
default="Descrizione estesa.",
),
required=True,
Expand All @@ -38,8 +38,8 @@ class IComeFarePer(model.Schema, IIosanitaContenttypes):
title=_("a_chi_si_rivolge_label", default="A chi è rivolto"),
required=True,
description=_(
"a_chi_si_rivolge_help",
default="Descrizione testuale degli utenti dell'ASL a cui è rivolta la procedura.",
"come_fare_a_chi_si_rivolge_help",
default="A chi si rivolge questo servizio.",
),
)

Expand Down Expand Up @@ -92,7 +92,7 @@ class IComeFarePer(model.Schema, IIosanitaContenttypes):
parliamo_di = schema.List(
title=_("parliamo_di_label", default="Parliamo di"),
description=_(
"parliamo_di_help",
"come_fare_per_parliamo_di_help",
default="Indicazioni degli argomenti con cui il contenuto di pagina viene taggato.",
),
value_type=schema.Choice(
Expand Down
Loading

0 comments on commit c1ee8a0

Please sign in to comment.