rattail-demo/rattail_demo/web/menus.py

98 lines
2.7 KiB
Python
Raw Normal View History

# -*- coding: utf-8; -*-
"""
Web Menus
"""
2023-01-14 16:13:58 -06:00
from tailbone import menus as base
2020-09-16 16:15:53 -05:00
from tailbone_corepos.menus import make_corepos_menu
2024-07-14 11:37:36 -05:00
class DemoMenuHandler(base.TailboneMenuHandler):
2023-01-14 16:13:58 -06:00
"""
Demo menu handler
"""
2021-02-18 20:20:31 -06:00
2023-01-14 16:13:58 -06:00
def make_menus(self, request, **kwargs):
2021-02-18 20:20:31 -06:00
people_menu = self.make_people_menu(request)
2021-02-18 20:20:31 -06:00
products_menu = self.make_products_menu(request)
vendors_menu = self.make_vendors_menu(request)
2020-09-16 16:15:53 -05:00
2023-01-14 16:13:58 -06:00
corepos_menu = make_corepos_menu(request)
2021-02-18 20:20:31 -06:00
2023-01-14 16:13:58 -06:00
shopfoo_menu = {
'title': "Shopfoo",
'type': 'menu',
'items': [
{
'title': "Products",
'route': 'shopfoo.products',
'perm': 'shopfoo.products.list',
},
{
'title': "Product Exports",
'route': 'shopfoo.product_exports',
'perm': 'shopfoo.product_exports.list',
},
{'type': 'sep'},
{
'title': "WooCommerce Products",
'route': 'woocommerce.products',
'perm': 'woocommerce.products.list',
},
],
}
reports_menu = self.make_reports_menu(request, include_trainwreck=True)
2021-02-18 20:20:31 -06:00
batch_menu = self.make_batches_menu(request)
2021-02-18 20:20:31 -06:00
tempmon_menu = self.make_tempmon_menu(request)
2021-02-18 20:20:31 -06:00
2023-01-14 16:13:58 -06:00
other_menu = {
'title': "Other",
'type': 'menu',
'items': [
{
'title': "Documentation",
'url': 'https://rattailproject.org/moin/RattailDemo',
'target': '_blank',
},
{
'title': "Source Code",
'url': 'https://forgejo.wuttaproject.org/rattail/rattail-demo',
2023-01-14 16:13:58 -06:00
'target': '_blank',
},
{
'title': "RattailProject.org",
'url': 'https://rattailproject.org',
'target': '_blank',
},
{'type': 'sep'},
{
'title': "Generate New Project",
'route': 'generated_projects.create',
'perm': 'generated_projects.create',
2023-01-14 16:13:58 -06:00
},
],
}
2021-02-18 20:20:31 -06:00
admin_menu = self.make_admin_menu(request, include_stores=True)
2023-01-14 16:13:58 -06:00
menus = [
people_menu,
products_menu,
vendors_menu,
corepos_menu,
shopfoo_menu,
reports_menu,
2023-01-14 16:13:58 -06:00
batch_menu,
tempmon_menu,
other_menu,
admin_menu,
]
2023-01-14 16:13:58 -06:00
return menus