{% extends "master.html" %}

{% block title %}User {{username}}{% endblock %}

{% block header %}
  <link href="{{ url_for('static', filename='vendor/selectize/selectize.bootstrap3.css') }}?version={{ g.version}}"
  rel="stylesheet" />
{% endblock %}


{% from "_render_repo.html" import render_repos_as_card, render_activity_graph %}
{% from "_projectstring.html" import projectstring, projecticon %}


{% block content %}
<div class="bg-light border border-top-0 pt-2">
  <div class="container">
      <div class="media my-4">
        {{ user.default_email | avatar(64, css_class="align-self-center mr-3") | safe }}
        <div class="media-body align-self-center">
          <h3 class="mb-0 font-weight-bold">{{ username }}</h3>
          <div title="{{ user.created.strftime('%Y-%m-%d') }}">
            {{user.fullname}} &bull; <span class="text-muted">Joined {{
              user.created | humanize }}</span>
          {% if config['FAS_URL'] %} &bull; (<a href="{{ config['FAS_URL'].rstrip('/') }}/user/view/{{ username }}">fas</a>){%
          endif %}
          <img src="https://apps.fedoraproject.org/calendar/api/{{ username }}/shield/vacation?connector=on&always=0" alt="" />
          </div>
        </div>
      </div>
  </div>
</div>
<div class="container">
  <div class="row">
    <div class="col">
        <ul class="nav nav-tabs nav-sidetabs flex-column">
          <li class="nav-item text-dark">
            <a class="nav-link d-flex align-items-center {{'active' if select=='overview'}}"
              href="{{ url_for('ui_ns.view_user', username=user.username) }}">
              <span>
                <i class="fa fa-fw text-muted fa-user"></i>
                <span class="d-none d-md-inline">Overview&nbsp;</span>
              </span>
            </a>
          </li>
          <li class="nav-item text-dark">
            <a class="nav-link d-flex align-items-center {{'active' if select=='projects'}}"
              href="{{ url_for('ui_ns.userprofile_projects', username=user.username) }}">
              <span>
                <i class="fa fa-fw text-muted {{projecticon()}}"></i>
                <span class="d-none d-md-inline">{{projectstring(plural=True)}}&nbsp;</span>
              </span>
              <div class="ml-auto">
                <span class="badge badge-secondary">
                  {{ repos_length }}
                </span>
              </div>
            </a>
          </li>
          <li class="nav-item text-dark">
            <a class="nav-link d-flex align-items-center {{'active' if select=='forks'}}"
              href="{{ url_for('ui_ns.userprofile_forks', username=user.username) }}">
              <span>
                <i class="fa fa-fw text-muted fa-code-fork"></i>
                <span class="d-none d-md-inline">Forks&nbsp;</span>
              </span>
              <div class="ml-auto">
                <span class="badge badge-secondary">
                  {{ forks_length }}
                </span>
              </div>
            </a>
          </li>
          <li class="nav-item text-dark">
            <a class="nav-link d-flex align-items-center {{'active' if select=='groups'}}"
             href="{{ url_for('ui_ns.userprofile_groups', username=user.username) }}">
              <span>
                <i class="fa fa-fw text-muted fa-users"></i>
                <span class="d-none d-md-inline">Groups&nbsp;</span>
              </span>
              <div class="ml-auto">
                <span class="badge badge-secondary">
                  {{ user.groups | length }}
                </span>
              </div>
            </a>
          </li>
          <li class="nav-item text-dark">
            <a class="nav-link d-flex align-items-center {{'active' if select=='starred'}}"
              href="{{ url_for('ui_ns.userprofile_starred', username=user.username) }}">
              <span>
                <i class="fa fa-fw text-muted fa-star"></i>
                <span class="d-none d-md-inline">Starred&nbsp;</span>
              </span>
              <div class="ml-auto">
                <span class="badge badge-secondary">
                  {{ user.stars | length }}
                </span>
              </div>
            </a>
          </li>
        </ul>
    </div>

    <div class="col-9">
    {% block userprofile_content %}
    {% endblock %}
    </div>
  </div>
</div>
{% endblock %}
