Skip to content

Commit

Permalink
fix persona ct
Browse files Browse the repository at this point in the history
  • Loading branch information
cekk committed Jul 21, 2024
1 parent c138019 commit 842741e
Show file tree
Hide file tree
Showing 18 changed files with 519 additions and 265 deletions.
18 changes: 2 additions & 16 deletions src/iosanita/contenttypes/adapters/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,8 @@
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
>

<!-- <adapter
factory=".servizi_correlati.GetCorrelatiServizi"
provides=".interfaces.ICorrelati"
for="design.plone.contenttypes.interfaces.servizio.IServizio
zope.publisher.interfaces.browser.IHTTPRequest"
name="correlati-servizi"
/>
<adapter factory=".searchabletext_indexers.RelationChoiceFieldConverter" />
<adapter factory=".searchabletext_indexers.RelationListFieldConverter" />
<adapter
factory=".searchabletext_indexers.TextBlockSearchableText"
name="text"
/> -->

<adapter factory=".query.ZCatalogCompatibleQueryAdapter" />

<adapter factory=".schema_tweaks.SchemaTweaks" name="schema.tweaks_iosanita" />

</configure>
25 changes: 25 additions & 0 deletions src/iosanita/contenttypes/adapters/schema_tweaks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from plone.autoform.interfaces import IFormFieldProvider
from plone.supermodel.interfaces import ISchemaPlugin
from zope.component import adapter
from zope.interface import implementer


@implementer(ISchemaPlugin)
@adapter(IFormFieldProvider)
class SchemaTweaks(object):
"""
Fix fields for content-types to be like v2 of design.plone.contenttypes
"""

order = 99999

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

def __call__(self):
self.set_description_required()

def set_description_required(self):
"""fix Documento fields"""
if self.schema.getName() == "IBasic":
self.schema["description"].required = True
32 changes: 30 additions & 2 deletions src/iosanita/contenttypes/content/persona.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,37 @@
# -*- coding: utf-8 -*-
from iosanita.contenttypes.interfaces.persona import IPersona
from plone.dexterity.content import Container
from plone.app.content.interfaces import INameFromTitle
from plone.i18n.normalizer import idnormalizer
from zope.interface import implementer


@implementer(IPersona)
@implementer(IPersona, INameFromTitle)
class Persona(Container):
""" """
"""Persona CT"""

@property
def title(self):
"""
Title is set from nome and cognome fields
"""
nome = getattr(self, "nome", "")
cognome = getattr(self, "cognome", "")
titolo_persona = getattr(self, "titolo_persona", "")
return " ".join([p for p in [titolo_persona, cognome, nome] if p])

@title.setter
def title(self, value):
pass

# maybe needed when we enable rubrica
# @property
# def rubrica_title(self):
# if getattr(self, "nome", "") and getattr(self, "cognome", ""):
# return "{cognome} {nome}".format(nome=self.nome, cognome=self.cognome)
# else:
# return ""

# @property
# def rubrica_id(self):
# return idnormalizer.normalize(self.rubrica_title)
31 changes: 5 additions & 26 deletions src/iosanita/contenttypes/events/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,6 @@
},
],
},
"Incarico": {
"content": [
{"id": "compensi-file", "title": "Compensi", "allowed": ("File",)},
{
"id": "importi-di-viaggio-e-o-servizi",
"title": "Importi di viaggio e/o servizi",
"allowed_types": ("File",),
},
],
"allowed_types": [],
},
"Venue": {
"content": [
{
Expand Down Expand Up @@ -107,11 +96,11 @@
"title": "Curriculum vitae",
"allowed_types": ("File",),
},
# {
# "id": "multimedia",
# "title": "Multimedia",
# "allowed_types": ("Image", "Video"),
# },
{
"id": "multimedia",
"title": "Multimedia",
"allowed_types": ("Image"),
},
{
"id": "altri-documenti",
"title": "Altri documenti",
Expand All @@ -120,16 +109,6 @@
],
"allowed_types": [],
},
"Pratica": {
"content": [
{
"id": "allegati",
"title": "Allegati",
"type": "Folder",
"allowed_types": ("File",),
}
],
},
"Servizio": {
"content": [
{
Expand Down
Loading

0 comments on commit 842741e

Please sign in to comment.