--- 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()
--- 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"""
--- 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 @@
<div class="footer footer-simple"
- tal:define="settings view.settings" i18n:domain="pyams_default_theme">
- <ul class="nav nav-tabs" role="tablist">
- <tal:loop repeat="link settings.links.get_visible_items(request)">
- <li role="presentation">
- <a tal:define="info view.get_link_info(link);
- href link.get_url(request);"
- tal:condition="href"
- tal:attributes="href href">${info.user_title}</a>
- </li>
- </tal:loop>
- <li role="presentation"
- tal:condition="settings.copyright">
- <a>${settings.copyright}</a>
- </li>
- </ul>
+ tal:define="settings view.settings"
+ tal:condition="settings is not None" i18n:domain="pyams_default_theme">
+ <tal:loop repeat="menu settings.menus.get_visible_items(request)">
+ <div>
+ <a class="title"
+ tal:define="info view.get_link_info(menu);
+ href menu.get_url(request);"
+ href="${href or None}">${info.user_title}</a>
+ <ul>
+ <tal:loop repeat="link menu.get_visible_items(request)">
+ <li role="presentation">
+ <a tal:define="info view.get_link_info(link);
+ href link.get_url(request);"
+ tal:condition="href"
+ tal:attributes="href href">${info.user_title}</a>
+ </li>
+ </tal:loop>
+ </ul>
+ </div>
+ </tal:loop>
+ <div tal:condition="settings.copyright">
+ <a class="title">${settings.copyright}</a>
+ </div>
</div>
--- 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