diff --git a/CHANGES.rst b/CHANGES.rst index 59211ac2..2554c735 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -15,6 +15,8 @@ Release date: - Release date: - +- Add a ``custom_actions`` parameter for the ``render_table`` macro. When passing a list of tuples ``[(title, bootstrap icon, link)]`` to the ``custom_actions`` parameter, the ``render_table`` macro will create an icon (link) on the action header for each tuple in the list. The title text (first index of each tuple) will show when hovering over each ``custom_actions`` button. + 1.6.0 ----- diff --git a/docs/macros.rst b/docs/macros.rst index d97d3434..348a130d 100644 --- a/docs/macros.rst +++ b/docs/macros.rst @@ -433,6 +433,7 @@ API responsive_class='table-responsive',\ show_actions=False,\ actions_title='Actions',\ + custom_actions=None,\ view_url=None,\ edit_url=None,\ delete_url=None,\ @@ -451,6 +452,9 @@ API :param responsive_class: The responsive class to apply to the table. Default is ``'table-responsive'``. :param show_actions: Whether to display the actions column. Default is ``False``. :param actions_title: Title for the actions column header. Default is ``'Actions'``. + :param custom_actions: A list of tuples for creating custom action buttons, where each tuple contains + ('Title Text displayed on hover', 'bootstrap icon name', 'url_for()') + (e.g.``[('Run', 'play-fill', url_for('run_report', report_id=':primary_key'))]``). :param view_url: URL to use for the view action. :param edit_url: URL to use for the edit action. :param delete_url: URL to use for the delete action. diff --git a/flask_bootstrap/templates/bootstrap/table.html b/flask_bootstrap/templates/bootstrap/table.html index ec1f449e..717e601c 100644 --- a/flask_bootstrap/templates/bootstrap/table.html +++ b/flask_bootstrap/templates/bootstrap/table.html @@ -9,6 +9,7 @@ responsive_class='table-responsive', show_actions=False, actions_title='Actions', + custom_actions=None, view_url=None, edit_url=None, delete_url=None, @@ -37,6 +38,9 @@
+ {% if custom_actions %} + {% from 'bootstrap/utils.html' import render_icon %} + {% endif %} {% for row in data %}