Skip to content

Commit

Permalink
refactor & format
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarde committed May 15, 2024
1 parent 4ceff58 commit 2530ff6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion backend/src/plone/edu/behaviors/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
description="Fields with education person information"
provides=".eduperson.IEduPersonData"
/>
</configure>
</configure>
23 changes: 14 additions & 9 deletions backend/src/plone/edu/behaviors/eduperson.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,28 @@
from zope.interface import provider
from zope.schema import TextLine


import json


AFFILIATION_SCHEMA = json.dumps(
{
'type': 'object',
'properties': {'items': {'type': 'array', 'items': {'type': 'object', 'properties': {}}}},
"type": "object",
"properties": {
"items": {"type": "array", "items": {"type": "object", "properties": {}}}
},
}
)


@provider(IFormFieldProvider)
class IEduPersonData(model.Schema):
"""A Person in context of educational institutions."""

academic_title = TextLine(
title=_("label_academic_title", default="Academic title"),
description=_("help_academic_title", default="The academic titles of the person."),
description=_(
"help_academic_title", default="The academic titles of the person."
),
required=False,
)

Expand All @@ -33,11 +38,11 @@ class IEduPersonData(model.Schema):
required=False,
)

affiliation = JSONField(
title='Mixedfield: datagrid field for Plone',
affiliations = JSONField(
title=_("label_affiliations", default="Affiliations"),
required=False,
schema=AFFILIATION_SCHEMA,
widget='affiliation_widget',
default={'items': []},
missing_value={'items': []},
widget="affiliation_widget",
default={"items": []},
missing_value={"items": []},
)
15 changes: 10 additions & 5 deletions backend/src/plone/edu/profiles/default/types/Person.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<?xml version="1.0"?>
<object name="Person" meta_type="Dexterity FTI" i18n:domain="collective.person" xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<property name="behaviors" purge="false">
<element value="plone.edu.behaviors.eduperson.IEduPersonData"/>
<?xml version="1.0" encoding="utf-8"?>
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
meta_type="Dexterity FTI"
name="Person"
i18n:domain="collective.person"
>
<property name="behaviors"
purge="false"
>
<element value="plone.edu.behaviors.eduperson.IEduPersonData" />
</property>
</object>

0 comments on commit 2530ff6

Please sign in to comment.