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