From a038f2a98dcb7f2f2263eddbe3d6cf0ee2e1d7b5 Mon Sep 17 00:00:00 2001
From: Lance Edgar
Date: Sun, 16 Aug 2020 16:57:06 -0500
Subject: [PATCH 0001/1508] Make "download row results" a bit more generic
to handle non-native table/rows, w/ non-uuid key
---
tailbone/templates/master/view.mako | 4 ++--
tailbone/views/master.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tailbone/templates/master/view.mako b/tailbone/templates/master/view.mako
index d07e1cc9..94454bd9 100644
--- a/tailbone/templates/master/view.mako
+++ b/tailbone/templates/master/view.mako
@@ -72,8 +72,8 @@
% if master.has_rows and master.rows_downloadable_csv and request.has_perm('{}.row_results_csv'.format(permission_prefix)):
${h.link_to("Download row results as CSV", url('{}.row_results_csv'.format(route_prefix), uuid=instance.uuid))}
% endif
- % if master.has_rows and master.rows_downloadable_xlsx and request.has_perm('{}.row_results_xlsx'.format(permission_prefix)):
- ${h.link_to("Download row results as XLSX", url('{}.row_results_xlsx'.format(route_prefix), uuid=instance.uuid))}
+ % if master.has_rows and master.rows_downloadable_xlsx and master.has_perm('row_results_xlsx'):
+ ${h.link_to("Download row results as XLSX", master.get_action_url('row_results_xlsx', instance))}
% endif
%def>
diff --git a/tailbone/views/master.py b/tailbone/views/master.py
index 10bd5c26..827e5500 100644
--- a/tailbone/views/master.py
+++ b/tailbone/views/master.py
@@ -3868,7 +3868,7 @@ class MasterView(View):
if cls.has_rows and cls.rows_downloadable_xlsx:
config.add_tailbone_permission(permission_prefix, '{}.row_results_xlsx'.format(permission_prefix),
"Download {} results as XLSX".format(row_model_title))
- config.add_route('{}.row_results_xlsx'.format(route_prefix), '{}/{{uuid}}/rows-xlsx'.format(url_prefix))
+ config.add_route('{}.row_results_xlsx'.format(route_prefix), '{}/rows-xlsx'.format(instance_url_prefix))
config.add_view(cls, attr='row_results_xlsx', route_name='{}.row_results_xlsx'.format(route_prefix),
permission='{}.row_results_xlsx'.format(permission_prefix))
From b5028ab2d0e8a240657b6b274befe9e8efc64e30 Mon Sep 17 00:00:00 2001
From: Lance Edgar
Date: Mon, 17 Aug 2020 21:38:12 -0500
Subject: [PATCH 0002/1508] Add pagination to price, cost history grids for
product view
---
tailbone/grids/core.py | 3 +++
tailbone/templates/grids/b-table.mako | 4 ++++
tailbone/templates/products/view.mako | 8 ++++----
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/tailbone/grids/core.py b/tailbone/grids/core.py
index 60934879..d475370c 100644
--- a/tailbone/grids/core.py
+++ b/tailbone/grids/core.py
@@ -985,6 +985,9 @@ class Grid(object):
context['empty_labels'] = empty_labels
if 'grid_columns' not in context:
context['grid_columns'] = self.get_buefy_columns()
+ context.setdefault('paginated', False)
+ if context['paginated']:
+ context.setdefault('per_page', 20)
# locate the 'view' action
# TODO: this should be easier, and/or moved elsewhere?
diff --git a/tailbone/templates/grids/b-table.mako b/tailbone/templates/grids/b-table.mako
index 42e82273..8608b456 100644
--- a/tailbone/templates/grids/b-table.mako
+++ b/tailbone/templates/grids/b-table.mako
@@ -5,6 +5,10 @@
striped
hoverable
narrowed
+ % if paginated:
+ paginated
+ per-page="${per_page}"
+ % endif
% if vshow is not Undefined and vshow:
v-show="${vshow}"
% endif
diff --git a/tailbone/templates/products/view.mako b/tailbone/templates/products/view.mako
index c8f2a5ec..23b6d2ca 100644
--- a/tailbone/templates/products/view.mako
+++ b/tailbone/templates/products/view.mako
@@ -380,7 +380,7 @@
- ${regular_price_history_grid.render_buefy_table_element(data_prop='regularPriceHistoryData', loading='regularPriceHistoryLoading')|n}
+ ${regular_price_history_grid.render_buefy_table_element(data_prop='regularPriceHistoryData', loading='regularPriceHistoryLoading', paginated=True, per_page=10)|n}