19 # import packages |
19 # import packages |
20 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \ |
20 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \ |
21 IParagraphFactory |
21 IParagraphFactory |
22 from pyams_content.component.paragraph.interfaces.milestone import IMilestone, IMilestoneContainer, \ |
22 from pyams_content.component.paragraph.interfaces.milestone import IMilestone, IMilestoneContainer, \ |
23 IMilestoneContainerTarget, MILESTONE_CONTAINER_KEY, IMilestoneParagraph, MILESTONE_PARAGRAPH_TYPE, \ |
23 IMilestoneContainerTarget, MILESTONE_CONTAINER_KEY, IMilestoneParagraph, MILESTONE_PARAGRAPH_TYPE, \ |
24 MILESTONE_PARAGRAPH_RENDERERS |
24 MILESTONE_PARAGRAPH_RENDERERS, MILESTONE_PARAGRAPH_NAME |
25 from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE, ERROR_VALUE |
25 from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE, ERROR_VALUE |
26 from pyams_form.interfaces.form import IFormContextPermissionChecker |
26 from pyams_form.interfaces.form import IFormContextPermissionChecker |
27 from pyams_i18n.interfaces import II18n, II18nManager, INegotiator |
27 from pyams_i18n.interfaces import II18n, II18nManager, INegotiator |
28 from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectModifiedEvent, IObjectRemovedEvent |
28 from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectModifiedEvent, IObjectRemovedEvent |
29 from zope.location.interfaces import ISublocations |
29 from zope.location.interfaces import ISublocations |
194 |
194 |
195 @adapter_config(name='milestones', context=IMilestoneContainerTarget, provides=IContentChecker) |
195 @adapter_config(name='milestones', context=IMilestoneContainerTarget, provides=IContentChecker) |
196 class MilestoneContainerContentChecker(BaseContentChecker): |
196 class MilestoneContainerContentChecker(BaseContentChecker): |
197 """Milestones container content checker""" |
197 """Milestones container content checker""" |
198 |
198 |
199 label = _("Milestones") |
199 label = MILESTONE_PARAGRAPH_NAME |
200 sep = '\n' |
200 sep = '\n' |
201 weight = 200 |
201 weight = 200 |
202 |
202 |
203 def inner_check(self, request): |
203 def inner_check(self, request): |
204 output = [] |
204 output = [] |
217 @factory_config(provided=IMilestoneParagraph) |
217 @factory_config(provided=IMilestoneParagraph) |
218 class MilestoneParagraph(BaseParagraph): |
218 class MilestoneParagraph(BaseParagraph): |
219 """Milestones paragraph""" |
219 """Milestones paragraph""" |
220 |
220 |
221 icon_class = 'fa-arrows-h' |
221 icon_class = 'fa-arrows-h' |
222 icon_hint = _("Milestones") |
222 icon_hint = MILESTONE_PARAGRAPH_NAME |
223 |
223 |
224 renderer = FieldProperty(IMilestoneParagraph['renderer']) |
224 renderer = FieldProperty(IMilestoneParagraph['renderer']) |
225 |
225 |
226 |
226 |
227 @utility_config(name=MILESTONE_PARAGRAPH_TYPE, provides=IParagraphFactory) |
227 @utility_config(name=MILESTONE_PARAGRAPH_TYPE, provides=IParagraphFactory) |
228 class MilestoneParagraphFactory(BaseParagraphFactory): |
228 class MilestoneParagraphFactory(BaseParagraphFactory): |
229 """Milestones paragraph factory""" |
229 """Milestones paragraph factory""" |
230 |
230 |
231 name = _("Milestones paragraph") |
231 name = MILESTONE_PARAGRAPH_NAME |
232 content_type = MilestoneParagraph |
232 content_type = MilestoneParagraph |
233 |
233 |
234 |
234 |
235 @adapter_config(context=IMilestoneParagraph, provides=IContentChecker) |
235 @adapter_config(context=IMilestoneParagraph, provides=IContentChecker) |
236 class MilestoneParagraphContentChecker(BaseParagraphContentChecker): |
236 class MilestoneParagraphContentChecker(BaseParagraphContentChecker): |