Some more tweaks to remove "buefy" references
mostly just docstring / comments but there were some code changes too
This commit is contained in:
parent
ba521abf4f
commit
d4089fbc6e
|
@ -1335,7 +1335,7 @@ class Grid(object):
|
||||||
|
|
||||||
def render_complete(self, template='/grids/complete.mako', **kwargs):
|
def render_complete(self, template='/grids/complete.mako', **kwargs):
|
||||||
"""
|
"""
|
||||||
Render the Buefy grid, complete with filters. Note that this also
|
Render the grid, complete with filters. Note that this also
|
||||||
includes the context menu items and grid tools.
|
includes the context menu items and grid tools.
|
||||||
"""
|
"""
|
||||||
if 'grid_columns' not in kwargs:
|
if 'grid_columns' not in kwargs:
|
||||||
|
@ -1437,7 +1437,7 @@ class Grid(object):
|
||||||
|
|
||||||
def get_filters_data(self):
|
def get_filters_data(self):
|
||||||
"""
|
"""
|
||||||
Returns a dict of current filters data, for use with Buefy grid view.
|
Returns a dict of current filters data, for use with index view.
|
||||||
"""
|
"""
|
||||||
data = {}
|
data = {}
|
||||||
for filtr in self.filters.values():
|
for filtr in self.filters.values():
|
||||||
|
@ -1703,7 +1703,7 @@ class Grid(object):
|
||||||
def set_action_urls(self, row, rowobj, i):
|
def set_action_urls(self, row, rowobj, i):
|
||||||
"""
|
"""
|
||||||
Pre-generate all action URLs for the given data row. Meant for use
|
Pre-generate all action URLs for the given data row. Meant for use
|
||||||
with Buefy table, since we can't generate URLs from JS.
|
with client-side table, since we can't generate URLs from JS.
|
||||||
"""
|
"""
|
||||||
for action in (self.main_actions + self.more_actions):
|
for action in (self.main_actions + self.more_actions):
|
||||||
url = action.get_url(rowobj, i)
|
url = action.get_url(rowobj, i)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2023 Lance Edgar
|
# Copyright © 2010-2024 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -178,9 +178,6 @@ def before_render(event):
|
||||||
renderer_globals['background_color'] = request.rattail_config.get(
|
renderer_globals['background_color'] = request.rattail_config.get(
|
||||||
'tailbone', 'background_color')
|
'tailbone', 'background_color')
|
||||||
|
|
||||||
# TODO: remove this hack once nothing references it
|
|
||||||
renderer_globals['buefy_0_8'] = False
|
|
||||||
|
|
||||||
# maybe set custom stylesheet
|
# maybe set custom stylesheet
|
||||||
css = None
|
css = None
|
||||||
if request.user:
|
if request.user:
|
||||||
|
|
|
@ -171,9 +171,6 @@
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:row-class="getRowClass"
|
:row-class="getRowClass"
|
||||||
|
|
||||||
## TODO: this should be more configurable, maybe auto-detect based
|
|
||||||
## on buefy version?? probably cannot do that, but this feature
|
|
||||||
## is only supported with buefy 0.8.13 and newer
|
|
||||||
% if request.rattail_config.getbool('tailbone', 'sticky_headers'):
|
% if request.rattail_config.getbool('tailbone', 'sticky_headers'):
|
||||||
sticky-header
|
sticky-header
|
||||||
height="600px"
|
height="600px"
|
||||||
|
|
|
@ -202,7 +202,7 @@ class BatchMasterView(MasterView):
|
||||||
action_url=action_url,
|
action_url=action_url,
|
||||||
component='upload-worksheet-form')
|
component='upload-worksheet-form')
|
||||||
form.set_type('worksheet_file', 'file')
|
form.set_type('worksheet_file', 'file')
|
||||||
# TODO: must set these to avoid some default Buefy code
|
# TODO: must set these to avoid some default code
|
||||||
form.auto_disable = False
|
form.auto_disable = False
|
||||||
form.auto_disable_save = False
|
form.auto_disable_save = False
|
||||||
return form
|
return form
|
||||||
|
|
|
@ -145,9 +145,7 @@ class ImporterBatchView(BatchMasterView):
|
||||||
make_filter('object_key')
|
make_filter('object_key')
|
||||||
make_filter('object_str')
|
make_filter('object_str')
|
||||||
|
|
||||||
# for some reason we have to do this differently for Buefy?
|
make_filter('status_code', label="Status")
|
||||||
kwargs = {}
|
|
||||||
make_filter('status_code', label="Status", **kwargs)
|
|
||||||
g.filters['status_code'].set_choices(self.enum.IMPORTER_BATCH_ROW_STATUS)
|
g.filters['status_code'].set_choices(self.enum.IMPORTER_BATCH_ROW_STATUS)
|
||||||
|
|
||||||
def make_sorter(field):
|
def make_sorter(field):
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2023 Lance Edgar
|
# Copyright © 2010-2024 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -37,14 +37,14 @@ from tailbone import grids
|
||||||
from tailbone.db import Session
|
from tailbone.db import Session
|
||||||
from tailbone.views import MasterView
|
from tailbone.views import MasterView
|
||||||
|
|
||||||
from rattail.db import model
|
from rattail.db.model import Customer, CustomerShopper, PendingCustomer
|
||||||
|
|
||||||
|
|
||||||
class CustomerView(MasterView):
|
class CustomerView(MasterView):
|
||||||
"""
|
"""
|
||||||
Master view for the Customer class.
|
Master view for the Customer class.
|
||||||
"""
|
"""
|
||||||
model_class = model.Customer
|
model_class = Customer
|
||||||
is_contact = True
|
is_contact = True
|
||||||
has_versions = True
|
has_versions = True
|
||||||
results_downloadable = True
|
results_downloadable = True
|
||||||
|
@ -251,6 +251,7 @@ class CustomerView(MasterView):
|
||||||
if instance:
|
if instance:
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
|
model = self.model
|
||||||
key = self.request.matchdict['uuid']
|
key = self.request.matchdict['uuid']
|
||||||
|
|
||||||
# search by Customer.id
|
# search by Customer.id
|
||||||
|
@ -270,7 +271,7 @@ class CustomerView(MasterView):
|
||||||
if instance:
|
if instance:
|
||||||
return instance.customer
|
return instance.customer
|
||||||
|
|
||||||
raise HTTPNotFound
|
raise self.notfound()
|
||||||
|
|
||||||
def configure_form(self, f):
|
def configure_form(self, f):
|
||||||
super().configure_form(f)
|
super().configure_form(f)
|
||||||
|
@ -436,6 +437,7 @@ class CustomerView(MasterView):
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
def unique_id(self, node, value):
|
def unique_id(self, node, value):
|
||||||
|
model = self.model
|
||||||
query = self.Session.query(model.Customer)\
|
query = self.Session.query(model.Customer)\
|
||||||
.filter(model.Customer.id == value)
|
.filter(model.Customer.id == value)
|
||||||
if self.editing:
|
if self.editing:
|
||||||
|
@ -545,6 +547,7 @@ class CustomerView(MasterView):
|
||||||
|
|
||||||
def get_version_child_classes(self):
|
def get_version_child_classes(self):
|
||||||
classes = super().get_version_child_classes()
|
classes = super().get_version_child_classes()
|
||||||
|
model = self.model
|
||||||
classes.extend([
|
classes.extend([
|
||||||
(model.CustomerGroupAssignment, 'customer_uuid'),
|
(model.CustomerGroupAssignment, 'customer_uuid'),
|
||||||
(model.CustomerPhoneNumber, 'parent_uuid'),
|
(model.CustomerPhoneNumber, 'parent_uuid'),
|
||||||
|
@ -556,6 +559,7 @@ class CustomerView(MasterView):
|
||||||
return classes
|
return classes
|
||||||
|
|
||||||
def detach_person(self):
|
def detach_person(self):
|
||||||
|
model = self.model
|
||||||
customer = self.get_instance()
|
customer = self.get_instance()
|
||||||
person = self.Session.get(model.Person, self.request.matchdict['person_uuid'])
|
person = self.Session.get(model.Person, self.request.matchdict['person_uuid'])
|
||||||
if not person:
|
if not person:
|
||||||
|
@ -651,9 +655,7 @@ class CustomerView(MasterView):
|
||||||
config.add_tailbone_permission(permission_prefix,
|
config.add_tailbone_permission(permission_prefix,
|
||||||
'{}.detach_person'.format(permission_prefix),
|
'{}.detach_person'.format(permission_prefix),
|
||||||
"Detach a Person from a {}".format(model_title))
|
"Detach a Person from a {}".format(model_title))
|
||||||
# TODO: this should require POST, but we'll add that once
|
# TODO: this should require POST!
|
||||||
# we can assume a Buefy theme is present, to avoid having
|
|
||||||
# to implement the logic in old jquery...
|
|
||||||
config.add_route('{}.detach_person'.format(route_prefix),
|
config.add_route('{}.detach_person'.format(route_prefix),
|
||||||
'{}/detach-person/{{person_uuid}}'.format(instance_url_prefix),
|
'{}/detach-person/{{person_uuid}}'.format(instance_url_prefix),
|
||||||
# request_method='POST',
|
# request_method='POST',
|
||||||
|
@ -667,7 +669,7 @@ class CustomerShopperView(MasterView):
|
||||||
"""
|
"""
|
||||||
Master view for the CustomerShopper class.
|
Master view for the CustomerShopper class.
|
||||||
"""
|
"""
|
||||||
model_class = model.CustomerShopper
|
model_class = CustomerShopper
|
||||||
route_prefix = 'customer_shoppers'
|
route_prefix = 'customer_shoppers'
|
||||||
url_prefix = '/customer-shoppers'
|
url_prefix = '/customer-shoppers'
|
||||||
|
|
||||||
|
@ -748,7 +750,7 @@ class PendingCustomerView(MasterView):
|
||||||
"""
|
"""
|
||||||
Master view for the Pending Customer class.
|
Master view for the Pending Customer class.
|
||||||
"""
|
"""
|
||||||
model_class = model.PendingCustomer
|
model_class = PendingCustomer
|
||||||
route_prefix = 'pending_customers'
|
route_prefix = 'pending_customers'
|
||||||
url_prefix = '/customers/pending'
|
url_prefix = '/customers/pending'
|
||||||
|
|
||||||
|
@ -877,7 +879,7 @@ class PendingCustomerView(MasterView):
|
||||||
# TODO: this only works when creating, need to add edit support?
|
# TODO: this only works when creating, need to add edit support?
|
||||||
# TODO: can this just go away? since we have unique_id() view method above
|
# TODO: can this just go away? since we have unique_id() view method above
|
||||||
def unique_id(node, value):
|
def unique_id(node, value):
|
||||||
customers = Session.query(model.Customer).filter(model.Customer.id == value)
|
customers = Session.query(Customer).filter(Customer.id == value)
|
||||||
if customers.count():
|
if customers.count():
|
||||||
raise colander.Invalid(node, "Customer ID must be unique")
|
raise colander.Invalid(node, "Customer ID must be unique")
|
||||||
|
|
||||||
|
@ -886,6 +888,8 @@ def customer_info(request):
|
||||||
"""
|
"""
|
||||||
View which returns simple dictionary of info for a particular customer.
|
View which returns simple dictionary of info for a particular customer.
|
||||||
"""
|
"""
|
||||||
|
app = request.rattail_config.get_app()
|
||||||
|
model = app.model
|
||||||
uuid = request.params.get('uuid')
|
uuid = request.params.get('uuid')
|
||||||
customer = Session.get(model.Customer, uuid) if uuid else None
|
customer = Session.get(model.Customer, uuid) if uuid else None
|
||||||
if not customer:
|
if not customer:
|
||||||
|
|
|
@ -516,7 +516,7 @@ class SentView(MessageView):
|
||||||
|
|
||||||
class RecipientsWidgetBuefy(dfwidget.Widget):
|
class RecipientsWidgetBuefy(dfwidget.Widget):
|
||||||
"""
|
"""
|
||||||
Custom "message recipients" widget, for use with Buefy / Vue.js themes.
|
Custom "message recipients" widget, for use with Vue.js themes.
|
||||||
"""
|
"""
|
||||||
template = 'message_recipients'
|
template = 'message_recipients'
|
||||||
|
|
||||||
|
|
|
@ -1404,7 +1404,7 @@ class PersonView(MasterView):
|
||||||
"""
|
"""
|
||||||
View which locates and organizes all relevant "transaction"
|
View which locates and organizes all relevant "transaction"
|
||||||
(version) history data for a given Person. Returns JSON, for
|
(version) history data for a given Person. Returns JSON, for
|
||||||
use with the Buefy table element on the full profile view.
|
use with the table element on the full profile view.
|
||||||
"""
|
"""
|
||||||
person = self.get_instance()
|
person = self.get_instance()
|
||||||
versions = self.profile_revisions_collect(person)
|
versions = self.profile_revisions_collect(person)
|
||||||
|
|
|
@ -1800,8 +1800,8 @@ class ProductView(MasterView):
|
||||||
def search(self):
|
def search(self):
|
||||||
"""
|
"""
|
||||||
Perform a product search across multiple fields, and return
|
Perform a product search across multiple fields, and return
|
||||||
the results as JSON suitable for row data for a Buefy
|
the results as JSON suitable for row data for a table
|
||||||
``<b-table>`` component.
|
component.
|
||||||
"""
|
"""
|
||||||
if 'term' not in self.request.GET:
|
if 'term' not in self.request.GET:
|
||||||
# TODO: deprecate / remove this? not sure if/where it is used
|
# TODO: deprecate / remove this? not sure if/where it is used
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2023 Lance Edgar
|
# Copyright © 2010-2024 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -33,9 +33,7 @@ from collections import OrderedDict
|
||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
|
|
||||||
from rattail.core import Object
|
from rattail.db.model import Upgrade
|
||||||
from rattail.db import model, Session as RattailSession
|
|
||||||
from rattail.time import make_utc
|
|
||||||
from rattail.threads import Thread
|
from rattail.threads import Thread
|
||||||
|
|
||||||
from deform import widget as dfwidget
|
from deform import widget as dfwidget
|
||||||
|
@ -53,7 +51,7 @@ class UpgradeView(MasterView):
|
||||||
"""
|
"""
|
||||||
Master view for all user events
|
Master view for all user events
|
||||||
"""
|
"""
|
||||||
model_class = model.Upgrade
|
model_class = Upgrade
|
||||||
downloadable = True
|
downloadable = True
|
||||||
cloneable = True
|
cloneable = True
|
||||||
configurable = True
|
configurable = True
|
||||||
|
@ -100,7 +98,7 @@ class UpgradeView(MasterView):
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, request):
|
def __init__(self, request):
|
||||||
super(UpgradeView, self).__init__(request)
|
super().__init__(request)
|
||||||
|
|
||||||
if hasattr(self, 'get_handler'):
|
if hasattr(self, 'get_handler'):
|
||||||
warnings.warn("defining get_handler() is deprecated. please "
|
warnings.warn("defining get_handler() is deprecated. please "
|
||||||
|
@ -120,7 +118,8 @@ class UpgradeView(MasterView):
|
||||||
return self.upgrade_handler
|
return self.upgrade_handler
|
||||||
|
|
||||||
def configure_grid(self, g):
|
def configure_grid(self, g):
|
||||||
super(UpgradeView, self).configure_grid(g)
|
super().configure_grid(g)
|
||||||
|
model = self.model
|
||||||
|
|
||||||
# system
|
# system
|
||||||
systems = self.upgrade_handler.get_all_systems()
|
systems = self.upgrade_handler.get_all_systems()
|
||||||
|
@ -147,7 +146,8 @@ class UpgradeView(MasterView):
|
||||||
return 'notice'
|
return 'notice'
|
||||||
|
|
||||||
def template_kwargs_view(self, **kwargs):
|
def template_kwargs_view(self, **kwargs):
|
||||||
kwargs = super(UpgradeView, self).template_kwargs_view(**kwargs)
|
kwargs = super().template_kwargs_view(**kwargs)
|
||||||
|
model = self.model
|
||||||
upgrade = kwargs['instance']
|
upgrade = kwargs['instance']
|
||||||
|
|
||||||
kwargs['system_title'] = self.rattail_config.app_title()
|
kwargs['system_title'] = self.rattail_config.app_title()
|
||||||
|
@ -177,7 +177,7 @@ class UpgradeView(MasterView):
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
def configure_form(self, f):
|
def configure_form(self, f):
|
||||||
super(UpgradeView, self).configure_form(f)
|
super().configure_form(f)
|
||||||
upgrade = f.model_instance
|
upgrade = f.model_instance
|
||||||
|
|
||||||
# system
|
# system
|
||||||
|
@ -275,9 +275,10 @@ class UpgradeView(MasterView):
|
||||||
f.fields = ['system', 'description', 'notes', 'enabled']
|
f.fields = ['system', 'description', 'notes', 'enabled']
|
||||||
|
|
||||||
def clone_instance(self, original):
|
def clone_instance(self, original):
|
||||||
|
app = self.get_rattail_app()
|
||||||
cloned = self.model_class()
|
cloned = self.model_class()
|
||||||
cloned.system = original.system
|
cloned.system = original.system
|
||||||
cloned.created = make_utc()
|
cloned.created = app.make_utc()
|
||||||
cloned.created_by = self.request.user
|
cloned.created_by = self.request.user
|
||||||
cloned.description = original.description
|
cloned.description = original.description
|
||||||
cloned.notes = original.notes
|
cloned.notes = original.notes
|
||||||
|
@ -335,7 +336,6 @@ class UpgradeView(MasterView):
|
||||||
return HTML.tag('div', c="(not available for this upgrade)")
|
return HTML.tag('div', c="(not available for this upgrade)")
|
||||||
|
|
||||||
def get_extra_diff_row_attrs(self, field, attrs):
|
def get_extra_diff_row_attrs(self, field, attrs):
|
||||||
# note, this is only needed/used with Buefy
|
|
||||||
extra = {}
|
extra = {}
|
||||||
if attrs.get('class') != 'diff':
|
if attrs.get('class') != 'diff':
|
||||||
extra['v-show'] = "showingPackages == 'all'"
|
extra['v-show'] = "showingPackages == 'all'"
|
||||||
|
@ -449,13 +449,14 @@ class UpgradeView(MasterView):
|
||||||
return packages
|
return packages
|
||||||
|
|
||||||
def parse_requirement(self, line):
|
def parse_requirement(self, line):
|
||||||
|
app = self.get_rattail_app()
|
||||||
match = re.match(r'^.*@(.*)#egg=(.*)$', line)
|
match = re.match(r'^.*@(.*)#egg=(.*)$', line)
|
||||||
if match:
|
if match:
|
||||||
return Object(name=match.group(2), version=match.group(1))
|
return app.make_object(name=match.group(2), version=match.group(1))
|
||||||
|
|
||||||
match = re.match(r'^(.*)==(.*)$', line)
|
match = re.match(r'^(.*)==(.*)$', line)
|
||||||
if match:
|
if match:
|
||||||
return Object(name=match.group(1), version=match.group(2))
|
return app.make_object(name=match.group(1), version=match.group(2))
|
||||||
|
|
||||||
def download_path(self, upgrade, filename):
|
def download_path(self, upgrade, filename):
|
||||||
return self.rattail_config.upgrade_filepath(upgrade.uuid, filename=filename)
|
return self.rattail_config.upgrade_filepath(upgrade.uuid, filename=filename)
|
||||||
|
@ -537,17 +538,17 @@ class UpgradeView(MasterView):
|
||||||
|
|
||||||
def delete_instance(self, upgrade):
|
def delete_instance(self, upgrade):
|
||||||
self.handler.delete_files(upgrade)
|
self.handler.delete_files(upgrade)
|
||||||
super(UpgradeView, self).delete_instance(upgrade)
|
super().delete_instance(upgrade)
|
||||||
|
|
||||||
def configure_get_context(self, **kwargs):
|
def configure_get_context(self, **kwargs):
|
||||||
context = super(UpgradeView, self).configure_get_context(**kwargs)
|
context = super().configure_get_context(**kwargs)
|
||||||
|
|
||||||
context['upgrade_systems'] = self.upgrade_handler.get_all_systems()
|
context['upgrade_systems'] = self.upgrade_handler.get_all_systems()
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def configure_gather_settings(self, data):
|
def configure_gather_settings(self, data):
|
||||||
settings = super(UpgradeView, self).configure_gather_settings(data)
|
settings = super().configure_gather_settings(data)
|
||||||
|
|
||||||
keys = []
|
keys = []
|
||||||
for system in json.loads(data['upgrade_systems']):
|
for system in json.loads(data['upgrade_systems']):
|
||||||
|
@ -568,7 +569,7 @@ class UpgradeView(MasterView):
|
||||||
return settings
|
return settings
|
||||||
|
|
||||||
def configure_remove_settings(self):
|
def configure_remove_settings(self):
|
||||||
super(UpgradeView, self).configure_remove_settings()
|
super().configure_remove_settings()
|
||||||
app = self.get_rattail_app()
|
app = self.get_rattail_app()
|
||||||
model = self.model
|
model = self.model
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue