diff --git a/views/tables.py b/views/tables.py index 75592bfa8f4c6f635ab46be5dd5d1c55a5547cba..94ca58c45d74ef0a3542b27a76b727109d428573 100644 --- a/views/tables.py +++ b/views/tables.py @@ -25,6 +25,18 @@ class Table: confirmation = " onclick=\"return confirm('{}');\"".format(confirm) return Markup("<a href=\"{}\"{}>{}</a>".format(target, confirmation, text)) + @staticmethod + def button(target, icon, style, confirm=None): + confirmation = "" + if confirm: + confirmation = " onclick=\"return confirm('{}');\"".format(confirm) + return Markup( + '''<div class="btn-group btn-group-xs"> + <a href="{target}" class="btn btn-{style}" {confirmation}> + <span class="glyphicon glyphicon-{icon}"></span> + </a> + </div>'''.format(target=target, style=style, confirmation=confirmation, icon=icon)) + @staticmethod def mail(target): return Markup("<a href=\"mailto:{}\">{}</a>".format(target, target))