3
0
Fork 0

fix: add optional target attr for GridAction

This commit is contained in:
Lance Edgar 2025-01-14 11:28:12 -06:00
parent a405b19217
commit 59fe324872
2 changed files with 9 additions and 0 deletions

View file

@ -2280,6 +2280,10 @@ class GridAction:
See also :meth:`get_url()`. See also :meth:`get_url()`.
.. attribute:: target
Optional ``target`` attribute for the ``<a>`` tag.
.. attribute:: icon .. attribute:: icon
Name of icon to be shown for the action link. Name of icon to be shown for the action link.
@ -2297,6 +2301,7 @@ class GridAction:
key, key,
label=None, label=None,
url=None, url=None,
target=None,
icon=None, icon=None,
link_class=None, link_class=None,
): ):
@ -2305,6 +2310,7 @@ class GridAction:
self.app = self.config.get_app() self.app = self.config.get_app()
self.key = key self.key = key
self.url = url self.url = url
self.target = target
self.label = label or self.app.make_title(key) self.label = label or self.app.make_title(key)
self.icon = icon or key self.icon = icon or key
self.link_class = link_class or '' self.link_class = link_class or ''

View file

@ -180,6 +180,9 @@
% for action in grid.actions: % for action in grid.actions:
<a v-if="props.row._action_url_${action.key}" <a v-if="props.row._action_url_${action.key}"
:href="props.row._action_url_${action.key}" :href="props.row._action_url_${action.key}"
% if action.target:
target="${action.target}"
% endif
class="${action.link_class}"> class="${action.link_class}">
${action.render_icon_and_label()} ${action.render_icon_and_label()}
</a> </a>