From 96ba039299e7a2efd51bfc33a4ae9853c6b7fef3 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 13 Apr 2024 10:02:57 -0500 Subject: [PATCH] Rename grids/complete template (avoid buefy name) and rename grid methods accordingly --- CHANGES.rst | 11 ++++++++ tailbone/grids/core.py | 25 +++++++++---------- .../grids/{buefy.mako => complete.mako} | 0 tailbone/templates/master/index.mako | 2 +- tailbone/templates/master/versions.mako | 2 +- tailbone/templates/master/view.mako | 4 +-- 6 files changed, 27 insertions(+), 17 deletions(-) rename tailbone/templates/grids/{buefy.mako => complete.mako} (100%) diff --git a/CHANGES.rst b/CHANGES.rst index 400557d3..1edf8a2a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,17 @@ CHANGELOG Unreleased ---------- +* Avoid uncaught error when updating order batch row quantities. + +* Try to return JSON error when receiving API call fails. + +* Avoid error for tax field when creating new department. + +* Show toast msg instead of silent error, when grid fetch fails. + +* Rename template files to avoid "buefy" names. + + 0.9.90 (2024-04-01) ------------------- diff --git a/tailbone/grids/core.py b/tailbone/grids/core.py index 41964648..c03ac2c0 100644 --- a/tailbone/grids/core.py +++ b/tailbone/grids/core.py @@ -1333,18 +1333,7 @@ class Grid(object): data = self.pager return data - def render_complete(self, template='/grids/buefy.mako', **kwargs): - """ - Render the complete grid, including filters. - """ - context = kwargs - context['grid'] = self - context['request'] = self.request - context.setdefault('allow_save_defaults', True) - context.setdefault('view_click_handler', self.get_view_click_handler()) - return render(template, context) - - def render_buefy(self, template='/grids/buefy.mako', **kwargs): + def render_complete(self, template='/grids/complete.mako', **kwargs): """ Render the Buefy grid, complete with filters. Note that this also includes the context menu items and grid tools. @@ -1364,7 +1353,17 @@ class Grid(object): if self.filterable and 'filters_sequence' not in kwargs: kwargs['filters_sequence'] = self.get_filters_sequence() - return self.render_complete(template=template, **kwargs) + context = kwargs + context['grid'] = self + context['request'] = self.request + context.setdefault('allow_save_defaults', True) + context.setdefault('view_click_handler', self.get_view_click_handler()) + return render(template, context) + + def render_buefy(self, **kwargs): + warnings.warn("Grid.render_buefy() is deprecated; " + "please use Grid.render_complete() instead", + DeprecationWarning, stacklevel=2) def render_buefy_table_element(self, template='/grids/b-table.mako', data_prop='gridData', empty_labels=False, diff --git a/tailbone/templates/grids/buefy.mako b/tailbone/templates/grids/complete.mako similarity index 100% rename from tailbone/templates/grids/buefy.mako rename to tailbone/templates/grids/complete.mako diff --git a/tailbone/templates/master/index.mako b/tailbone/templates/master/index.mako index b0ee17d6..051a9ab6 100644 --- a/tailbone/templates/master/index.mako +++ b/tailbone/templates/master/index.mako @@ -327,7 +327,7 @@ ${parent.render_this_page_template()} ## TODO: stop using |n filter - ${grid.render_buefy(tools=capture(self.grid_tools).strip(), context_menu=capture(self.context_menu_items).strip())|n} + ${grid.render_complete(tools=capture(self.grid_tools).strip(), context_menu=capture(self.context_menu_items).strip())|n} <%def name="modify_this_page_vars()"> diff --git a/tailbone/templates/master/versions.mako b/tailbone/templates/master/versions.mako index bfec39b7..307674b8 100644 --- a/tailbone/templates/master/versions.mako +++ b/tailbone/templates/master/versions.mako @@ -31,7 +31,7 @@ ${parent.render_this_page_template()} ## TODO: stop using |n filter - ${grid.render_buefy()|n} + ${grid.render_complete()|n} <%def name="page_content()"> diff --git a/tailbone/templates/master/view.mako b/tailbone/templates/master/view.mako index 9a37b2bb..dcf1f8ee 100644 --- a/tailbone/templates/master/view.mako +++ b/tailbone/templates/master/view.mako @@ -228,11 +228,11 @@ <%def name="render_this_page_template()"> % if master.has_rows: ## TODO: stop using |n filter - ${rows_grid.render_buefy(allow_save_defaults=False, tools=capture(self.render_row_grid_tools))|n} + ${rows_grid.render_complete(allow_save_defaults=False, tools=capture(self.render_row_grid_tools))|n} % endif ${parent.render_this_page_template()} % if expose_versions: - ${versions_grid.render_buefy()|n} + ${versions_grid.render_complete()|n} % endif