Skip to content

Commit

Permalink
Merge branch 'main' into us_49038_come_fare_per
Browse files Browse the repository at this point in the history
  • Loading branch information
daniele-andreotti committed Jul 5, 2024
2 parents b1a5b93 + 805d93f commit d924d78
Show file tree
Hide file tree
Showing 21 changed files with 880 additions and 13 deletions.
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@
"z3c.jbot",
"plone.api>=1.8.4",
"plone.app.dexterity",
"redturtle.volto>=5.0.0",
"collective.volto.blocksfield",
"collective.venue[geolocation]",
"redturtle.volto",
"plone.restapi",
"collective.taxonomy",
],
extras_require={
"test": [
Expand Down
8 changes: 5 additions & 3 deletions src/iosanita/contenttypes/behaviors/additional_help_infos.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
from iosanita.contenttypes import _
from collective.volto.blocksfield.field import BlocksField
from plone.app.dexterity import textindexer
from plone.autoform.interfaces import IFormFieldProvider
from plone.dexterity.interfaces import IDexterityContent
from plone.supermodel import model
Expand All @@ -9,11 +11,9 @@
from zope import schema


# TODO: valutare se aggiungere 'box_aiuto', in alcuni CT e' obbligatorio
# e bisognerebbe metterlo unifrme per tutti in barba alle linee guida
@provider(IFormFieldProvider)
class IAdditionalHelpInfos(model.Schema):
ulteriori_informazioni = schema.TextLine(
ulteriori_informazioni = BlocksField(
title=_("ulteriori_informazioni", default="Ulteriori informazioni"),
description=_(
"ulteriori_informazioni_help",
Expand All @@ -28,6 +28,8 @@ class IAdditionalHelpInfos(model.Schema):
fields=["ulteriori_informazioni"],
)

textindexer.searchable("ulteriori_informazioni")


@implementer(IAdditionalHelpInfos)
@adapter(IDexterityContent)
Expand Down
99 changes: 99 additions & 0 deletions src/iosanita/contenttypes/behaviors/address.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# -*- coding: utf-8 -*-
from collective.address.behaviors import IAddress
from iosanita.contenttypes import _
from plone.app.dexterity import textindexer
from plone.autoform.interfaces import IFormFieldProvider
from plone.dexterity.interfaces import IDexterityContent
from plone.supermodel import model
from zope import schema
from zope.component import adapter
from zope.interface import implementer
from zope.interface import provider


class IAddressNomeSede(model.Schema):
nome_sede = schema.TextLine(
title=_("nome_sede", default="Nome sede"),
description=_(
"help_nome_sede",
default="Inserisci il nome della "
"sede, se non è presente tra i Luoghi del sito.",
),
required=False,
)
textindexer.searchable("nome_sede")


class IAddressLocal(model.Schema):
""" """

quartiere = schema.TextLine(
title=_("quartiere", default="Quartiere"),
description=_("help_quartiere", default=""),
required=False,
)

circoscrizione = schema.TextLine(
title=_("circoscrizione", default="Circoscrizione"),
description=_("help_circoscrizione", default=""),
required=False,
)

# searchabletext indexer
textindexer.searchable("quartiere")
textindexer.searchable("circoscrizione")


@provider(IFormFieldProvider)
class IAddressVenue(IAddress, IAddressLocal):
""""""

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


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

model.fieldset(
"luogo",
label=_("luogo_label", default="Luogo"),
fields=[
"nome_sede",
"street",
"zip_code",
"city",
"quartiere",
"circoscrizione",
"country",
],
)


@implementer(IAddressVenue)
@adapter(IDexterityContent)
class AddressVenue(object):
""" """

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


@implementer(IAddressEvent)
@adapter(IDexterityContent)
class AddressEvent(object):
""" """

def __init__(self, context):
self.context = context
31 changes: 31 additions & 0 deletions src/iosanita/contenttypes/behaviors/argomenti.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# -*- coding: utf-8 -*-
from iosanita.contenttypes import _
from plone.app.contenttypes.interfaces import IEvent
from plone.app.dexterity import textindexer
from plone.app.z3cform.widget import RelatedItemsFieldWidget
from plone.autoform import directives as form
from plone.autoform.interfaces import IFormFieldProvider
from plone.dexterity.interfaces import IDexterityContent
from plone.supermodel import model
from z3c.relationfield.schema import RelationChoice
from z3c.relationfield.schema import RelationList
Expand Down Expand Up @@ -74,10 +76,39 @@ class IArgomenti(IArgomentiSchema):
)


@provider(IFormFieldProvider)
class IArgomentiEvento(IArgomentiSchema):
""" """

tassonomia_argomenti = RelationList(
title=_("tassonomia_argomenti_label", default="Argomenti"),
description=_(
"tassonomia_argomenti_help",
default="Seleziona una lista di argomenti d'interesse per questo"
" contenuto.",
),
value_type=RelationChoice(
title=_("Argomenti correlati"),
vocabulary="plone.app.vocabularies.Catalog",
),
required=True,
default=[],
)


@implementer(IArgomenti)
@adapter(IDexterityContent)
class Argomenti(object):
""""""

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


@implementer(IArgomentiEvento)
@adapter(IEvent)
class ArgomentiEvento(object):
""""""

def __init__(self, context):
self.context = context
55 changes: 55 additions & 0 deletions src/iosanita/contenttypes/behaviors/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@
file="meta.zcml"
/>

<plone:behavior
name="iosanita.contenttypes.behavior.evento"
title="Metadati evento"
description="Adds fields."
factory=".evento.Evento"
provides=".evento.IEvento"
for="plone.event.interfaces.IEvent"
marker=".evento.IEvento"
/>

<plone:behavior
name="iosanita.contenttypes.behavior.argomenti"
title="Argomenti"
Expand All @@ -19,6 +29,26 @@
marker=".argomenti.IArgomenti"
/>

<plone:behavior
name="iosanita.contenttypes.behavior.argomenti_evento"
title="Argomenti"
description="Tassonomia argomenti evento"
factory=".argomenti.ArgomentiEvento"
provides=".argomenti.IArgomentiEvento"
for="plone.dexterity.interfaces.IDexterityContent"
marker=".argomenti.IArgomentiEvento"
/>

<plone:behavior
name="iosanita.contenttypes.behavior.strutture_correlate"
title="Strutture correlate"
description=""
factory=".strutture_correlate.StruttureCorrelate"
provides=".strutture_correlate.IStruttureCorrelate"
for="plone.dexterity.interfaces.IDexterityContent"
marker=".strutture_correlate.IStruttureCorrelate"
/>

<plone:behavior
name="iosanita.contenttypes.behavior.additional_help_infos"
title="Ulteriori campi aiuto testuali"
Expand Down Expand Up @@ -46,4 +76,29 @@
provides=".contatti.IContattiStep"
marker=".contatti.IContattiStep"
/>
<plone:behavior
name="iosanita.contenttypes.behavior.address_event"
title="Address Event"
description="Behavior address per Event."
factory=".address.AddressEvent"
provides=".address.IAddressEvent"
marker=".address.IAddressEvent"
/>
<plone:behavior
name="iosanita.contenttypes.behavior.contatti_event"
title="Contatti"
description="Behavior contatti per Event."
factory=".contatti.ContattiEvent"
provides=".contatti.IContattiEvent"
marker=".contatti.IContattiEvent"
/>
<plone:behavior
name="iosanita.contenttypes.behavior.geolocation_event"
title="Geolocatable"
description="Behavior geolocatable per Event."
factory=".geolocation.GeolocatableEvent"
provides=".geolocation.IGeolocatableEvent"
marker=".geolocation.IGeolocatableEvent"
/>

</configure>
21 changes: 21 additions & 0 deletions src/iosanita/contenttypes/behaviors/contatti.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,25 @@ class IContattiStep(model.Schema):
description=_(
"contact_info_help",
default="I contatti per questo step.",
)
)


class IContattiEvent(model.Schema):
contact_info = RelationList(
title=_(
"contact_info_label",
default="Punti di contatto",
),
description=_(
"contact_info_help",
default="Relazione con i punti di contatto dell'evento.",
),
required=True,
default=[],
value_type=RelationChoice(
title=_("Contatti"),
title=_("Punti di contatto"),
vocabulary="plone.app.vocabularies.Catalog",
),
)
Expand All @@ -48,6 +62,13 @@ class IContattiStep(model.Schema):
@implementer(IContattiStep)
@adapter(IStep)
class ContattiStep(object):
def __init__(self, context):
self.context = context


@implementer(IContattiEvent)
@adapter(IContattiEvent)
class ContattiEvent(object):
""" """

def __init__(self, context):
Expand Down
Loading

0 comments on commit d924d78

Please sign in to comment.