Compare commits
No commits in common. "cbc0f1b44e8e8a61fd063c640f4008c30cfbe63b" and "f1ef0162d766617a58c0f09ba2e4153c148cf83b" have entirely different histories.
cbc0f1b44e
...
f1ef0162d7
1 changed files with 17 additions and 41 deletions
|
|
@ -24,45 +24,7 @@
|
||||||
<div class="alert alert-error mb-4" role="alert">{form.message}</div>
|
<div class="alert alert-error mb-4" role="alert">{form.message}</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#snippet actions(page: (typeof data.pages)[number])}
|
<div class="overflow-x-auto rounded-box bg-base-100 shadow">
|
||||||
<a class="btn btn-sm" href={`/pages/${page.slug}`}>Edit</a>
|
|
||||||
{#if siteUrl && page.published}
|
|
||||||
<a class="btn btn-sm" href={publicUrl(page.slug)} target="_blank" rel="noopener" title="Open on the live site">View</a>
|
|
||||||
{/if}
|
|
||||||
<form method="POST" action="?/toggle">
|
|
||||||
<input type="hidden" name="id" value={page.id} />
|
|
||||||
<input type="hidden" name="published" value={page.published} />
|
|
||||||
<button class="btn btn-sm btn-outline" type="submit">{page.published ? 'Unpublish' : 'Publish'}</button>
|
|
||||||
</form>
|
|
||||||
<form method="POST" action="?/delete" onsubmit={confirmSubmit(`Delete the page "${page.title}"? This cannot be undone.`)}>
|
|
||||||
<input type="hidden" name="id" value={page.id} />
|
|
||||||
<button class="btn btn-sm btn-error btn-outline" type="submit">Delete</button>
|
|
||||||
</form>
|
|
||||||
{/snippet}
|
|
||||||
|
|
||||||
{#snippet status(page: (typeof data.pages)[number])}
|
|
||||||
<span class="badge" class:badge-success={page.published}>{page.published ? 'Published' : 'Draft'}</span>
|
|
||||||
{/snippet}
|
|
||||||
|
|
||||||
<!-- Phones: one card per page, buttons under the title (a four-column table didn't fit). -->
|
|
||||||
<ul class="divide-y divide-base-200 rounded-box bg-base-100 shadow md:hidden">
|
|
||||||
{#each data.pages as page (page.id)}
|
|
||||||
<li class="p-4">
|
|
||||||
<div class="flex items-start justify-between gap-3">
|
|
||||||
<a class="min-w-0" href={`/pages/${page.slug}`}>
|
|
||||||
<span class="block font-semibold break-words">{page.title}</span>
|
|
||||||
<span class="block font-mono text-sm break-all text-base-content/60">/{page.slug}</span>
|
|
||||||
</a>
|
|
||||||
<span class="shrink-0">{@render status(page)}</span>
|
|
||||||
</div>
|
|
||||||
<div class="mt-3 flex flex-wrap gap-2">{@render actions(page)}</div>
|
|
||||||
</li>
|
|
||||||
{:else}
|
|
||||||
<li class="py-10 text-center text-base-content/60">No pages yet — create your first one.</li>
|
|
||||||
{/each}
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div class="hidden overflow-x-auto rounded-box bg-base-100 shadow md:block">
|
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr><th>Slug</th><th>Title</th><th>Status</th><th class="text-right">Actions</th></tr>
|
<tr><th>Slug</th><th>Title</th><th>Status</th><th class="text-right">Actions</th></tr>
|
||||||
|
|
@ -72,9 +34,23 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td class="font-mono">{page.slug}</td>
|
<td class="font-mono">{page.slug}</td>
|
||||||
<td>{page.title}</td>
|
<td>{page.title}</td>
|
||||||
<td>{@render status(page)}</td>
|
<td><span class="badge" class:badge-success={page.published}>{page.published ? 'Published' : 'Draft'}</span></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="flex flex-wrap justify-end gap-2 xl:flex-nowrap">{@render actions(page)}</div>
|
<div class="flex flex-wrap justify-end gap-2">
|
||||||
|
<a class="btn btn-sm" href={`/pages/${page.slug}`}>Edit</a>
|
||||||
|
{#if siteUrl && page.published}
|
||||||
|
<a class="btn btn-sm" href={publicUrl(page.slug)} target="_blank" rel="noopener" title="Open on the live site">View</a>
|
||||||
|
{/if}
|
||||||
|
<form method="POST" action="?/toggle">
|
||||||
|
<input type="hidden" name="id" value={page.id} />
|
||||||
|
<input type="hidden" name="published" value={page.published} />
|
||||||
|
<button class="btn btn-sm btn-outline" type="submit">{page.published ? 'Unpublish' : 'Publish'}</button>
|
||||||
|
</form>
|
||||||
|
<form method="POST" action="?/delete" onsubmit={confirmSubmit(`Delete the page "${page.title}"? This cannot be undone.`)}>
|
||||||
|
<input type="hidden" name="id" value={page.id} />
|
||||||
|
<button class="btn btn-sm btn-error btn-outline" type="submit">Delete</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{:else}
|
{:else}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue