{% extends "base.html" %}
{% from "_macros.html" import empty %}
{% block title %}{{ container }} · mgf-cloud-web{% endblock %}
{% block content %}
<header class="page-header">
  <div>
    <p class="eyebrow"><a href="/objects">← all containers</a></p>
    <h1>{{ container }}</h1>
  </div>
</header>
<div class="split">
  <div>
    {% if objects %}
    <div class="table-wrap">
      <table class="table">
        <thead><tr><th>Object</th><th class="num">Bytes</th><th>Content-Type</th><th class="actions"></th></tr></thead>
        <tbody>
        {% for o in objects %}
          <tr>
            <td>{{ o.name }}</td>
            <td class="num">{{ o.bytes }}</td>
            <td class="mono">{{ o.content_type }}</td>
            <td class="actions">
              <a class="button button-secondary button-sm" href="/objects/{{ container }}/{{ o.name }}/download" hx-boost="false">download</a>
              <form method="post" action="/objects/{{ container }}/{{ o.name }}/delete"><button class="button button-danger button-sm">delete</button></form>
            </td>
          </tr>
        {% endfor %}
        </tbody>
      </table>
    </div>
    {% else %}
    {{ empty("Empty container.", "Upload a file to get started.") }}
    {% endif %}
  </div>
  <aside class="card">
    <p class="eyebrow">upload</p>
    <form class="form" method="post" action="/objects/{{ container }}/upload" enctype="multipart/form-data" hx-boost="false">
      <div class="field"><label class="label" for="ofile">File</label><input class="input" id="ofile" type="file" name="file" required></div>
      <button class="button button-accent" type="submit">Upload</button>
    </form>
  </aside>
</div>
{% endblock %}
