32 lines
1023 B
Python
32 lines
1023 B
Python
import yaml
|
|
|
|
from render import listPages
|
|
|
|
firstItem = True
|
|
|
|
def headerGen(item, root):
|
|
global firstItem
|
|
if(root and not firstItem):
|
|
separator = '<span class="menuSeparator">|</span>'
|
|
else:
|
|
separator = ''
|
|
firstItem = False
|
|
|
|
if(not ('klickable' in item and item['klickable'] is False)):
|
|
item['lable'] = '<a href="' + item["url"] + '">' + item["lable"] + '</a>'
|
|
|
|
if('sub' not in item):
|
|
return '<li>' + separator + '<span class="menuLable">' + item["lable"] + '</span></li>'
|
|
|
|
data = ''
|
|
subicon = ''
|
|
if(root):
|
|
subicon = ' <svg class="menuDropIcon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><path d="M1,3.7L5,8L9,3.7" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" fill="none" stroke="#eee"></path></svg>'
|
|
data += ' data-hassub="true"'
|
|
|
|
html = '<li' + data + '>' + separator + '<span class="menuLable sub">' + item["lable"] + subicon + '</span><ul class="submenu">'
|
|
html += listPages(item['sub'], item['url'], headerGen)
|
|
|
|
return html + '</ul></li>'
|
|
|