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

@ -1489,12 +1489,14 @@ class BatchMasterView(MasterView):
@classmethod
def _batch_defaults(cls, config):
rattail_config = config.registry.settings.get('rattail_config')
model_key = cls.get_model_key()
route_prefix = cls.get_route_prefix()
url_prefix = cls.get_url_prefix()
permission_prefix = cls.get_permission_prefix()
model_title = cls.get_model_title()
model_title_plural = cls.get_model_title_plural()
legacy_mobile = cls.legacy_mobile_enabled(rattail_config)
# TODO: currently must do this here (in addition to `_defaults()` or
# else the perm group label will not display correctly...
@ -1538,14 +1540,16 @@ class BatchMasterView(MasterView):
permission='{}.edit'.format(permission_prefix))
# mobile mark complete
config.add_route('mobile.{}.mark_complete'.format(route_prefix), '/mobile{}/{{{}}}/mark-complete'.format(url_prefix, model_key))
config.add_view(cls, attr='mobile_mark_complete', route_name='mobile.{}.mark_complete'.format(route_prefix),
permission='{}.edit'.format(permission_prefix))
if legacy_mobile:
config.add_route('mobile.{}.mark_complete'.format(route_prefix), '/mobile{}/{{{}}}/mark-complete'.format(url_prefix, model_key))
config.add_view(cls, attr='mobile_mark_complete', route_name='mobile.{}.mark_complete'.format(route_prefix),
permission='{}.edit'.format(permission_prefix))
# mobile mark pending
config.add_route('mobile.{}.mark_pending'.format(route_prefix), '/mobile{}/{{{}}}/mark-pending'.format(url_prefix, model_key))
config.add_view(cls, attr='mobile_mark_pending', route_name='mobile.{}.mark_pending'.format(route_prefix),
permission='{}.edit'.format(permission_prefix))
if legacy_mobile:
config.add_route('mobile.{}.mark_pending'.format(route_prefix), '/mobile{}/{{{}}}/mark-pending'.format(url_prefix, model_key))
config.add_view(cls, attr='mobile_mark_pending', route_name='mobile.{}.mark_pending'.format(route_prefix),
permission='{}.edit'.format(permission_prefix))
# refresh multiple batches (results)
if cls.results_refreshable:

View file

@ -634,6 +634,7 @@ class InventoryBatchView(BatchMasterView):
route_prefix = cls.get_route_prefix()
url_prefix = cls.get_url_prefix()
permission_prefix = cls.get_permission_prefix()
legacy_mobile = cls.legacy_mobile_enabled(rattail_config)
# we need batch handler to determine available permissions
factory = cls.get_handler_factory(rattail_config)
@ -655,9 +656,10 @@ class InventoryBatchView(BatchMasterView):
renderer='json', permission='{}.create_row'.format(permission_prefix))
# mobile - make new row from UPC
config.add_route('mobile.{}.row_from_upc'.format(route_prefix), '/mobile{}/{{{}}}/row-from-upc'.format(url_prefix, model_key))
config.add_view(cls, attr='mobile_row_from_upc', route_name='mobile.{}.row_from_upc'.format(route_prefix),
permission='{}.create_row'.format(permission_prefix))
if legacy_mobile:
config.add_route('mobile.{}.row_from_upc'.format(route_prefix), '/mobile{}/{{{}}}/row-from-upc'.format(url_prefix, model_key))
config.add_view(cls, attr='mobile_row_from_upc', route_name='mobile.{}.row_from_upc'.format(route_prefix),
permission='{}.create_row'.format(permission_prefix))
# TODO: this is a stopgap measure to fix an obvious bug, which exists when the