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 %}
<div class='alert__actions'>
{% for action in actions %}
<a href={{ action["href"] }} class='icon-link'>
{% if 'icon' in action %}{{ Icon(action["icon"]) }}{% endif %}
<span>{{ action["label"] }}</span>
</a>
{% endfor %}
{% if actions is string %}
{{ actions | safe }}
{% elif actions is iterable %}
{% for action in actions %}
<a href={{ action["href"] }} class='icon-link'>
{% if 'icon' in action %}{{ Icon(action["icon"]) }}{% endif %}
<span>{{ action["label"] }}</span>
</a>
{% endfor %}
{% endif %}
</div>
{% endif %}
</div>