Skip to content

Commit

Permalink
refactor: no need for icon tag, use modified include
Browse files Browse the repository at this point in the history
  • Loading branch information
thekaveman committed Jul 6, 2023
1 parent 35bb590 commit 86258a6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
13 changes: 13 additions & 0 deletions benefits/core/templates/core/includes/icon__direct_args.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

{% if not name %}
<p class="bg-grey-lightest color-standout">
Missing <strong><code>name</code></strong> argument
</p>
{% elif not alt %}
<p class="bg-grey-lightest color-standout">
Missing <strong><code>alt</code></strong> argument
</p>
{% else %}
{% load static %}
<img class="icon" width="150" height="150" src="{% get_static_prefix %}img/icon/{{ name }}.svg" alt="{{ alt }}" />
{% endif %}
3 changes: 0 additions & 3 deletions benefits/core/templates/core/tags/icon.html

This file was deleted.

2 changes: 1 addition & 1 deletion benefits/core/templates/core/tags/media_item.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% load core %}

<li class="media d-flex align-items-stretch w-auto">
<div class="media-line">{% icon name=icon alt=icon_alt %}</div>
<div class="media-line">{% include "core/includes/icon__direct_args.html" with name=icon alt=icon_alt %}</div>
<div class="media-body">
{% if heading %}<h3 class="media-body--heading">{{ heading }}</h3>{% endif %}
{{ body }}
Expand Down
8 changes: 0 additions & 8 deletions benefits/core/templatetags/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
register = template.Library()


@register.inclusion_tag("core/tags/icon.html")
def icon(name, alt):
"""
Defines a tag `{% icon name="" alt="" %}`
"""
return {"name": name, "alt": alt}


@register.tag
def media_item(parser, token):
"""
Expand Down

0 comments on commit 86258a6

Please sign in to comment.