Add views, menu for Trainwreck

This commit is contained in:
Lance Edgar 2021-02-18 20:20:31 -06:00
parent 3384de9b63
commit 0c73ee07d6
3 changed files with 298 additions and 259 deletions

View file

@ -18,6 +18,7 @@ class DemoConfigExtension(ConfigExtension):
# tell rattail where our stuff lives # tell rattail where our stuff lives
config.setdefault('rattail', 'model', 'rattail_demo.db.model') config.setdefault('rattail', 'model', 'rattail_demo.db.model')
config.setdefault('rattail.trainwreck', 'model', 'rattail.trainwreck.db.model.defaults')
config.setdefault('rattail.mail', 'emails', 'rattail_demo.emails') config.setdefault('rattail.mail', 'emails', 'rattail_demo.emails')
config.setdefault('tailbone', 'menus', 'rattail_demo.web.menus') config.setdefault('tailbone', 'menus', 'rattail_demo.web.menus')

View file

@ -8,11 +8,9 @@ from tailbone_corepos.menus import make_corepos_menu
def simple_menus(request): def simple_menus(request):
url = request.route_url url = request.route_url
rattail_config = request.rattail_config
corepos_menu = make_corepos_menu(request) people_menu = {
menus = [
{
'title': "People", 'title': "People",
'type': 'menu', 'type': 'menu',
'items': [ 'items': [
@ -37,8 +35,9 @@ def simple_menus(request):
'perm': 'people.list', 'perm': 'people.list',
}, },
], ],
}, }
{
products_menu = {
'title': "Products", 'title': "Products",
'type': 'menu', 'type': 'menu',
'items': [ 'items': [
@ -78,8 +77,9 @@ def simple_menus(request):
'perm': 'uoms.list', 'perm': 'uoms.list',
}, },
], ],
}, }
{
vendors_menu = {
'title': "Vendors", 'title': "Vendors",
'type': 'menu', 'type': 'menu',
'items': [ 'items': [
@ -111,9 +111,11 @@ def simple_menus(request):
'perm': 'purchases.credits.list', 'perm': 'purchases.credits.list',
}, },
], ],
}, }
corepos_menu,
{ corepos_menu = make_corepos_menu(request)
shopfoo_menu = {
'title': "Shopfoo", 'title': "Shopfoo",
'type': 'menu', 'type': 'menu',
'items': [ 'items': [
@ -134,8 +136,9 @@ def simple_menus(request):
'perm': 'woocommerce.products.list', 'perm': 'woocommerce.products.list',
}, },
], ],
}, }
{
batch_menu = {
'title': "Batches", 'title': "Batches",
'type': 'menu', 'type': 'menu',
'items': [ 'items': [
@ -155,8 +158,21 @@ def simple_menus(request):
'perm': 'batch.importer.list', 'perm': 'batch.importer.list',
}, },
], ],
}, }
trainwreck_menu = {
'title': "Trainwreck",
'type': 'menu',
'items': [
{ {
'title': "Transactions",
'url': url('trainwreck.transactions'),
'perm': 'trainwreck.transactions.list',
},
],
}
tempmon_menu = {
'title': "TempMon", 'title': "TempMon",
'type': 'menu', 'type': 'menu',
'items': [ 'items': [
@ -181,8 +197,9 @@ def simple_menus(request):
'perm': 'tempmon.readings.list', 'perm': 'tempmon.readings.list',
}, },
], ],
}, }
{
other_menu = {
'title': "Other", 'title': "Other",
'type': 'menu', 'type': 'menu',
'items': [ 'items': [
@ -208,8 +225,9 @@ def simple_menus(request):
'perm': 'common.generate_project', 'perm': 'common.generate_project',
}, },
], ],
}, }
{
admin_menu = {
'title': "Admin", 'title': "Admin",
'type': 'menu', 'type': 'menu',
'items': [ 'items': [
@ -271,7 +289,24 @@ def simple_menus(request):
'perm': 'upgrades.list', 'perm': 'upgrades.list',
}, },
], ],
}, }
menus = [
people_menu,
products_menu,
vendors_menu,
corepos_menu,
shopfoo_menu,
batch_menu,
] ]
if rattail_config.trainwreck_engine:
menus.append(trainwreck_menu)
menus.extend([
tempmon_menu,
other_menu,
admin_menu,
])
return menus return menus

View file

@ -54,5 +54,8 @@ def includeme(config):
config.include('tailbone.views.batch.inventory') config.include('tailbone.views.batch.inventory')
config.include('tailbone.views.batch.importer') config.include('tailbone.views.batch.importer')
# trainwreck
config.include('tailbone.views.trainwreck.defaults')
# generate new project # generate new project
config.include('tailbone.views.projects') config.include('tailbone.views.projects')