diff --git a/bin/qcms b/bin/qcms index 74c873b..9d1da44 100755 --- a/bin/qcms +++ b/bin/qcms @@ -243,7 +243,7 @@ def create(folder:Annotated[str,typer.Argument(help="path of the project folder" root = 'www/html' _system = System() _layout = Layout() - _layout = _layout.build(root=root, footer = [{"text":term} for term in footer.split(',')],header={'title':title,'subtitle':subtitle} ) + _layout = _layout.build(root=root, order={'menu':[]}, footer = [{"text":term} for term in footer.split(',')],header={'title':title,'subtitle':subtitle} ) _system = System() _system = _system.build(version=version,port=port, context=context) diff --git a/cms/static/js/menu.js b/cms/static/js/menu.js index 8f1ef59..e0b32a8 100644 --- a/cms/static/js/menu.js +++ b/cms/static/js/menu.js @@ -237,7 +237,11 @@ var QCMSBasic= function(_layout,_context,_clickEvent) { var _me = this ; var _make = this._make var _layout = this._layout - Object.keys(this._layout.menu).forEach(function(_name){ + + var _names = _layout.order.menu.length > 0 ? _layout.order.menu : Object.keys(_layout.menu) + + // Object.keys(this._layout.menu) + _names.forEach(function(_name){ var _div = _me._make(_layout.menu[_name]) ; @@ -291,7 +295,9 @@ var QCMSTabs = function(_layout,_context,_clickEvent){ var _me = this; var _make = this._make var tabs = this.tabs - Object.keys(_layout.menu).forEach(function(_key){ + var _names = _layout.order.menu.length > 0 ? _layout.order.menu : Object.keys(_layout.menu) + // Object.keys(_layout.menu). + _names.forEach(function(_key){ _item = _layout.menu[_key] // console.log([_item]) _tabItem = _me._make(_key,_item) @@ -330,6 +336,17 @@ menu.tabs.init =function (_layout,_context){ // Let us determine what kind of menu is suited for this // @TODO: Make menus configurable i.e on other areas of the site // + + if (_layout.order != null){ + if (_layout.order.length == null && _layout.order.menu == null){ + _layout.order = {menu:[]} + + }else if (_layout.order.menu == null){ + _layout.order.menu = [] + } + }else{ + _layout.order = {menu:[]} + } var _count = 0 var _items = 0 Object.keys(_layout.menu).forEach(_name=>{