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,7 +11,7 @@
<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>
@ -41,3 +41,7 @@
{%endif%} {%endif%}
</div> </div>
{%endfor%} {%endfor%}
-->
<script>
menu.tabs.init({{layout|tojson}})
</script>
Loading…
Cancel
Save