From e656f769b1c4b9f92570b1e25bf05988585b9008 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 23 Jul 2022 22:18:17 -0500 Subject: [PATCH] Allow optional row grid title for master view --- tailbone/templates/master/view.mako | 3 +++ tailbone/views/master.py | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/tailbone/templates/master/view.mako b/tailbone/templates/master/view.mako index 4ede63dc..17a4f852 100644 --- a/tailbone/templates/master/view.mako +++ b/tailbone/templates/master/view.mako @@ -104,6 +104,9 @@ % if master.has_rows: % if use_buefy:
+ % if rows_title: +

${rows_title}

+ % endif % else: ${rows_grid|n} diff --git a/tailbone/views/master.py b/tailbone/views/master.py index b3a99e49..b2002f49 100644 --- a/tailbone/views/master.py +++ b/tailbone/views/master.py @@ -166,6 +166,7 @@ class MasterView(View): has_rows = False model_row_class = None + rows_title = None rows_pageable = True rows_sortable = True rows_filterable = True @@ -224,6 +225,12 @@ class MasterView(View): """ return getattr(cls, 'grid_factory', grids.Grid) + @classmethod + def get_rows_title(cls): + # nb. we do not provide a default value for this, since it + # will not always make sense to show a row title + return cls.rows_title + @classmethod def get_row_grid_factory(cls): """ @@ -2208,6 +2215,7 @@ class MasterView(View): context['grid_count'] = self.grid_count if self.has_rows: + context['rows_title'] = self.get_rows_title() context['row_permission_prefix'] = self.get_row_permission_prefix() context['row_model_title'] = self.get_row_model_title() context['row_model_title_plural'] = self.get_row_model_title_plural()