Add way to override grid action label rendering

so that custom HTML can be embedded in there somehow..
This commit is contained in:
Lance Edgar 2021-09-22 16:42:49 -05:00
parent b229b409b0
commit 87d8322b85
3 changed files with 16 additions and 3 deletions

View file

@ -2251,14 +2251,16 @@ class MasterView(View):
return self.request.route_url('{}.delete'.format(self.get_route_prefix()),
**self.get_action_route_kwargs(row))
def make_action(self, key, url=None, **kwargs):
def make_action(self, key, url=None, factory=None, **kwargs):
"""
Make a new :class:`GridAction` instance for the current grid.
"""
if url is None:
route = '{}.{}'.format(self.get_route_prefix(), key)
url = lambda r, i: self.request.route_url(route, **self.get_action_route_kwargs(r))
return grids.GridAction(key, url=url, **kwargs)
if not factory:
factory = grids.GridAction
return factory(key, url=url, **kwargs)
def get_action_route_kwargs(self, row):
"""