allow alert actions to be a string or a list of action dicts

This commit is contained in:
Andrew Croce 2018-08-20 15:11:12 -04:00
parent ca2db7b58f
commit 9ba8fee233

View File

@ -39,12 +39,20 @@
{% if actions %} {% if actions %}
<div class='alert__actions'> <div class='alert__actions'>
{% if actions is string %}
{{ actions | safe }}
{% elif actions is iterable %}
{% for action in actions %} {% for action in actions %}
<a href={{ action["href"] }} class='icon-link'> <a href={{ action["href"] }} class='icon-link'>
{% if 'icon' in action %}{{ Icon(action["icon"]) }}{% endif %} {% if 'icon' in action %}{{ Icon(action["icon"]) }}{% endif %}
<span>{{ action["label"] }}</span> <span>{{ action["label"] }}</span>
</a> </a>
{% endfor %} {% endfor %}
{% endif %}
</div> </div>
{% endif %} {% endif %}
</div> </div>