equal
deleted
inserted
replaced
16 # import standard library |
16 # import standard library |
17 |
17 |
18 # import interfaces |
18 # import interfaces |
19 from pyams_content.component.paragraph.interfaces import IParagraphFactory |
19 from pyams_content.component.paragraph.interfaces import IParagraphFactory |
20 from pyams_content.component.paragraph.interfaces.keypoint import IKeypointsParagraph, KEYPOINTS_PARAGRAPH_TYPE, \ |
20 from pyams_content.component.paragraph.interfaces.keypoint import IKeypointsParagraph, KEYPOINTS_PARAGRAPH_TYPE, \ |
21 KEYPOINTS_PARAGRAPH_RENDERERS |
21 KEYPOINTS_PARAGRAPH_RENDERERS, KEYPOINTS_PARAGRAPH_NAME |
22 from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE |
22 from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE |
23 from pyams_i18n.interfaces import II18n, II18nManager, INegotiator |
23 from pyams_i18n.interfaces import II18n, II18nManager, INegotiator |
24 |
24 |
25 # import packages |
25 # import packages |
26 from pyams_content.component.paragraph import BaseParagraph, BaseParagraphContentChecker, BaseParagraphFactory |
26 from pyams_content.component.paragraph import BaseParagraph, BaseParagraphContentChecker, BaseParagraphFactory |
32 from pyams_utils.traversing import get_parent |
32 from pyams_utils.traversing import get_parent |
33 from pyams_utils.vocabulary import vocabulary_config |
33 from pyams_utils.vocabulary import vocabulary_config |
34 from zope.interface import implementer |
34 from zope.interface import implementer |
35 from zope.schema.fieldproperty import FieldProperty |
35 from zope.schema.fieldproperty import FieldProperty |
36 |
36 |
37 from pyams_content import _ |
|
38 |
|
39 |
37 |
40 @implementer(IKeypointsParagraph) |
38 @implementer(IKeypointsParagraph) |
41 @factory_config(provided=IKeypointsParagraph) |
39 @factory_config(provided=IKeypointsParagraph) |
42 class KeypointsParagraph(BaseParagraph): |
40 class KeypointsParagraph(BaseParagraph): |
43 """Key points paragraph""" |
41 """Key points paragraph""" |
44 |
42 |
45 icon_class = 'fa-key' |
43 icon_class = 'fa-key' |
46 icon_hint = _("Key points") |
44 icon_hint = KEYPOINTS_PARAGRAPH_NAME |
47 |
45 |
48 @property |
46 @property |
49 def title(self): |
47 def title(self): |
50 body = II18n(self).query_attribute('body') |
48 body = II18n(self).query_attribute('body') |
51 return get_text_start(body, 50, 10) |
49 return get_text_start(body, 50, 10) |
56 |
54 |
57 @utility_config(name=KEYPOINTS_PARAGRAPH_TYPE, provides=IParagraphFactory) |
55 @utility_config(name=KEYPOINTS_PARAGRAPH_TYPE, provides=IParagraphFactory) |
58 class KeypointsParagraphFactory(BaseParagraphFactory): |
56 class KeypointsParagraphFactory(BaseParagraphFactory): |
59 """Key points paragraph factory""" |
57 """Key points paragraph factory""" |
60 |
58 |
61 name = _("Key points paragraph") |
59 name = KEYPOINTS_PARAGRAPH_NAME |
62 content_type = KeypointsParagraph |
60 content_type = KeypointsParagraph |
63 secondary_menu = True |
61 secondary_menu = True |
64 |
62 |
65 |
63 |
66 @adapter_config(context=IKeypointsParagraph, provides=IContentChecker) |
64 @adapter_config(context=IKeypointsParagraph, provides=IContentChecker) |