Skip to content

Commit

Permalink
split news behaviors
Browse files Browse the repository at this point in the history
  • Loading branch information
mamico committed Jul 25, 2024
1 parent 2370cec commit 463f1aa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
8 changes: 8 additions & 0 deletions src/design/plone/contenttypes/behaviors/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
marker=".news_additional_fields.INewsAdditionalFields"
/>

<plone:behavior
name="design.plone.contenttypes.behavior.news_base"
title="Metadati news base (senza descrizione_estesa)"
description="Adds fields."
provides=".news_additional_fields.INewsAdditionalFieldsBase"
marker=".news_additional_fields.INewsAdditionalFieldsBase"
/>

<plone:behavior
name="design.plone.contenttypes.behavior.argomenti"
title="Argomenti"
Expand Down
25 changes: 14 additions & 11 deletions src/design/plone/contenttypes/behaviors/news_additional_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,7 @@


@provider(IFormFieldProvider)
class INewsAdditionalFields(model.Schema):
descrizione_estesa = BlocksField(
title=_("descrizione_estesa", default="Descrizione estesa"),
required=True,
description=_(
"descrizione_estesa_help",
default="Descrizione dettagliata e completa.",
),
)

class INewsAdditionalFieldsBase(model.Schema):
numero_progressivo_cs = schema.TextLine(
title=_(
"numero_progressivo_cs_label",
Expand Down Expand Up @@ -121,10 +112,22 @@ class INewsAdditionalFields(model.Schema):
fields=["notizie_correlate"],
)
# custom fieldsets and order
form.order_before(descrizione_estesa="ILeadImageBehavior.image")
form.order_before(numero_progressivo_cs="ILeadImageBehavior.image")
form.order_before(a_cura_di="ILeadImageBehavior.image")


@provider(IFormFieldProvider)
class INewsAdditionalFields(INewsAdditionalFieldsBase):
descrizione_estesa = BlocksField(
title=_("descrizione_estesa", default="Descrizione estesa"),
required=True,
description=_(
"descrizione_estesa_help",
default="Descrizione dettagliata e completa.",
),
)

form.order_before(descrizione_estesa="ILeadImageBehavior.image")
textindexer.searchable("descrizione_estesa")


Expand Down

0 comments on commit 463f1aa

Please sign in to comment.