theo/theo/web/menus.py
Lance Edgar fc89558472 Add support for new-style theo install command
also use upstream menus where possible
2023-01-18 15:21:06 -06:00

70 lines
2.3 KiB
Python

# -*- coding: utf-8; -*-
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2023 Lance Edgar
#
# This file is part of Rattail.
#
# Rattail is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# Rattail. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
"""
Web Menus
"""
from tailbone import menus as base
from theo.config import integrate_catapult, integrate_corepos, integrate_locsms
class TheoMenuHandler(base.MenuHandler):
"""
Theo menu handler
"""
def make_menus(self, request, **kwargs):
menus = [
self.make_custorders_menu(request),
self.make_people_menu(request),
self.make_products_menu(request),
self.make_vendors_menu(request),
]
# TODO: pretty sure this should handle things?
# TODO: ..if so then 100% upstream menu should work here?
# integration_menus = self.make_integration_menus(request)
# if integration_menus:
# menus.extend(integration_menus)
if integrate_catapult(self.config):
from tailbone_onager.menus import make_catapult_menu
menus.append(make_catapult_menu(request))
if integrate_corepos(self.config):
from tailbone_corepos.menus import make_corepos_menu
menus.append(make_corepos_menu(request))
if integrate_locsms(self.config):
from tailbone_locsms.menus import make_locsms_menu
menus.append(make_locsms_menu(request))
menus.extend([
self.make_reports_menu(request, include_trainwreck=True),
self.make_admin_menu(request, include_stores=True),
])
return menus