-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
519 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.