Let config totally disable the old/legacy jQuery mobile app
This commit is contained in:
parent
d2c4791611
commit
d9f6a7201e
|
@ -51,3 +51,8 @@ class ConfigExtension(BaseExtension):
|
||||||
# provide default theme selection
|
# provide default theme selection
|
||||||
config.setdefault('tailbone', 'themes', 'default, falafel')
|
config.setdefault('tailbone', 'themes', 'default, falafel')
|
||||||
config.setdefault('tailbone', 'themes.expose_picker', 'true')
|
config.setdefault('tailbone', 'themes.expose_picker', 'true')
|
||||||
|
|
||||||
|
|
||||||
|
def legacy_mobile_enabled(config):
|
||||||
|
return config.getbool('tailbone', 'legacy_mobile.enabled',
|
||||||
|
default=True)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2018 Lance Edgar
|
# Copyright © 2010-2020 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -206,6 +206,8 @@ class AuthenticationView(View):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def defaults(cls, config):
|
def defaults(cls, config):
|
||||||
|
rattail_config = config.registry.settings.get('rattail_config')
|
||||||
|
legacy_mobile = cls.legacy_mobile_enabled(rattail_config)
|
||||||
|
|
||||||
# forbidden
|
# forbidden
|
||||||
config.add_forbidden_view(cls, attr='forbidden')
|
config.add_forbidden_view(cls, attr='forbidden')
|
||||||
|
@ -213,14 +215,16 @@ class AuthenticationView(View):
|
||||||
# login
|
# login
|
||||||
config.add_route('login', '/login')
|
config.add_route('login', '/login')
|
||||||
config.add_view(cls, attr='login', route_name='login', renderer='/login.mako')
|
config.add_view(cls, attr='login', route_name='login', renderer='/login.mako')
|
||||||
config.add_route('mobile.login', '/mobile/login')
|
if legacy_mobile:
|
||||||
config.add_view(cls, attr='mobile_login', route_name='mobile.login', renderer='/mobile/login.mako')
|
config.add_route('mobile.login', '/mobile/login')
|
||||||
|
config.add_view(cls, attr='mobile_login', route_name='mobile.login', renderer='/mobile/login.mako')
|
||||||
|
|
||||||
# logout
|
# logout
|
||||||
config.add_route('logout', '/logout')
|
config.add_route('logout', '/logout')
|
||||||
config.add_view(cls, attr='logout', route_name='logout')
|
config.add_view(cls, attr='logout', route_name='logout')
|
||||||
config.add_route('mobile.logout', '/mobile/logout')
|
if legacy_mobile:
|
||||||
config.add_view(cls, attr='mobile_logout', route_name='mobile.logout')
|
config.add_route('mobile.logout', '/mobile/logout')
|
||||||
|
config.add_view(cls, attr='mobile_logout', route_name='mobile.logout')
|
||||||
|
|
||||||
# no-op
|
# no-op
|
||||||
config.add_route('noop', '/noop')
|
config.add_route('noop', '/noop')
|
||||||
|
|
|
@ -1489,12 +1489,14 @@ class BatchMasterView(MasterView):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _batch_defaults(cls, config):
|
def _batch_defaults(cls, config):
|
||||||
|
rattail_config = config.registry.settings.get('rattail_config')
|
||||||
model_key = cls.get_model_key()
|
model_key = cls.get_model_key()
|
||||||
route_prefix = cls.get_route_prefix()
|
route_prefix = cls.get_route_prefix()
|
||||||
url_prefix = cls.get_url_prefix()
|
url_prefix = cls.get_url_prefix()
|
||||||
permission_prefix = cls.get_permission_prefix()
|
permission_prefix = cls.get_permission_prefix()
|
||||||
model_title = cls.get_model_title()
|
model_title = cls.get_model_title()
|
||||||
model_title_plural = cls.get_model_title_plural()
|
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
|
# TODO: currently must do this here (in addition to `_defaults()` or
|
||||||
# else the perm group label will not display correctly...
|
# else the perm group label will not display correctly...
|
||||||
|
@ -1538,14 +1540,16 @@ class BatchMasterView(MasterView):
|
||||||
permission='{}.edit'.format(permission_prefix))
|
permission='{}.edit'.format(permission_prefix))
|
||||||
|
|
||||||
# mobile mark complete
|
# mobile mark complete
|
||||||
config.add_route('mobile.{}.mark_complete'.format(route_prefix), '/mobile{}/{{{}}}/mark-complete'.format(url_prefix, model_key))
|
if legacy_mobile:
|
||||||
config.add_view(cls, attr='mobile_mark_complete', route_name='mobile.{}.mark_complete'.format(route_prefix),
|
config.add_route('mobile.{}.mark_complete'.format(route_prefix), '/mobile{}/{{{}}}/mark-complete'.format(url_prefix, model_key))
|
||||||
permission='{}.edit'.format(permission_prefix))
|
config.add_view(cls, attr='mobile_mark_complete', route_name='mobile.{}.mark_complete'.format(route_prefix),
|
||||||
|
permission='{}.edit'.format(permission_prefix))
|
||||||
|
|
||||||
# mobile mark pending
|
# mobile mark pending
|
||||||
config.add_route('mobile.{}.mark_pending'.format(route_prefix), '/mobile{}/{{{}}}/mark-pending'.format(url_prefix, model_key))
|
if legacy_mobile:
|
||||||
config.add_view(cls, attr='mobile_mark_pending', route_name='mobile.{}.mark_pending'.format(route_prefix),
|
config.add_route('mobile.{}.mark_pending'.format(route_prefix), '/mobile{}/{{{}}}/mark-pending'.format(url_prefix, model_key))
|
||||||
permission='{}.edit'.format(permission_prefix))
|
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)
|
# refresh multiple batches (results)
|
||||||
if cls.results_refreshable:
|
if cls.results_refreshable:
|
||||||
|
|
|
@ -634,6 +634,7 @@ class InventoryBatchView(BatchMasterView):
|
||||||
route_prefix = cls.get_route_prefix()
|
route_prefix = cls.get_route_prefix()
|
||||||
url_prefix = cls.get_url_prefix()
|
url_prefix = cls.get_url_prefix()
|
||||||
permission_prefix = cls.get_permission_prefix()
|
permission_prefix = cls.get_permission_prefix()
|
||||||
|
legacy_mobile = cls.legacy_mobile_enabled(rattail_config)
|
||||||
|
|
||||||
# we need batch handler to determine available permissions
|
# we need batch handler to determine available permissions
|
||||||
factory = cls.get_handler_factory(rattail_config)
|
factory = cls.get_handler_factory(rattail_config)
|
||||||
|
@ -655,9 +656,10 @@ class InventoryBatchView(BatchMasterView):
|
||||||
renderer='json', permission='{}.create_row'.format(permission_prefix))
|
renderer='json', permission='{}.create_row'.format(permission_prefix))
|
||||||
|
|
||||||
# mobile - make new row from UPC
|
# 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))
|
if legacy_mobile:
|
||||||
config.add_view(cls, attr='mobile_row_from_upc', route_name='mobile.{}.row_from_upc'.format(route_prefix),
|
config.add_route('mobile.{}.row_from_upc'.format(route_prefix), '/mobile{}/{{{}}}/row-from-upc'.format(url_prefix, model_key))
|
||||||
permission='{}.create_row'.format(permission_prefix))
|
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
|
# TODO: this is a stopgap measure to fix an obvious bug, which exists when the
|
||||||
|
|
|
@ -189,6 +189,7 @@ class CommonView(View):
|
||||||
@classmethod
|
@classmethod
|
||||||
def _defaults(cls, config):
|
def _defaults(cls, config):
|
||||||
rattail_config = config.registry.settings.get('rattail_config')
|
rattail_config = config.registry.settings.get('rattail_config')
|
||||||
|
legacy_mobile = cls.legacy_mobile_enabled(rattail_config)
|
||||||
|
|
||||||
# auto-correct URLs which require trailing slash
|
# auto-correct URLs which require trailing slash
|
||||||
config.add_notfound_view(cls, attr='notfound', append_slash=True)
|
config.add_notfound_view(cls, attr='notfound', append_slash=True)
|
||||||
|
@ -203,8 +204,9 @@ class CommonView(View):
|
||||||
# home
|
# home
|
||||||
config.add_route('home', '/')
|
config.add_route('home', '/')
|
||||||
config.add_view(cls, attr='home', route_name='home', renderer='/home.mako')
|
config.add_view(cls, attr='home', route_name='home', renderer='/home.mako')
|
||||||
config.add_route('mobile.home', '/mobile/')
|
if legacy_mobile:
|
||||||
config.add_view(cls, attr='mobile_home', route_name='mobile.home', renderer='/mobile/home.mako')
|
config.add_route('mobile.home', '/mobile/')
|
||||||
|
config.add_view(cls, attr='mobile_home', route_name='mobile.home', renderer='/mobile/home.mako')
|
||||||
|
|
||||||
# robots.txt
|
# robots.txt
|
||||||
config.add_route('robots.txt', '/robots.txt')
|
config.add_route('robots.txt', '/robots.txt')
|
||||||
|
@ -213,8 +215,9 @@ class CommonView(View):
|
||||||
# about
|
# about
|
||||||
config.add_route('about', '/about')
|
config.add_route('about', '/about')
|
||||||
config.add_view(cls, attr='about', route_name='about', renderer='/about.mako')
|
config.add_view(cls, attr='about', route_name='about', renderer='/about.mako')
|
||||||
config.add_route('mobile.about', '/mobile/about')
|
if legacy_mobile:
|
||||||
config.add_view(cls, attr='about', route_name='mobile.about', renderer='/mobile/about.mako')
|
config.add_route('mobile.about', '/mobile/about')
|
||||||
|
config.add_view(cls, attr='about', route_name='mobile.about', renderer='/mobile/about.mako')
|
||||||
|
|
||||||
# change db engine
|
# change db engine
|
||||||
config.add_tailbone_permission('common', 'common.change_db_engine',
|
config.add_tailbone_permission('common', 'common.change_db_engine',
|
||||||
|
@ -234,9 +237,10 @@ class CommonView(View):
|
||||||
config.add_route('feedback', '/feedback', request_method='POST')
|
config.add_route('feedback', '/feedback', request_method='POST')
|
||||||
config.add_view(cls, attr='feedback', route_name='feedback',
|
config.add_view(cls, attr='feedback', route_name='feedback',
|
||||||
renderer='json', permission='common.feedback')
|
renderer='json', permission='common.feedback')
|
||||||
config.add_route('mobile.feedback', '/mobile/feedback', request_method='POST')
|
if legacy_mobile:
|
||||||
config.add_view(cls, attr='mobile_feedback', route_name='mobile.feedback',
|
config.add_route('mobile.feedback', '/mobile/feedback', request_method='POST')
|
||||||
renderer='json', permission='common.feedback')
|
config.add_view(cls, attr='mobile_feedback', route_name='mobile.feedback',
|
||||||
|
renderer='json', permission='common.feedback')
|
||||||
|
|
||||||
# consume batch ID
|
# consume batch ID
|
||||||
config.add_tailbone_permission('common', 'common.consume_batch_id',
|
config.add_tailbone_permission('common', 'common.consume_batch_id',
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2019 Lance Edgar
|
# Copyright © 2010-2020 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -41,6 +41,7 @@ from tailbone.db import Session
|
||||||
from tailbone.auth import logout_user
|
from tailbone.auth import logout_user
|
||||||
from tailbone.progress import SessionProgress
|
from tailbone.progress import SessionProgress
|
||||||
from tailbone.util import should_use_buefy
|
from tailbone.util import should_use_buefy
|
||||||
|
from tailbone.config import legacy_mobile_enabled
|
||||||
|
|
||||||
|
|
||||||
class View(object):
|
class View(object):
|
||||||
|
@ -88,6 +89,14 @@ class View(object):
|
||||||
"""
|
"""
|
||||||
return should_use_buefy(self.request)
|
return should_use_buefy(self.request)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def legacy_mobile_enabled(cls, rattail_config):
|
||||||
|
"""
|
||||||
|
Returns the boolean setting indicating whether the old / "legacy"
|
||||||
|
(jQuery) mobile app/site should be exposed.
|
||||||
|
"""
|
||||||
|
return legacy_mobile_enabled(rattail_config)
|
||||||
|
|
||||||
def late_login_user(self):
|
def late_login_user(self):
|
||||||
"""
|
"""
|
||||||
Returns the :class:`rattail:rattail.db.model.User` instance
|
Returns the :class:`rattail:rattail.db.model.User` instance
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2019 Lance Edgar
|
# Copyright © 2010-2020 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -94,6 +94,8 @@ class DataSyncChangesView(MasterView):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def defaults(cls, config):
|
def defaults(cls, config):
|
||||||
|
rattail_config = config.registry.settings.get('rattail_config')
|
||||||
|
legacy_mobile = cls.legacy_mobile_enabled(rattail_config)
|
||||||
|
|
||||||
# fix permission group title
|
# fix permission group title
|
||||||
config.add_tailbone_permission_group('datasync', label="DataSync")
|
config.add_tailbone_permission_group('datasync', label="DataSync")
|
||||||
|
@ -104,9 +106,10 @@ class DataSyncChangesView(MasterView):
|
||||||
config.add_route('datasync.restart', '/datasync/restart')
|
config.add_route('datasync.restart', '/datasync/restart')
|
||||||
config.add_view(cls, attr='restart', route_name='datasync.restart', permission='datasync.restart')
|
config.add_view(cls, attr='restart', route_name='datasync.restart', permission='datasync.restart')
|
||||||
# mobile
|
# mobile
|
||||||
config.add_route('datasync.mobile', '/mobile/datasync/')
|
if legacy_mobile:
|
||||||
config.add_view(cls, attr='mobile_index', route_name='datasync.mobile',
|
config.add_route('datasync.mobile', '/mobile/datasync/')
|
||||||
permission='datasync.restart', renderer='/mobile/datasync.mako')
|
config.add_view(cls, attr='mobile_index', route_name='datasync.mobile',
|
||||||
|
permission='datasync.restart', renderer='/mobile/datasync.mako')
|
||||||
|
|
||||||
cls._defaults(config)
|
cls._defaults(config)
|
||||||
|
|
||||||
|
|
|
@ -3593,6 +3593,7 @@ class MasterView(View):
|
||||||
model_title_plural = cls.get_model_title_plural()
|
model_title_plural = cls.get_model_title_plural()
|
||||||
if cls.has_rows:
|
if cls.has_rows:
|
||||||
row_model_title = cls.get_row_model_title()
|
row_model_title = cls.get_row_model_title()
|
||||||
|
legacy_mobile = cls.legacy_mobile_enabled(rattail_config)
|
||||||
|
|
||||||
config.add_tailbone_permission_group(permission_prefix, model_title_plural, overwrite=False)
|
config.add_tailbone_permission_group(permission_prefix, model_title_plural, overwrite=False)
|
||||||
|
|
||||||
|
@ -3603,7 +3604,7 @@ class MasterView(View):
|
||||||
config.add_route(route_prefix, '{}/'.format(url_prefix))
|
config.add_route(route_prefix, '{}/'.format(url_prefix))
|
||||||
config.add_view(cls, attr='index', route_name=route_prefix,
|
config.add_view(cls, attr='index', route_name=route_prefix,
|
||||||
permission='{}.list'.format(permission_prefix))
|
permission='{}.list'.format(permission_prefix))
|
||||||
if cls.supports_mobile:
|
if legacy_mobile and cls.supports_mobile:
|
||||||
config.add_route('mobile.{}'.format(route_prefix), '/mobile{}/'.format(url_prefix))
|
config.add_route('mobile.{}'.format(route_prefix), '/mobile{}/'.format(url_prefix))
|
||||||
config.add_view(cls, attr='mobile_index', route_name='mobile.{}'.format(route_prefix),
|
config.add_view(cls, attr='mobile_index', route_name='mobile.{}'.format(route_prefix),
|
||||||
permission='{}.list'.format(permission_prefix))
|
permission='{}.list'.format(permission_prefix))
|
||||||
|
@ -3632,14 +3633,14 @@ class MasterView(View):
|
||||||
permission='{}.quickie'.format(permission_prefix))
|
permission='{}.quickie'.format(permission_prefix))
|
||||||
|
|
||||||
# create
|
# create
|
||||||
if cls.creatable or cls.mobile_creatable:
|
if cls.creatable or (legacy_mobile and cls.mobile_creatable):
|
||||||
config.add_tailbone_permission(permission_prefix, '{}.create'.format(permission_prefix),
|
config.add_tailbone_permission(permission_prefix, '{}.create'.format(permission_prefix),
|
||||||
"Create new {}".format(model_title))
|
"Create new {}".format(model_title))
|
||||||
if cls.creatable:
|
if cls.creatable:
|
||||||
config.add_route('{}.create'.format(route_prefix), '{}/new'.format(url_prefix))
|
config.add_route('{}.create'.format(route_prefix), '{}/new'.format(url_prefix))
|
||||||
config.add_view(cls, attr='create', route_name='{}.create'.format(route_prefix),
|
config.add_view(cls, attr='create', route_name='{}.create'.format(route_prefix),
|
||||||
permission='{}.create'.format(permission_prefix))
|
permission='{}.create'.format(permission_prefix))
|
||||||
if cls.mobile_creatable:
|
if legacy_mobile and cls.mobile_creatable:
|
||||||
config.add_route('mobile.{}.create'.format(route_prefix), '/mobile{}/new'.format(url_prefix))
|
config.add_route('mobile.{}.create'.format(route_prefix), '/mobile{}/new'.format(url_prefix))
|
||||||
config.add_view(cls, attr='mobile_create', route_name='mobile.{}.create'.format(route_prefix),
|
config.add_view(cls, attr='mobile_create', route_name='mobile.{}.create'.format(route_prefix),
|
||||||
permission='{}.create'.format(permission_prefix))
|
permission='{}.create'.format(permission_prefix))
|
||||||
|
@ -3709,7 +3710,7 @@ class MasterView(View):
|
||||||
config.add_route('{}.view'.format(route_prefix), instance_url_prefix)
|
config.add_route('{}.view'.format(route_prefix), instance_url_prefix)
|
||||||
config.add_view(cls, attr='view', route_name='{}.view'.format(route_prefix),
|
config.add_view(cls, attr='view', route_name='{}.view'.format(route_prefix),
|
||||||
permission='{}.view'.format(permission_prefix))
|
permission='{}.view'.format(permission_prefix))
|
||||||
if cls.supports_mobile:
|
if legacy_mobile and cls.supports_mobile:
|
||||||
config.add_route('mobile.{}.view'.format(route_prefix), '/mobile{}'.format(instance_url_prefix))
|
config.add_route('mobile.{}.view'.format(route_prefix), '/mobile{}'.format(instance_url_prefix))
|
||||||
config.add_view(cls, attr='mobile_view', route_name='mobile.{}.view'.format(route_prefix),
|
config.add_view(cls, attr='mobile_view', route_name='mobile.{}.view'.format(route_prefix),
|
||||||
permission='{}.view'.format(permission_prefix))
|
permission='{}.view'.format(permission_prefix))
|
||||||
|
@ -3762,27 +3763,27 @@ class MasterView(View):
|
||||||
"Download associated data for {}".format(model_title))
|
"Download associated data for {}".format(model_title))
|
||||||
|
|
||||||
# edit
|
# edit
|
||||||
if cls.editable or cls.mobile_editable:
|
if cls.editable or (legacy_mobile and cls.mobile_editable):
|
||||||
config.add_tailbone_permission(permission_prefix, '{}.edit'.format(permission_prefix),
|
config.add_tailbone_permission(permission_prefix, '{}.edit'.format(permission_prefix),
|
||||||
"Edit {}".format(model_title))
|
"Edit {}".format(model_title))
|
||||||
if cls.editable:
|
if cls.editable:
|
||||||
config.add_route('{}.edit'.format(route_prefix), '{}/edit'.format(instance_url_prefix))
|
config.add_route('{}.edit'.format(route_prefix), '{}/edit'.format(instance_url_prefix))
|
||||||
config.add_view(cls, attr='edit', route_name='{}.edit'.format(route_prefix),
|
config.add_view(cls, attr='edit', route_name='{}.edit'.format(route_prefix),
|
||||||
permission='{}.edit'.format(permission_prefix))
|
permission='{}.edit'.format(permission_prefix))
|
||||||
if cls.mobile_editable:
|
if legacy_mobile and cls.mobile_editable:
|
||||||
config.add_route('mobile.{}.edit'.format(route_prefix), '/mobile{}/edit'.format(instance_url_prefix))
|
config.add_route('mobile.{}.edit'.format(route_prefix), '/mobile{}/edit'.format(instance_url_prefix))
|
||||||
config.add_view(cls, attr='mobile_edit', route_name='mobile.{}.edit'.format(route_prefix),
|
config.add_view(cls, attr='mobile_edit', route_name='mobile.{}.edit'.format(route_prefix),
|
||||||
permission='{}.edit'.format(permission_prefix))
|
permission='{}.edit'.format(permission_prefix))
|
||||||
|
|
||||||
# execute
|
# execute
|
||||||
if cls.executable or cls.mobile_executable:
|
if cls.executable or (legacy_mobile and cls.mobile_executable):
|
||||||
config.add_tailbone_permission(permission_prefix, '{}.execute'.format(permission_prefix),
|
config.add_tailbone_permission(permission_prefix, '{}.execute'.format(permission_prefix),
|
||||||
"Execute {}".format(model_title))
|
"Execute {}".format(model_title))
|
||||||
if cls.executable:
|
if cls.executable:
|
||||||
config.add_route('{}.execute'.format(route_prefix), '{}/execute'.format(instance_url_prefix))
|
config.add_route('{}.execute'.format(route_prefix), '{}/execute'.format(instance_url_prefix))
|
||||||
config.add_view(cls, attr='execute', route_name='{}.execute'.format(route_prefix),
|
config.add_view(cls, attr='execute', route_name='{}.execute'.format(route_prefix),
|
||||||
permission='{}.execute'.format(permission_prefix))
|
permission='{}.execute'.format(permission_prefix))
|
||||||
if cls.mobile_executable:
|
if legacy_mobile and cls.mobile_executable:
|
||||||
config.add_route('mobile.{}.execute'.format(route_prefix), '/mobile{}/execute'.format(instance_url_prefix))
|
config.add_route('mobile.{}.execute'.format(route_prefix), '/mobile{}/execute'.format(instance_url_prefix))
|
||||||
config.add_view(cls, attr='mobile_execute', route_name='mobile.{}.execute'.format(route_prefix),
|
config.add_view(cls, attr='mobile_execute', route_name='mobile.{}.execute'.format(route_prefix),
|
||||||
permission='{}.execute'.format(permission_prefix))
|
permission='{}.execute'.format(permission_prefix))
|
||||||
|
@ -3820,14 +3821,14 @@ class MasterView(View):
|
||||||
|
|
||||||
# create row
|
# create row
|
||||||
if cls.has_rows:
|
if cls.has_rows:
|
||||||
if cls.rows_creatable or cls.mobile_rows_creatable:
|
if cls.rows_creatable or (legacy_mobile and cls.mobile_rows_creatable):
|
||||||
config.add_tailbone_permission(permission_prefix, '{}.create_row'.format(permission_prefix),
|
config.add_tailbone_permission(permission_prefix, '{}.create_row'.format(permission_prefix),
|
||||||
"Create new {} rows".format(model_title))
|
"Create new {} rows".format(model_title))
|
||||||
if cls.rows_creatable:
|
if cls.rows_creatable:
|
||||||
config.add_route('{}.create_row'.format(route_prefix), '{}/new-row'.format(instance_url_prefix))
|
config.add_route('{}.create_row'.format(route_prefix), '{}/new-row'.format(instance_url_prefix))
|
||||||
config.add_view(cls, attr='create_row', route_name='{}.create_row'.format(route_prefix),
|
config.add_view(cls, attr='create_row', route_name='{}.create_row'.format(route_prefix),
|
||||||
permission='{}.create_row'.format(permission_prefix))
|
permission='{}.create_row'.format(permission_prefix))
|
||||||
if cls.mobile_rows_creatable:
|
if legacy_mobile and cls.mobile_rows_creatable:
|
||||||
config.add_route('mobile.{}.create_row'.format(route_prefix), '/mobile{}/new-row'.format(instance_url_prefix))
|
config.add_route('mobile.{}.create_row'.format(route_prefix), '/mobile{}/new-row'.format(instance_url_prefix))
|
||||||
config.add_view(cls, attr='mobile_create_row', route_name='mobile.{}.create_row'.format(route_prefix),
|
config.add_view(cls, attr='mobile_create_row', route_name='mobile.{}.create_row'.format(route_prefix),
|
||||||
permission='{}.create_row'.format(permission_prefix))
|
permission='{}.create_row'.format(permission_prefix))
|
||||||
|
@ -3842,35 +3843,35 @@ class MasterView(View):
|
||||||
config.add_route('{}.view_row'.format(route_prefix), '{}/{{uuid}}/rows/{{row_uuid}}'.format(url_prefix))
|
config.add_route('{}.view_row'.format(route_prefix), '{}/{{uuid}}/rows/{{row_uuid}}'.format(url_prefix))
|
||||||
config.add_view(cls, attr='view_row', route_name='{}.view_row'.format(route_prefix),
|
config.add_view(cls, attr='view_row', route_name='{}.view_row'.format(route_prefix),
|
||||||
permission='{}.view'.format(permission_prefix))
|
permission='{}.view'.format(permission_prefix))
|
||||||
if cls.mobile_rows_viewable:
|
if legacy_mobile and cls.mobile_rows_viewable:
|
||||||
config.add_route('mobile.{}.view_row'.format(route_prefix), '/mobile{}/{{uuid}}/rows/{{row_uuid}}'.format(url_prefix))
|
config.add_route('mobile.{}.view_row'.format(route_prefix), '/mobile{}/{{uuid}}/rows/{{row_uuid}}'.format(url_prefix))
|
||||||
config.add_view(cls, attr='mobile_view_row', route_name='mobile.{}.view_row'.format(route_prefix),
|
config.add_view(cls, attr='mobile_view_row', route_name='mobile.{}.view_row'.format(route_prefix),
|
||||||
permission='{}.view'.format(permission_prefix))
|
permission='{}.view'.format(permission_prefix))
|
||||||
|
|
||||||
# edit row
|
# edit row
|
||||||
if cls.has_rows:
|
if cls.has_rows:
|
||||||
if cls.rows_editable or cls.mobile_rows_editable:
|
if cls.rows_editable or (legacy_mobile and cls.mobile_rows_editable):
|
||||||
config.add_tailbone_permission(permission_prefix, '{}.edit_row'.format(permission_prefix),
|
config.add_tailbone_permission(permission_prefix, '{}.edit_row'.format(permission_prefix),
|
||||||
"Edit individual {} rows".format(model_title))
|
"Edit individual {} rows".format(model_title))
|
||||||
if cls.rows_editable:
|
if cls.rows_editable:
|
||||||
config.add_route('{}.edit_row'.format(route_prefix), '{}/{{uuid}}/rows/{{row_uuid}}/edit'.format(url_prefix))
|
config.add_route('{}.edit_row'.format(route_prefix), '{}/{{uuid}}/rows/{{row_uuid}}/edit'.format(url_prefix))
|
||||||
config.add_view(cls, attr='edit_row', route_name='{}.edit_row'.format(route_prefix),
|
config.add_view(cls, attr='edit_row', route_name='{}.edit_row'.format(route_prefix),
|
||||||
permission='{}.edit_row'.format(permission_prefix))
|
permission='{}.edit_row'.format(permission_prefix))
|
||||||
if cls.mobile_rows_editable:
|
if legacy_mobile and cls.mobile_rows_editable:
|
||||||
config.add_route('mobile.{}.edit_row'.format(route_prefix), '/mobile{}/{{uuid}}/rows/{{row_uuid}}/edit'.format(url_prefix))
|
config.add_route('mobile.{}.edit_row'.format(route_prefix), '/mobile{}/{{uuid}}/rows/{{row_uuid}}/edit'.format(url_prefix))
|
||||||
config.add_view(cls, attr='mobile_edit_row', route_name='mobile.{}.edit_row'.format(route_prefix),
|
config.add_view(cls, attr='mobile_edit_row', route_name='mobile.{}.edit_row'.format(route_prefix),
|
||||||
permission='{}.edit_row'.format(permission_prefix))
|
permission='{}.edit_row'.format(permission_prefix))
|
||||||
|
|
||||||
# delete row
|
# delete row
|
||||||
if cls.has_rows:
|
if cls.has_rows:
|
||||||
if cls.rows_deletable or cls.mobile_rows_deletable:
|
if cls.rows_deletable or (legacy_mobile and cls.mobile_rows_deletable):
|
||||||
config.add_tailbone_permission(permission_prefix, '{}.delete_row'.format(permission_prefix),
|
config.add_tailbone_permission(permission_prefix, '{}.delete_row'.format(permission_prefix),
|
||||||
"Delete individual {} rows".format(model_title))
|
"Delete individual {} rows".format(model_title))
|
||||||
if cls.rows_deletable:
|
if cls.rows_deletable:
|
||||||
config.add_route('{}.delete_row'.format(route_prefix), '{}/{{uuid}}/rows/{{row_uuid}}/delete'.format(url_prefix))
|
config.add_route('{}.delete_row'.format(route_prefix), '{}/{{uuid}}/rows/{{row_uuid}}/delete'.format(url_prefix))
|
||||||
config.add_view(cls, attr='delete_row', route_name='{}.delete_row'.format(route_prefix),
|
config.add_view(cls, attr='delete_row', route_name='{}.delete_row'.format(route_prefix),
|
||||||
permission='{}.delete_row'.format(permission_prefix))
|
permission='{}.delete_row'.format(permission_prefix))
|
||||||
if cls.mobile_rows_deletable:
|
if legacy_mobile and cls.mobile_rows_deletable:
|
||||||
config.add_route('mobile.{}.delete_row'.format(route_prefix), '/mobile{}/{{uuid}}/rows/{{row_uuid}}/delete'.format(url_prefix))
|
config.add_route('mobile.{}.delete_row'.format(route_prefix), '/mobile{}/{{uuid}}/rows/{{row_uuid}}/delete'.format(url_prefix))
|
||||||
config.add_view(cls, attr='mobile_delete_row', route_name='mobile.{}.delete_row'.format(route_prefix),
|
config.add_view(cls, attr='mobile_delete_row', route_name='mobile.{}.delete_row'.format(route_prefix),
|
||||||
permission='{}.delete_row'.format(permission_prefix))
|
permission='{}.delete_row'.format(permission_prefix))
|
||||||
|
|
|
@ -1651,11 +1651,13 @@ class ProductsView(MasterView):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _product_defaults(cls, config):
|
def _product_defaults(cls, config):
|
||||||
|
rattail_config = config.registry.settings.get('rattail_config')
|
||||||
route_prefix = cls.get_route_prefix()
|
route_prefix = cls.get_route_prefix()
|
||||||
url_prefix = cls.get_url_prefix()
|
url_prefix = cls.get_url_prefix()
|
||||||
template_prefix = cls.get_template_prefix()
|
template_prefix = cls.get_template_prefix()
|
||||||
permission_prefix = cls.get_permission_prefix()
|
permission_prefix = cls.get_permission_prefix()
|
||||||
model_title = cls.get_model_title()
|
model_title = cls.get_model_title()
|
||||||
|
legacy_mobile = cls.legacy_mobile_enabled(rattail_config)
|
||||||
|
|
||||||
# print labels
|
# print labels
|
||||||
config.add_tailbone_permission('products', 'products.print_labels',
|
config.add_tailbone_permission('products', 'products.print_labels',
|
||||||
|
@ -1683,8 +1685,9 @@ class ProductsView(MasterView):
|
||||||
config.add_view(cls, attr='image', route_name='products.image')
|
config.add_view(cls, attr='image', route_name='products.image')
|
||||||
|
|
||||||
# mobile quick lookup
|
# mobile quick lookup
|
||||||
config.add_route('mobile.products.quick_lookup', '/mobile/products/quick-lookup')
|
if legacy_mobile:
|
||||||
config.add_view(cls, attr='mobile_quick_lookup', route_name='mobile.products.quick_lookup')
|
config.add_route('mobile.products.quick_lookup', '/mobile/products/quick-lookup')
|
||||||
|
config.add_view(cls, attr='mobile_quick_lookup', route_name='mobile.products.quick_lookup')
|
||||||
|
|
||||||
|
|
||||||
class ProductsAutocomplete(AutocompleteView):
|
class ProductsAutocomplete(AutocompleteView):
|
||||||
|
|
|
@ -975,11 +975,13 @@ class PurchasingBatchView(BatchMasterView):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _purchasing_defaults(cls, config):
|
def _purchasing_defaults(cls, config):
|
||||||
|
rattail_config = config.registry.settings.get('rattail_config')
|
||||||
route_prefix = cls.get_route_prefix()
|
route_prefix = cls.get_route_prefix()
|
||||||
url_prefix = cls.get_url_prefix()
|
url_prefix = cls.get_url_prefix()
|
||||||
permission_prefix = cls.get_permission_prefix()
|
permission_prefix = cls.get_permission_prefix()
|
||||||
model_key = cls.get_model_key()
|
model_key = cls.get_model_key()
|
||||||
model_title = cls.get_model_title()
|
model_title = cls.get_model_title()
|
||||||
|
legacy_mobile = cls.legacy_mobile_enabled(rattail_config)
|
||||||
|
|
||||||
# eligible purchases (AJAX)
|
# eligible purchases (AJAX)
|
||||||
config.add_route('{}.eligible_purchases'.format(route_prefix), '{}/eligible-purchases'.format(url_prefix))
|
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))
|
renderer='json', permission='{}.view'.format(permission_prefix))
|
||||||
|
|
||||||
# add new product
|
# 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),
|
config.add_tailbone_permission(permission_prefix, '{}.new_product'.format(permission_prefix),
|
||||||
"Create new Product when adding row to {}".format(model_title))
|
"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))
|
config.add_route('mobile.{}.new_product'.format(route_prefix), '{}/{{{}}}/new-product'.format(url_prefix, model_key))
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2019 Lance Edgar
|
# Copyright © 2010-2020 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -1804,14 +1804,16 @@ class ReceivingBatchView(PurchasingBatchView):
|
||||||
instance_url_prefix = cls.get_instance_url_prefix()
|
instance_url_prefix = cls.get_instance_url_prefix()
|
||||||
model_key = cls.get_model_key()
|
model_key = cls.get_model_key()
|
||||||
permission_prefix = cls.get_permission_prefix()
|
permission_prefix = cls.get_permission_prefix()
|
||||||
|
legacy_mobile = cls.legacy_mobile_enabled(rattail_config)
|
||||||
|
|
||||||
# row-level receiving
|
# row-level receiving
|
||||||
config.add_route('{}.receive_row'.format(route_prefix), '{}/{{uuid}}/rows/{{row_uuid}}/receive'.format(url_prefix))
|
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),
|
config.add_view(cls, attr='receive_row', route_name='{}.receive_row'.format(route_prefix),
|
||||||
permission='{}.edit_row'.format(permission_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))
|
if legacy_mobile:
|
||||||
config.add_view(cls, attr='mobile_receive_row', route_name='mobile.{}.receive_row'.format(route_prefix),
|
config.add_route('mobile.{}.receive_row'.format(route_prefix), '/mobile{}/{{uuid}}/rows/{{row_uuid}}/receive'.format(url_prefix))
|
||||||
permission='{}.edit_row'.format(permission_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
|
# declare credit for row
|
||||||
config.add_route('{}.declare_credit'.format(route_prefix), '{}/{{uuid}}/rows/{{row_uuid}}/declare-credit'.format(url_prefix))
|
config.add_route('{}.declare_credit'.format(route_prefix), '{}/{{uuid}}/rows/{{row_uuid}}/declare-credit'.format(url_prefix))
|
||||||
|
|
Loading…
Reference in a new issue