-
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.
Merge pull request #138 from syslabcom/scrum-967-pages-in-journal
Add behavior for missing fields First Page and Last Page
- Loading branch information
Showing
4 changed files
with
61 additions
and
0 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
51 changes: 51 additions & 0 deletions
51
src/recensio/plone/behaviors/pages_of_review_in_journal.py
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,51 @@ | ||
from plone.autoform.interfaces import IFormFieldProvider | ||
from plone.dexterity.interfaces import IDexterityContent | ||
from plone.supermodel import model | ||
from recensio.plone import _ | ||
from recensio.plone.behaviors.directives import fieldset_review | ||
from zope import schema | ||
from zope.component import adapter | ||
from zope.interface import provider | ||
|
||
|
||
@provider(IFormFieldProvider) | ||
class IPagesOfReviewInJournal(model.Schema): | ||
pageStartOfReviewInJournal = schema.Int( | ||
title=_("label_page_start_of_review_in_journal", default="First page"), | ||
required=False, | ||
) | ||
pageEndOfReviewInJournal = schema.Int( | ||
title=_("label_page_end_of_review_in_journal", default="Last page"), | ||
required=False, | ||
) | ||
|
||
fieldset_review( | ||
[ | ||
"pageStartOfReviewInJournal", | ||
"pageEndOfReviewInJournal", | ||
] | ||
) | ||
|
||
|
||
@adapter(IDexterityContent) | ||
class PagesOfReviewInJournal: | ||
"""Adapter for IPagesOfReviewInJournal.""" | ||
|
||
def __init__(self, context): | ||
self.context = context | ||
|
||
@property | ||
def pageStartOfReviewInJournal(self): | ||
return self.context.pageStartOfReviewInJournal | ||
|
||
@pageStartOfReviewInJournal.setter | ||
def pageStartOfReviewInJournal(self, value): | ||
self.context.pageStartOfReviewInJournal = value | ||
|
||
@property | ||
def pageEndOfReviewInJournal(self): | ||
return self.context.pageEndOfReviewInJournal | ||
|
||
@pageEndOfReviewInJournal.setter | ||
def pageEndOfReviewInJournal(self, value): | ||
self.context.pageEndOfReviewInJournal = value |
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