{include file="_partials/head.tpl"}

<div class="page-head">
  <div>
    <h1>{lang key="admin.pages_title"}</h1>
    <p class="muted">{lang key="admin.news_total"}: {pagination.total}</p>
  </div>
  <div class="actions">
    <a class="btn btn-primary" href="/admin/pages/create">{lang key="admin.pages_new"}</a>
  </div>
</div>

[if {pages}]
<table class="table">
  <thead>
    <tr>
      <th>#</th>
      <th>{lang key="admin.title"}</th>
      <th>{lang key="admin.slug"}</th>
      <th>{lang key="admin.status"}</th>
      <th>{lang key="admin.updated"}</th>
      <th class="actions">{lang key="admin.actions"}</th>
    </tr>
  </thead>
  <tbody>
    [foreach var="pages" as="p"]
      <tr>
        <td>{p.id}</td>
        <td><a href="/admin/pages/{p.id}/edit" class="row-link">{p.title}</a></td>
        <td><code>/p/{p.slug}</code></td>
        <td>
          [if {p.status}="published"]<span class="badge badge-published">{lang key="admin.published"}</span>[else]<span class="badge badge-draft">{lang key="admin.draft"}</span>[/if]
        </td>
        <td class="muted">{p.updated_at}</td>
        <td class="actions">
          <a href="/p/{p.slug}" target="_blank" title="{lang key="admin.open_site"}">{icon name="external" size="16"}</a>
          <form method="post" action="/admin/pages/{p.id}/delete" style="display:inline" data-confirm="{lang key=&quot;admin.delete_confirm&quot;}">
            {csrf}
            <button type="submit" class="danger" title="{lang key="admin.delete"}">{icon name="trash" size="16"}</button>
          </form>
        </td>
      </tr>
    [/foreach]
  </tbody>
</table>
{include file="_partials/pagination.tpl"}
[else]
<div class="empty-state">
  {icon name="pages" size="40"}
  <p>{lang key="admin.pages_empty"}</p>
</div>
[/if]

{include file="_partials/foot.tpl"}
