|
1 # |
|
2 # Copyright (c) 2012 Thierry Florac <tflorac AT onf.fr> |
|
3 # All Rights Reserved. |
|
4 # |
|
5 |
|
6 |
|
7 # import standard packages |
|
8 |
|
9 # import Zope3 interfaces |
|
10 from zope.viewlet.interfaces import IViewletManager, IViewlet |
|
11 |
|
12 # import local interfaces |
|
13 |
|
14 # import Zope3 packages |
|
15 from zope.schema import TextLine, Bool, Dict |
|
16 |
|
17 # import local packages |
|
18 |
|
19 from ztfy.myams import _ |
|
20 |
|
21 |
|
22 class IMainMenusViewletManager(IViewletManager): |
|
23 """Main menu viewlet manager""" |
|
24 |
|
25 |
|
26 class IMenu(IViewlet): |
|
27 """Menu interface""" |
|
28 |
|
29 header = TextLine(title=_("Menu header"), |
|
30 required=False) |
|
31 |
|
32 |
|
33 class IMenuItem(IViewlet): |
|
34 """Menu item interface |
|
35 |
|
36 A menu is a viewlet as well as a viewlets manager, |
|
37 containing sub-menus |
|
38 """ |
|
39 |
|
40 css_class = TextLine(title=_("CSS class"), |
|
41 required=False) |
|
42 |
|
43 icon_class = TextLine(title=_("Icon CSS class"), |
|
44 required=False) |
|
45 |
|
46 label = TextLine(title=_("Menu title"), |
|
47 required=False) |
|
48 |
|
49 badge = TextLine(title=_("Badge text"), |
|
50 required=False) |
|
51 |
|
52 badge_class = TextLine(title=_("Badge CSS class"), |
|
53 required=False) |
|
54 |
|
55 notice = TextLine(title=_("Notice text"), |
|
56 required=False) |
|
57 |
|
58 notice_class = TextLine(title=_("Notice CSS class"), |
|
59 required=False) |
|
60 |
|
61 click_handler = TextLine(title=_("Menu click handler"), |
|
62 required=False) |
|
63 |
|
64 url = TextLine(title=_("Menu link location"), |
|
65 required=False, |
|
66 default=u'#') |
|
67 |
|
68 modal_target = Bool(title=_("Modal target"), |
|
69 required=False, |
|
70 default=False) |
|
71 |
|
72 data = Dict(title=_("Menu data attributes"), |
|
73 key_type=TextLine(), |
|
74 value_type=TextLine(), |
|
75 required=False) |
|
76 |
|
77 def getURL(self): |
|
78 """Get menu target URL""" |
|
79 |
|
80 def getDataAttributes(self): |
|
81 """Get data attributes""" |