From aec9275468c781b3c03ce5d4b2d1b317c979e0bc Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Thu, 22 Jun 2023 00:06:04 -0500 Subject: [PATCH] minor updates & bug fixes --- cms/__init__.py | 5 ++++- index.py | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cms/__init__.py b/cms/__init__.py index 751a666..e009f81 100644 --- a/cms/__init__.py +++ b/cms/__init__.py @@ -33,6 +33,9 @@ class components : # # content of each menu item _subItems = [ components.content (os.sep.join([_path,_name]))for _name in _items ] + if 'map' in _layout : + _items = [_name if _name not in _layout['map'] else _layout['map'][_name] for _name in _items] + _object = dict(zip(_items,_subItems)) #-- applying overwrites to the menu items for _name in _object : @@ -136,4 +139,4 @@ class components : # env = Environment(loader=FileSystemLoader(location)) env = Environment(loader=BaseLoader()) # env.globals['routes'] = _config['plugins'] - return env \ No newline at end of file + return env diff --git a/index.py b/index.py index 9e9228d..05a6249 100644 --- a/index.py +++ b/index.py @@ -189,6 +189,18 @@ if __name__ == '__main__' : _config = json.loads((open (_path)).read()) _root = _config['layout']['root'] _config['layout']['menu'] = cms.components.menu(_root,_config) + if 'map' in _config['layout'] and 'order' in _config['layout'] and 'menu' in _config['layout']['order'] : + """ + We are insuring that the order of the menu items can be manually configured and have proper representation without quircks associated with folder name convention + """ + _map = _config['layout']['map'] + labels = [_name if _name not in _map else _map[_name] for _name in _config['layout']['order']['menu']] + labels = [_name for _name in labels if _name in _config['layout']['menu']] + _config['layout']['order']['menu'] = labels + + else: + _config['layout']['order']['menu'] = list(_config['layout']['menu'].keys()) + # _config['data'] = cms.components.data(_config) # # Let us load the plugins if any are available