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.header import IHeaderParagraph, HEADER_PARAGRAPH_TYPE, \ |
20 from pyams_content.component.paragraph.interfaces.header import IHeaderParagraph, HEADER_PARAGRAPH_TYPE, \ |
21 HEADER_PARAGRAPH_RENDERERS |
21 HEADER_PARAGRAPH_RENDERERS, HEADER_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(IHeaderParagraph) |
38 @implementer(IHeaderParagraph) |
41 @factory_config(provided=IHeaderParagraph) |
39 @factory_config(provided=IHeaderParagraph) |
42 class HeaderParagraph(BaseParagraph): |
40 class HeaderParagraph(BaseParagraph): |
43 """Header paragraph""" |
41 """Header paragraph""" |
44 |
42 |
45 icon_class = 'fa-download fa-rotate-180' |
43 icon_class = 'fa-download fa-rotate-180' |
46 icon_hint = _("Header") |
44 icon_hint = HEADER_PARAGRAPH_NAME |
47 |
45 |
48 @property |
46 @property |
49 def title(self): |
47 def title(self): |
50 header = II18n(self).query_attribute('header') |
48 header = II18n(self).query_attribute('header') |
51 return get_text_start(header, 50, 10) |
49 return get_text_start(header, 50, 10) |
56 |
54 |
57 @utility_config(name=HEADER_PARAGRAPH_TYPE, provides=IParagraphFactory) |
55 @utility_config(name=HEADER_PARAGRAPH_TYPE, provides=IParagraphFactory) |
58 class HeaderParagraphFactory(BaseParagraphFactory): |
56 class HeaderParagraphFactory(BaseParagraphFactory): |
59 """Header paragraph factory""" |
57 """Header paragraph factory""" |
60 |
58 |
61 name = _("Header paragraph") |
59 name = HEADER_PARAGRAPH_NAME |
62 content_type = HeaderParagraph |
60 content_type = HeaderParagraph |
63 |
61 |
64 |
62 |
65 @adapter_config(context=IHeaderParagraph, provides=IContentChecker) |
63 @adapter_config(context=IHeaderParagraph, provides=IContentChecker) |
66 class HeaderParagraphContentChecker(BaseParagraphContentChecker): |
64 class HeaderParagraphContentChecker(BaseParagraphContentChecker): |