<div class="printers">
  <h2>Printers</h2>
  {% with printers = ctx.db.list_printers() %}
  {% if printers %}
  {% for printer in printers %}
    <div class="printer row u-flex">
      <div class="details six columns">
        <span class="printer-name">{{printer.name}}</span>
        <span class="printer-url"><code>{{printer.url}}</code></span>
        <span class="printer-status">{{printer.status}}</span>
        <span class="printer-date">{{printer.last_poll_date}}</span>
      </div>
      {# FIXME: How should these action buttons work? #}
      <div class="controls u-flex u-ml-auto">
      {% if ctx.is_admin %}
        <a class="button" href="/admin/printers/test?id={{printer.id}}">Test</a>
        <a class="button" href="/admin/printers/edit?id={{printer.id}}">Edit</a>
        <a class="button" href="/admin/printers/delete?id={{printer.id}}">Remove</a>
      {% endif %}
      </div>
    </div>
  {% endfor %}
  {% if ctx.is_admin %}
    <a class="button" href="/admin/printers">Add a printer</a>
  {% endif %}
  {% else %}
    No printers available. {% if ctx.is_admin %}<a href="/admin/printers">Configure one!</a>{% else %}Ask the admin to configure one!{% endif %}
  {% endif %}
  {% endwith %}
</div>
