# HG changeset patch # User Thierry Florac # Date 1545989261 -3600 # Node ID a0f84efc334866d661a155116f658cbf999ad167 # Parent 23daa39df50bbb9c2711a7b326baca1c3771dc59 Replaced footer links with menus diff -r 23daa39df50b -r a0f84efc3348 src/pyams_default_theme/features/footer/__init__.py --- a/src/pyams_default_theme/features/footer/__init__.py Fri Dec 28 10:26:31 2018 +0100 +++ b/src/pyams_default_theme/features/footer/__init__.py Fri Dec 28 10:27:41 2018 +0100 @@ -20,9 +20,9 @@ from pyams_content.component.association.interfaces import ASSOCIATION_CONTAINER_KEY from pyams_content.features.footer.interfaces import IFooterSettings, IFooterTarget -from pyams_content.features.menu import Menu -from pyams_content.features.menu.interfaces import IMenuLinksContainer, IMenuLinksContainerTarget -from pyams_default_theme.features.footer.interfaces import ISimpleFooterLinksMenu, ISimpleFooterRendererSettings +from pyams_content.features.menu import MenusContainer, IMenusContainer +from pyams_content.features.menu.interfaces import IMenusContainerTarget +from pyams_default_theme.features.footer.interfaces import ISimpleFooterMenusContainer, ISimpleFooterRendererSettings from pyams_default_theme.layer import IPyAMSDefaultLayer from pyams_utils.adapter import ContextAdapter, adapter_config, get_annotation_adapter from pyams_utils.traversing import get_parent @@ -58,30 +58,30 @@ # Simple footer renderer settings # -SIMPLE_FOOTER_LINKS_KEY = '{0}::links'.format(ASSOCIATION_CONTAINER_KEY) +SIMPLE_FOOTER_MENUS_KEY = '{0}::menus'.format(ASSOCIATION_CONTAINER_KEY) -@implementer(ISimpleFooterRendererSettings, IMenuLinksContainerTarget) +@implementer(ISimpleFooterRendererSettings, IMenusContainerTarget) class SimpleFooterRendererSettings(Persistent, Location): """Simple footer renderer settings""" copyright = FieldProperty(ISimpleFooterRendererSettings['copyright']) @property - def links(self): - return get_annotation_adapter(self, SIMPLE_FOOTER_LINKS_KEY, Menu, - markers=ISimpleFooterLinksMenu, name='++ass++links') + def menus(self): + return get_annotation_adapter(self, SIMPLE_FOOTER_MENUS_KEY, MenusContainer, + markers=ISimpleFooterMenusContainer, name='++ass++menus') -@adapter_config(name='links', context=ISimpleFooterRendererSettings, provides=IMenuLinksContainer) -def simple_footer_links_adapter(context): - """Simple footer links adapter""" - return context.links +@adapter_config(name='menus', context=ISimpleFooterRendererSettings, provides=IMenusContainer) +def simple_footer_menus_adapter(context): + """Simple footer menus adapter""" + return context.menus -@adapter_config(name='links', context=ISimpleFooterRendererSettings, provides=ISublocations) +@adapter_config(name='menus', context=ISimpleFooterRendererSettings, provides=ISublocations) class SimpleFooterRendererSettingsSublocations(ContextAdapter): """Simple footer renderer settings sub-locations adapter""" def sublocations(self): - return self.context.links.values() + return self.context.menus.values() diff -r 23daa39df50b -r a0f84efc3348 src/pyams_default_theme/features/footer/interfaces.py --- a/src/pyams_default_theme/features/footer/interfaces.py Fri Dec 28 10:26:31 2018 +0100 +++ b/src/pyams_default_theme/features/footer/interfaces.py Fri Dec 28 10:27:41 2018 +0100 @@ -32,8 +32,8 @@ description=_("Copyright mention displayed in page footer"), required=False) - links = Attribute("Footer links") + menus = Attribute("Footer links") -class ISimpleFooterLinksMenu(Interface): - """Simple footer links marker interface""" +class ISimpleFooterMenusContainer(Interface): + """Simple footer menus marker interface""" diff -r 23daa39df50b -r a0f84efc3348 src/pyams_default_theme/features/footer/skin/templates/simple-footer.pt --- a/src/pyams_default_theme/features/footer/skin/templates/simple-footer.pt Fri Dec 28 10:26:31 2018 +0100 +++ b/src/pyams_default_theme/features/footer/skin/templates/simple-footer.pt Fri Dec 28 10:27:41 2018 +0100 @@ -1,17 +1,25 @@ diff -r 23daa39df50b -r a0f84efc3348 src/pyams_default_theme/features/footer/zmi/__init__.py --- a/src/pyams_default_theme/features/footer/zmi/__init__.py Fri Dec 28 10:26:31 2018 +0100 +++ b/src/pyams_default_theme/features/footer/zmi/__init__.py Fri Dec 28 10:27:41 2018 +0100 @@ -12,21 +12,16 @@ __docformat__ = 'restructuredtext' - -# import standard library +from z3c.form import field -# import interfaces -from pyams_default_theme.features.footer.interfaces import ISimpleFooterRendererSettings, ISimpleFooterLinksMenu +from pyams_content.features.footer.zmi import FooterSettingsRendererSettingsEditForm +from pyams_content.features.menu.zmi import IMenusView, MenusTable, MenusView +from pyams_default_theme.features.footer.interfaces import ISimpleFooterRendererSettings, ISimpleFooterMenusContainer from pyams_form.interfaces.form import IInnerSubForm from pyams_portal.interfaces import MANAGE_TEMPLATE_PERMISSION from pyams_skin.layer import IPyAMSLayer - -# import packages -from pyams_content.features.footer.zmi import FooterSettingsRendererSettingsEditForm -from pyams_content.features.menu.zmi import LinksTable, IMenuLinksView, MenuLinksView from pyams_utils.adapter import adapter_config from pyams_zmi.form import InnerAdminEditForm -from z3c.form import field from pyams_default_theme import _ @@ -45,23 +40,17 @@ # -# Footer links table view +# Footer menus table view # -class LinksAssociationsTable(LinksTable): - """Simple footer links associations table""" - - associations_name = 'links' - - -@adapter_config(name='simple-footer-links', +@adapter_config(name='simple-footer-menus', context=(ISimpleFooterRendererSettings, IPyAMSLayer, FooterSettingsRendererSettingsEditForm), provides=IInnerSubForm) -@adapter_config(name='++ass++links', context=(ISimpleFooterLinksMenu, IPyAMSLayer), provides=IMenuLinksView) -class SimpleFooterTabsView(MenuLinksView): +@adapter_config(name='++ass++menus', context=(ISimpleFooterMenusContainer, IPyAMSLayer), provides=IMenusView) +class SimpleFooterTabsView(MenusView): """Simple footer links view""" - title = _("Footer links") + title = _("Footer menus") - table_class = LinksAssociationsTable + table_class = MenusTable weight = 10