{% extends "page.html" %}

{% set user = c.user_dict %}

{% block subtitle %}{{ user.display_name }} - {{ _('Users') }}{% endblock %}

{% block breadcrumb_content %}
  {{ h.build_nav('user_index', _('Users')) }}
  {{ h.build_nav('user_datasets', user.display_name|truncate(35), id=user.name) }}
{% endblock %}

{% block content_action %}
  {% if h.check_access('user_update', user) %}
    {% link_for _('Manage'), controller='user', action='edit', id=user.name, class_='btn', icon='wrench' %}
  {% endif %}
{% endblock %}

{% block content_primary_nav %}
  {{ h.build_nav_icon('user_datasets', _('Datasets'), id=user.name) }}
  {{ h.build_nav_icon('user_activity_stream', _('Activity Stream'), id=user.name) }}
{% endblock %}

{% block secondary_content %}
<div class="module context-info">
  <section class="module-content">
    {% block secondary_content_inner %}
      {% block user_image %}
      <div class="image">{{ h.linked_gravatar(user.email_hash, 190) }}</div>
      {% endblock %}
      {% block user_heading %}
      <h1 class="heading">{{ user.display_name }}</h1>
      {% endblock %}
      {% block user_about %}
      {% if c.about_formatted %}
        {{ c.about_formatted }}
      {% else %}
        <p class="empty">
          {% if c.is_myself %}
            {% trans %}You have not provided a biography.{% endtrans %}
          {% else %}
            {% trans %}This user has no biography.{% endtrans %}
          {% endif %}
        </p>
      {% endif %}
      {% endblock %}
      {% block user_nums %}
      <div class="nums">
        <dl>
          <dt>{{ _('Followers') }}</dt>
          <dd>{{ h.SI_number_span(user.num_followers) }}</dd>
        </dl>
        <dl>
          <dt>{{ _('Datasets') }}</dt>
          <dd>{{ h.SI_number_span(user.number_created_packages) }}</dd>
        </dl>
        <dl>
          <dt>{{ _('Edits') }}</dt>
          <dd>{{ h.SI_number_span(user.number_of_edits) }}</dd>
        </dl>
      </div>
      {% endblock %}
      {% if c.is_myself == false %}
        {% block user_follow %}
        <div class="follow_button">
          {{ h.follow_button('user', user.id) }}</li>
        </div>
        {% endblock %}
      {% endif %}
      {% block user_info %}
      <div class="info">
        <dl>
          {% if user.name.startswith('http://') or user.name.startswith('https://') %}
            <dt>{{ _('Open ID') }}</dt>
            <dd>{{ user.name|urlize(25) }}{# Be great if this just showed the domain #}</dd>
          {% else %}
            <dt>{{ _('Username') }}</dt>
            <dd>{{ user.name }}</dd>
          {% endif %}
        </dl>
        {% if c.is_myself %}
          <dl>
            <dt>{{ _('Email') }} <span class="label" title="{{ _('This means only you can see this') }}">{{ _('Private') }}</span></dt>
            <dd>{{ user.email }}</dd>
          </dl>
        {% endif %}
        <dl>
          <dt>{{ _('Member Since') }}</dt>
          <dd>{{ h.render_datetime(user.created) }}</dd>
        </dl>
        <dl>
          <dt>{{ _('State') }}</dt>
          <dd>{{ user.state }}</dd>
        </dl>
        {% if c.is_myself %}
          <dl>
            <dt class="key">{{ _('API Key') }} <span class="label" title="{{ _('This means only you can see this') }}">{{ _('Private') }}</span></dt>
            <dd class="value"><code>{{ user.apikey }}</code></dd>
          </dl>
        {% endif %}
        {% endblock %}
      </div>
    {% endblock %}
  </section>
</div>
{% endblock %}
