home.html is rendering

- Converted Icon and SidenavItem into macros
- Setting a mock user on g.current_user
This commit is contained in:
richard-dds
2018-08-01 11:40:07 -04:00
parent 29c68151de
commit 0976aed778
4 changed files with 56 additions and 16 deletions

32
templates/components.html Normal file
View File

@@ -0,0 +1,32 @@
{% macro Icon(name, classes="") -%}
{% autoescape false %}
<span class="icon icon--{{name}} {{classes}}" aria-hidden="true">{{ svg }}</span>
{% endautoescape %}
{%- endmacro %}
{% macro SidenavItem(label, href, active=False, icon=None, subnav=None) -%}
<li>
<a class="sidenav__link {% if active %}sidenav__link--active{% endif %}" href="{{href}}" title="{{label}}">
{% if icon %}
{{ Icon(icon, classes="sidenav__link-icon") }}
{% endif %}
<span class="sidenav__link-label">{{label}}</span>
</a>
{% if subnav and active %}
<ul>
{% for item in subnav %}
<li>
<a class="sidenav__link {% if item["active"] %}sidenav__link--active{% endif %}" href="{{item["href"]}}" title="{{item["label"]}}">
{% if "icon" in item %}
{{ Icon(item["icon"], classes="sidenav__link-icon") }}
{% endif %}
<span class="sidenav__link-label">{{item["label"]}}</span>
</a>
</li>
{% endfor %}
</ul>
{% endif %}
</li>
{%- endmacro %}