Add 'target' kwarg for grid action links
For opening link in new window etc.
This commit is contained in:
parent
7104e275c3
commit
709fd5200d
|
@ -611,7 +611,7 @@ class Grid(object):
|
||||||
"""
|
"""
|
||||||
url = action.get_url(row, i)
|
url = action.get_url(row, i)
|
||||||
if url:
|
if url:
|
||||||
kwargs = {'class_': action.key}
|
kwargs = {'class_': action.key, 'target': action.target}
|
||||||
if action.icon:
|
if action.icon:
|
||||||
icon = HTML.tag('span', class_='ui-icon ui-icon-{}'.format(action.icon))
|
icon = HTML.tag('span', class_='ui-icon ui-icon-{}'.format(action.icon))
|
||||||
return tags.link_to(icon + action.label, url, **kwargs)
|
return tags.link_to(icon + action.label, url, **kwargs)
|
||||||
|
@ -707,11 +707,12 @@ class GridAction(object):
|
||||||
'actions' column when rendering the grid.
|
'actions' column when rendering the grid.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, key, label=None, url='#', icon=None):
|
def __init__(self, key, label=None, url='#', icon=None, target=None):
|
||||||
self.key = key
|
self.key = key
|
||||||
self.label = label or prettify(key)
|
self.label = label or prettify(key)
|
||||||
self.icon = icon
|
self.icon = icon
|
||||||
self.url = url
|
self.url = url
|
||||||
|
self.target = target
|
||||||
|
|
||||||
def get_url(self, row, i):
|
def get_url(self, row, i):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue