Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide object factory adapters for data grid rows #165

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/recensio/plone/behaviors/book_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
from recensio.plone import _
from recensio.plone.behaviors.directives import fieldset_edited_volume
from recensio.plone.behaviors.directives import fieldset_reviewed_text
from z3c.form.object import registerFactoryAdapter
from zope import schema
from zope.component import adapter
from zope.interface import implementer
from zope.interface import Interface
from zope.interface import provider
from zope.schema.fieldproperty import FieldProperty


class IAdditionalTitleRowSchema(Interface):
Expand All @@ -21,6 +24,15 @@ class IAdditionalTitleRowSchema(Interface):
subtitle = schema.TextLine(title=_("Subtitle"), required=False)


@implementer(IAdditionalTitleRowSchema)
class AdditionalTitleRow:
title = FieldProperty(IAdditionalTitleRowSchema["title"])
subtitle = FieldProperty(IAdditionalTitleRowSchema["subtitle"])


registerFactoryAdapter(IAdditionalTitleRowSchema, AdditionalTitleRow)


@provider(IFormFieldProvider)
class IBookReview(model.Schema):
isbn = schema.TextLine(
Expand Down
28 changes: 28 additions & 0 deletions src/recensio/plone/content/review_exhibition.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
from recensio.plone import _
from recensio.plone.behaviors.directives import fieldset_reviewed_text
from recensio.plone.interfaces import IReview
from z3c.form.object import registerFactoryAdapter
from z3c.relationfield.schema import RelationChoice
from z3c.relationfield.schema import RelationList
from zope import interface
from zope import schema
from zope.interface import implementer
from zope.interface import provider
from zope.schema.fieldproperty import FieldProperty


class IExhibitingInstitutionRowSchema(interface.Interface):
Expand All @@ -29,13 +31,30 @@ class IExhibitingInstitutionRowSchema(interface.Interface):
)


@implementer(IExhibitingInstitutionRowSchema)
class ExhibitingInstitutionRow:
name = FieldProperty(IExhibitingInstitutionRowSchema["name"])
gnd = FieldProperty(IExhibitingInstitutionRowSchema["gnd"])


registerFactoryAdapter(IExhibitingInstitutionRowSchema, ExhibitingInstitutionRow)


class IYearsRowSchema(interface.Interface):
years = schema.TextLine(
title=_("Years"),
required=False,
)


@implementer(IYearsRowSchema)
class YearsRow:
years = FieldProperty(IYearsRowSchema["years"])


registerFactoryAdapter(IYearsRowSchema, YearsRow)


class IExhibitingOrganisationRowSchema(interface.Interface):
name = schema.TextLine(
title=_("Ausstellende Organisation (z. B. Stiftung)"),
Expand All @@ -47,6 +66,15 @@ class IExhibitingOrganisationRowSchema(interface.Interface):
)


@implementer(IExhibitingOrganisationRowSchema)
class ExhibitingOrganisationRow:
name = FieldProperty(IExhibitingOrganisationRowSchema["name"])
gnd = FieldProperty(IExhibitingOrganisationRowSchema["gnd"])


registerFactoryAdapter(IExhibitingOrganisationRowSchema, ExhibitingOrganisationRow)


class IDatesRowSchema(interface.Interface):
place = schema.TextLine(
title=_("Ort"),
Expand Down
Loading