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] // return [_button,_label]
// } // }
menu.tabs.init =function (_layout){ 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) // console.log(_layout)
// var _tabs = new QCMSTabs (_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> <i class="fa-solid fa-home"></i>
</div> </div>
{% endif %} {% endif %}
{% for _name in layout.menu %} <!--{% for _name in layout.menu %}
<div class="item"> <div class="item">
<div> <div>
<i class="{{layout.icons[_name]}}"></i> <i class="{{layout.icons[_name]}}"></i>
{{_name.replace('-', ' ').replace('_',' ')}} {{_name.replace('-', ' ').replace('_',' ')}}
</div> </div>
{%if layout.menu[_name] %} {%if layout.menu[_name] %}
<div class="sub-menu border-round border"> <div class="sub-menu border-round border">
{% for _item in layout.menu[_name] %} {% for _item in layout.menu[_name] %}
{%if _item.type == 'open' %} {%if _item.type == 'open' %}
<div class="active" onclick="window.open('{{_item.uri}}','_self')"> <div class="active" onclick="window.open('{{_item.uri}}','_self')">
{%elif _item.uri and _item.type not in ['dialog','embed'] %} {%elif _item.uri and _item.type not in ['dialog','embed'] %}
<div class="active" onclick="menu.apply('{{_item.uri}}','{{_item.text}}','{{_name}}','{{system.context}}')"> <div class="active" onclick="menu.apply('{{_item.uri}}','{{_item.text}}','{{_name}}','{{system.context}}')">
{% else %} {% else %}
<!-- working on links/widgets --> <!-- working on links/widgets -->
<div class="active" onclick='menu.apply_link({{_item|tojson}},"{{system.context}}")'> <div class="active" onclick='menu.apply_link({{_item|tojson}},"{{system.context}}")'>
{% endif %} {% endif %}
<i class="fa-solid fa-chevron-right" style="margin-right:4px"></i> <i class="fa-solid fa-chevron-right" style="margin-right:4px"></i>
{{_item.text.replace('-',' ').replace('_',' ')}} {{_item.text.replace('-',' ').replace('_',' ')}}
</div> </div>
{%endfor%} {%endfor%}
</div> </div>
{%endif%} {%endif%}
</div> </div>
{%endfor%} {%endfor%}
-->
<script>
menu.tabs.init({{layout|tojson}})
</script>
Loading…
Cancel
Save