src/pyams_content/features/menu/__init__.py
changeset 635 ac6c59149f0d
child 810 7b5d910b2205
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/features/menu/__init__.py	Wed Jun 13 11:30:18 2018 +0200
@@ -0,0 +1,44 @@
+#
+# Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+
+__docformat__ = 'restructuredtext'
+
+
+# import standard library
+
+# import interfaces
+from pyams_content.features.menu.interfaces import IMenu, IMenusContainer, IMenuLink
+
+# import packages
+from pyams_content.component.association.container import AssociationContainer
+from zope.interface import implementer
+from zope.schema.fieldproperty import FieldProperty
+
+
+#
+# Menus classes
+#
+
+@implementer(IMenu)
+class Menu(AssociationContainer):
+    """Associations menu"""
+
+    visible = FieldProperty(IMenu['visible'])
+    title = FieldProperty(IMenu['title'])
+
+
+@implementer(IMenusContainer)
+class MenusContainer(AssociationContainer):
+    """Associations menus container"""
+
+    def get_visible_items(self):
+        return filter(lambda x: IMenu(x).visible, self.values())