--- a/src/pyams_content/component/paragraph/__init__.py Fri Mar 09 12:35:35 2018 +0100
+++ b/src/pyams_content/component/paragraph/__init__.py Fri Mar 09 15:34:15 2018 +0100
@@ -117,6 +117,25 @@
super(ParagraphFactoriesVocabulary, self).__init__(terms)
+@vocabulary_config(name='PyAMS content paragraphs')
+class ContentParagraphsVocabulary(SimpleVocabulary):
+ """Content paragraphs vocabulary"""
+
+ def __init__(self, context):
+ request = check_request()
+ if not IParagraphContainerTarget.providedBy(context):
+ context = get_parent(context, IParagraphContainerTarget)
+ if context is not None:
+ terms = [SimpleTerm(para.__name__,
+ title='ยง{0}: {1}'.format(index+1,
+ II18n(para).query_attribute('title', request=request) or
+ '----'))
+ for index, para in enumerate(IParagraphContainer(context).values())]
+ else:
+ terms = []
+ super(ContentParagraphsVocabulary, self).__init__(terms)
+
+
@adapter_config(context=IBaseParagraph, provides=IFormContextPermissionChecker)
class BaseParagraphPermissionChecker(ContextAdapter):
"""Paragraph permission checker"""