Let config totally disable the old/legacy jQuery mobile app

This commit is contained in:
Lance Edgar 2020-04-04 20:51:49 -05:00
parent d2c4791611
commit d9f6a7201e
11 changed files with 87 additions and 48 deletions

View file

@ -975,11 +975,13 @@ class PurchasingBatchView(BatchMasterView):
@classmethod
def _purchasing_defaults(cls, config):
rattail_config = config.registry.settings.get('rattail_config')
route_prefix = cls.get_route_prefix()
url_prefix = cls.get_url_prefix()
permission_prefix = cls.get_permission_prefix()
model_key = cls.get_model_key()
model_title = cls.get_model_title()
legacy_mobile = cls.legacy_mobile_enabled(rattail_config)
# eligible purchases (AJAX)
config.add_route('{}.eligible_purchases'.format(route_prefix), '{}/eligible-purchases'.format(url_prefix))
@ -987,7 +989,7 @@ class PurchasingBatchView(BatchMasterView):
renderer='json', permission='{}.view'.format(permission_prefix))
# add new product
if cls.supports_new_product:
if legacy_mobile and cls.supports_new_product:
config.add_tailbone_permission(permission_prefix, '{}.new_product'.format(permission_prefix),
"Create new Product when adding row to {}".format(model_title))
config.add_route('mobile.{}.new_product'.format(route_prefix), '{}/{{{}}}/new-product'.format(url_prefix, model_key))

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2019 Lance Edgar
# Copyright © 2010-2020 Lance Edgar
#
# This file is part of Rattail.
#
@ -1804,14 +1804,16 @@ class ReceivingBatchView(PurchasingBatchView):
instance_url_prefix = cls.get_instance_url_prefix()
model_key = cls.get_model_key()
permission_prefix = cls.get_permission_prefix()
legacy_mobile = cls.legacy_mobile_enabled(rattail_config)
# row-level receiving
config.add_route('{}.receive_row'.format(route_prefix), '{}/{{uuid}}/rows/{{row_uuid}}/receive'.format(url_prefix))
config.add_view(cls, attr='receive_row', route_name='{}.receive_row'.format(route_prefix),
permission='{}.edit_row'.format(permission_prefix))
config.add_route('mobile.{}.receive_row'.format(route_prefix), '/mobile{}/{{uuid}}/rows/{{row_uuid}}/receive'.format(url_prefix))
config.add_view(cls, attr='mobile_receive_row', route_name='mobile.{}.receive_row'.format(route_prefix),
permission='{}.edit_row'.format(permission_prefix))
if legacy_mobile:
config.add_route('mobile.{}.receive_row'.format(route_prefix), '/mobile{}/{{uuid}}/rows/{{row_uuid}}/receive'.format(url_prefix))
config.add_view(cls, attr='mobile_receive_row', route_name='mobile.{}.receive_row'.format(route_prefix),
permission='{}.edit_row'.format(permission_prefix))
# declare credit for row
config.add_route('{}.declare_credit'.format(route_prefix), '{}/{{uuid}}/rows/{{row_uuid}}/declare-credit'.format(url_prefix))