{% macro sidebar(icons=["fui-new", "fui-plus"], user='', actions={}, href={}) %}
<div class="sidebar-container">
  <div class="main-nav">
    <div>
      <a href="/dashboard">dashboards</a>
      <a href="/chart">charts</a>
      {% with %}
        {% if user is not string %}
          {% set user = user.email %}
        {% endif %}
        <a class="user" href="#">{{user.split('@')[0]}}</a>
      {% endwith %}
    </div>
  </div>
  <div class="sidebar">
    <ul>
      <li>
        <a style="cursor:pointer;" class="logo" href="/">P</a>
      </li>
      {% for icon in icons %}
        {% with %}
          {% set ng_click = 'ng-click="{}"'.format(actions[icon])
            if actions.get(icon) else '' %}
          {% if href.get(icon) %}
              {% set str_href = "href='{}'".format(href[icon]) %}
          {% else %}
            {% set str_href = '' %}
          {% endif %}
          <li>
            <a style="cursor: pointer;" {{ str_href }} class="{{ icon }}" {{ ng_click }}></a>
          </li>
        {% endwith %}
      {% endfor %}
    </ul>
  </div>
</div>
{% endmacro %}
