menu/tabs handling automatic

pull/10/head
Steve Nyemba 5 months ago
parent 0f6d586390
commit 5590fec6c6

@ -324,10 +324,25 @@ menu.tabs = { }
// return [_button,_label]
// }
menu.tabs.init =function (_layout){
//
// Let us determine what kind of menu is suited for this
// @TODO: Make menus configurable i.e on other areas of the site
//
var _count = 0
var _items = 0
Object.keys(_layout.menu).forEach(_name=>{
_items += _layout.menu[_name].length
_count += 1
})
if (_count == _items){
var _menuObject = new QCMSTabs (_layout)
}else{
var _menuObject = new QCMSBasic (_layout)
}
// console.log(_layout)
// var _tabs = new QCMSTabs (_layout)
var _tabs = new QCMSBasic (_layout)
_tabs.init()
_menuObject.init()
}

@ -11,33 +11,37 @@
<i class="fa-solid fa-home"></i>
</div>
{% endif %}
{% for _name in layout.menu %}
<!--{% for _name in layout.menu %}
<div class="item">
<div>
<i class="{{layout.icons[_name]}}"></i>
{{_name.replace('-', ' ').replace('_',' ')}}
</div>
{%if layout.menu[_name] %}
<div class="sub-menu border-round border">
{% for _item in layout.menu[_name] %}
{%if _item.type == 'open' %}
<div class="active" onclick="window.open('{{_item.uri}}','_self')">
{%elif _item.uri and _item.type not in ['dialog','embed'] %}
<div class="active" onclick="menu.apply('{{_item.uri}}','{{_item.text}}','{{_name}}','{{system.context}}')">
{% else %}
<!-- working on links/widgets -->
<div class="active" onclick='menu.apply_link({{_item|tojson}},"{{system.context}}")'>
{% endif %}
<i class="fa-solid fa-chevron-right" style="margin-right:4px"></i>
{{_item.text.replace('-',' ').replace('_',' ')}}
<div class="sub-menu border-round border">
{% for _item in layout.menu[_name] %}
{%if _item.type == 'open' %}
<div class="active" onclick="window.open('{{_item.uri}}','_self')">
{%elif _item.uri and _item.type not in ['dialog','embed'] %}
<div class="active" onclick="menu.apply('{{_item.uri}}','{{_item.text}}','{{_name}}','{{system.context}}')">
{% else %}
<!-- working on links/widgets -->
<div class="active" onclick='menu.apply_link({{_item|tojson}},"{{system.context}}")'>
{% endif %}
<i class="fa-solid fa-chevron-right" style="margin-right:4px"></i>
{{_item.text.replace('-',' ').replace('_',' ')}}
</div>
{%endfor%}
{%endfor%}
</div>
{%endif%}
</div>
{%endfor%}
{%endfor%}
-->
<script>
menu.tabs.init({{layout|tojson}})
</script>
Loading…
Cancel
Save