{% extends "basic.html" %}
{% block title %}
Who's at the hackerspace?
{% endblock %}
{% block content %}
  <h2>Now at hackerspace!</h2>
  <p>
    {% if devices|length > 0 %}
    It looks like someone is
    {% else %}
    It doesn't look like anyone
    {% endif %}
    is in the <a href="http://www.hackerspace.pl">hackerspace</a>.
    This is because there
    {% if devices|length == 0 %}
    are no devices
    {% elif devices|length == 1 %}
    is 1 device
    {% else %}
    are {{ devices|length }} devices
    {% endif %}
    on the network.
    (More precisely, there
    {% if devices|length == 1 %}is{% else %}are{% endif %}
    {{ devices|length }} active DHCP lease{%if devices|length != 1%}s{% endif %}.)
  </p>
  <table class="active">
    <tr><th>Name</th><th>Leased since</th></tr>
    {% for user, hwaddr, ip, timestamp, formatted_time in devices %}
    <tr title="{{hwaddr}} on {{ip}}">
      <td>
        {% if user %}
        {% if user.url %}
        <a href="{{ user.url }}">{{ user.login }}</a>
        {% else %}
        {{ user.login }}
        {% endif %}
        {% else %}
        <small>Unknown</small>
        {% endif %}
      </td>
      <td>
          <div class="bar" style="width: {{100 * (now - timestamp)/(60 * 60)}}%;">{{formatted_time}}</div>
      </td>
    </tr>
    {% endfor %}
  </table>
  {% if unknowns > 0 %}
  <p>
    {% if unknowns == 1 %}
    Is the unknown device yours?
    {% else %}
    Is one of the unknown devices yours?
    {% endif %}
    <a href="claim">Claim your device!</a>
  </p>
  {% endif %}
{% endblock %}
