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.video import IVideoParagraph, VIDEO_PARAGRAPH_TYPE, \ |
20 from pyams_content.component.paragraph.interfaces.video import IVideoParagraph, VIDEO_PARAGRAPH_TYPE, \ |
21 VIDEO_PARAGRAPH_RENDERERS |
21 VIDEO_PARAGRAPH_RENDERERS, VIDEO_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 II18nManager, INegotiator, II18n |
23 from pyams_i18n.interfaces import II18nManager, INegotiator, II18n |
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(IVideoParagraph) |
38 @implementer(IVideoParagraph) |
41 @factory_config(provided=IVideoParagraph) |
39 @factory_config(provided=IVideoParagraph) |
42 class VideoParagraph(BaseParagraph): |
40 class VideoParagraph(BaseParagraph): |
43 """Video paragraph class""" |
41 """Video paragraph class""" |
44 |
42 |
45 icon_class = 'fa-film' |
43 icon_class = 'fa-film' |
46 icon_hint = _("Video") |
44 icon_hint = VIDEO_PARAGRAPH_NAME |
47 |
45 |
48 body = FieldProperty(IVideoParagraph['body']) |
46 body = FieldProperty(IVideoParagraph['body']) |
49 description = FieldProperty(IVideoParagraph['description']) |
47 description = FieldProperty(IVideoParagraph['description']) |
50 author = FieldProperty(IVideoParagraph['author']) |
48 author = FieldProperty(IVideoParagraph['author']) |
51 data = FileProperty(IVideoParagraph['data']) |
49 data = FileProperty(IVideoParagraph['data']) |
54 |
52 |
55 @utility_config(name=VIDEO_PARAGRAPH_TYPE, provides=IParagraphFactory) |
53 @utility_config(name=VIDEO_PARAGRAPH_TYPE, provides=IParagraphFactory) |
56 class VideoParagraphFactory(BaseParagraphFactory): |
54 class VideoParagraphFactory(BaseParagraphFactory): |
57 """Video paragraph factory""" |
55 """Video paragraph factory""" |
58 |
56 |
59 name = _("Video") |
57 name = VIDEO_PARAGRAPH_NAME |
60 content_type = VideoParagraph |
58 content_type = VideoParagraph |
61 |
59 |
62 |
60 |
63 @adapter_config(context=IVideoParagraph, provides=IContentChecker) |
61 @adapter_config(context=IVideoParagraph, provides=IContentChecker) |
64 class VideoParagraphContentChecker(BaseParagraphContentChecker): |
62 class VideoParagraphContentChecker(BaseParagraphContentChecker): |