Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1#!/usr/local/bin/python
2# encoding: utf-8
3"""
4*xmatches_sidebar for the PESSTO Marshall*
6:Author:
7 David Young
8"""
9import sys
10import os
11import khufu
13def xmatches_sidebar(
14 log,
15 request,
16 thisPageName
17):
18 """Get the left navigation bar for the pessto marshall
20 **Key Arguments**
22 - ``log`` -- logger
23 - ``request`` -- the pyramid request
24 - ``thisPageName`` -- the name of the page currently displayed
27 **Return**
29 - ``leftNavBar`` -- the left navigation bar for the pessto marshall
31 """
32 import khufu
34 log.debug('starting the ``xmatches_sidebar`` function')
36 leftColumnContent = ""
38 header = _xmatches_sidebar_header(
39 log=log,
40 request=request
41 )
43 esoPhaseIIILinks = _get_xmatches_links(
44 log,
45 request=request,
46 thisPageName=thisPageName
47 )
49 xmatches_sidebar = """
50%(header)s
51%(esoPhaseIIILinks)s <br>
52""" % locals()
54 log.debug('completed the ``xmatches_sidebar`` function')
55 return xmatches_sidebar
57def _xmatches_sidebar_header(
58 log,
59 request):
60 """Generate the left navigation bar header content
62 **Key Arguments**
64 - ``log`` -- logger
65 - ``request`` -- the pyramid request
68 **Return**
70 - ``content`` -- the left nav bar header content
72 """
73 import khufu
75 log.debug('starting the ``_xmatches_sidebar_header`` function')
77 pesstoIcon = khufu.image(
78 src=request.static_path(
79 'marshall_webapp:static/images/pessto_icon.png'),
80 href=request.route_path('transients'),
81 display=False, # [ rounded | circle | polaroid ]
82 pull=False, # [ "left" | "right" | "center" ]
83 htmlClass=False,
84 thumbnail=False,
85 # width=25,
86 onPhone=True,
87 onTablet=True,
88 onDesktop=True,
89 htmlId="xmatches_sideBarPesstoIcon"
90 )
92 padding = khufu.grid_column(
93 span=1, # 1-12
94 offset=0, # 1-12
95 content="",
96 htmlId=False,
97 htmlClass=False,
98 onPhone=True,
99 onTablet=True,
100 onDesktop=True,
101 )
103 pesstoIcon = khufu.grid_column(
104 span=4, # 1-12
105 offset=8, # 1-12
106 content=pesstoIcon,
107 htmlId=False,
108 htmlClass=False,
109 onPhone=True,
110 onTablet=True,
111 onDesktop=True,
112 )
114 pesstoIcon = khufu.grid_row(
115 responsive=True,
116 columns=pesstoIcon,
117 htmlId="xmatches_sideBarPesstoIconRow",
118 htmlClass=False,
119 onPhone=True,
120 onTablet=True,
121 onDesktop=True
122 )
124 log.debug('completed the ``_xmatches_sidebar_header`` function')
125 # return "%(pesstoIcon)s %(createNewButton)s" % locals()
126 return "%(pesstoIcon)s" % locals()
128def _get_xmatches_links(
129 log,
130 request,
131 thisPageName):
132 """get development links
134 **Key Arguments**
136 - ``log`` -- logger
137 - ``thisPageName`` -- the name of the current page
140 **Return**
142 - ``developmentLinks`` -- the development queue - a list of links
144 """
145 import os
146 import khufu
148 log.debug('starting the ``_get_development_links`` function')
150 title = khufu.li(
151 content="Catalogue Crossmatches",
152 # if a subMenu for dropdown this should be <ul>
153 span=False, # [ False | 1-12 ]
154 disabled=False,
155 submenuTitle=False,
156 divider=False,
157 navStyle="header", # [ active | header ]
158 navDropDown=False,
159 pager=False # [ False | "previous" | "next" ]
160 )
162 theseLinks = []
163 linkTitles = ["catalogues", "sub-catalogues", "searches", "associations"]
164 linkTitles = ["catalogues"]
165 for ltitle in linkTitles:
166 thisLink = khufu.a(
167 content=ltitle,
168 href=request.route_path("xmatches_" + ltitle),
169 tableIndex=False,
170 triggerStyle=False
171 )
172 thisLink = khufu.li(
173 content=thisLink,
174 )
175 theseLinks.append(thisLink)
177 theseLinks.insert(0, title)
179 linkList = khufu.ul(
180 itemList=theseLinks, # e.g a list links
181 unstyled=False,
182 inline=False,
183 dropDownMenu=False, # [ false | true ]
184 navStyle="list", # [ nav | tabs | pills | list ]
185 navPull="right", # [ false | left | right ]
186 navDirection=False, # [ 'default' | 'stacked' | 'horizontal' ]
187 breadcrumb=False, # [ False | True ]
188 pager=False,
189 thumbnails=False,
190 mediaList=False
191 )
193 column = khufu.grid_column(
194 span=12, # 1-12
195 offset=0, # 1-12
196 content=linkList,
197 htmlId=False,
198 htmlClass=False,
199 onPhone=True,
200 onTablet=True,
201 onDesktop=True
202 )
204 developmentLinks = khufu.grid_row(
205 responsive=True,
206 columns=column,
207 htmlId=False,
208 htmlClass=False,
209 onPhone=True,
210 onTablet=True,
211 onDesktop=True
212 )
214 log.debug('completed the ``_get_development_links`` function')
215 return developmentLinks