Updated Navigation menu for allowing for more than one row of hyperlinks...
svn: r18648
This commit is contained in:
parent
a0a19bce77
commit
b57f1b25cc
@ -1539,17 +1539,30 @@ class BasePage(object):
|
|||||||
('repositories', _("Repositories"), inc_repos),
|
('repositories', _("Repositories"), inc_repos),
|
||||||
("addressbook", _("Address Book"), self.report.inc_addressbook),
|
("addressbook", _("Address Book"), self.report.inc_addressbook),
|
||||||
('download', _("Download"), self.report.inc_download),
|
('download', _("Download"), self.report.inc_download),
|
||||||
('contact', _("Contact"), self.report.use_contact),
|
('contact', _("Contact"), self.report.use_contact)
|
||||||
]
|
]
|
||||||
|
|
||||||
# Remove menu sections if they are not being created?
|
# Remove menu sections if they are not being created?
|
||||||
navs = ((u, n) for u, n, c in navs if c)
|
navs = ((u, n) for u, n, c in navs if c)
|
||||||
|
menu_items = [[url, text] for url, text in navs]
|
||||||
|
|
||||||
|
number_items = len(menu_items)
|
||||||
|
num_cols = 9
|
||||||
|
num_rows = (number_items // num_cols) + 1
|
||||||
|
|
||||||
with Html("div", id ="navigation") as navigation:
|
with Html("div", id ="navigation") as navigation:
|
||||||
|
|
||||||
|
index = 0
|
||||||
|
for rows in range(num_rows):
|
||||||
unordered = Html("ul")
|
unordered = Html("ul")
|
||||||
navigation += unordered
|
navigation += unordered
|
||||||
|
|
||||||
for url_fname, nav_text in navs:
|
cols = 0
|
||||||
|
while (cols != num_cols and index < number_items):
|
||||||
|
url_fname, nav_text = menu_items[index]
|
||||||
|
|
||||||
|
print(index, number_items, num_rows, url_fname, nav_text)
|
||||||
|
|
||||||
if not _has_webpage_extension(url_fname):
|
if not _has_webpage_extension(url_fname):
|
||||||
url_fname += self.ext
|
url_fname += self.ext
|
||||||
|
|
||||||
@ -1600,6 +1613,9 @@ class BasePage(object):
|
|||||||
unordered += Html("li", attr =cs, inline =True) + (
|
unordered += Html("li", attr =cs, inline =True) + (
|
||||||
Html("a", nav_text, href =url, title =nav_text)
|
Html("a", nav_text, href =url, title =nav_text)
|
||||||
)
|
)
|
||||||
|
index += 1
|
||||||
|
cols += 1
|
||||||
|
|
||||||
# return navigation menu bar to its caller
|
# return navigation menu bar to its caller
|
||||||
return navigation
|
return navigation
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user