loading indicator tests, slight rework
This commit is contained in:
parent
6f517b2c6e
commit
c3af7b2afa
|
@ -16,4 +16,8 @@ tr.htmx-swapping td {
|
|||
margin: 2px;
|
||||
text-align: center;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.htmx-indicator{
|
||||
display:none;
|
||||
}
|
|
@ -23,7 +23,7 @@ class OpenTrashmailBackend{
|
|||
case 'attachment':
|
||||
return $this->getAttachment($this->url[2],$this->url[3]);
|
||||
case 'delete':
|
||||
return $this->deleteMail($_REQUEST['email'],$_REQUEST['id']);
|
||||
return $this->deleteMail($_REQUEST['email']?:$this->url[2],$_REQUEST['id']?:$this->url[3]);
|
||||
case 'random':
|
||||
$addr = generateRandomEmail();
|
||||
//add header HX-Redirect
|
||||
|
|
|
@ -30,17 +30,13 @@
|
|||
<td><?= escape($ed['from']) ?></td>
|
||||
<td><?= escape($ed['subject']) ?></td>
|
||||
<td>
|
||||
<form>
|
||||
<input type="hidden" name="email" value="<?= $email ?>">
|
||||
<input type="hidden" name="id" value="<?= $ed['id'] ?>">
|
||||
<div class="grid">
|
||||
<div><input type="submit" value="Read" hx-post="/api/read" hx-target="#main"></div>
|
||||
<div><input type="submit" value="Delete" hx-post="/api/delete" hx-confirm="Are you sure?" hx-target="closest tr" hx-swap="outerHTML swap:1s"></div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="grid">
|
||||
<div><input type="submit" value="Read" hx-get="/api/read/<?= $email ?>/<?= $ed['id'] ?>" hx-push-url="/read/<?= $email ?>/<?= $ed['id'] ?>" hx-target="#main"></div>
|
||||
<div><input type="submit" value="Delete" hx-get="/api/delete/<?= $email ?>/<?= $ed['id'] ?>" hx-confirm="Are you sure?" hx-target="closest tr" hx-swap="outerHTML swap:1s"></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
<script>history.pushState({email:"<?= $email ?>"}, "", "/address/<?= $email ?>");</script>
|
||||
<script>history.pushState({urlpath:"/address/<?= $email ?>"}, "", "/address/<?= $email ?>");</script>
|
|
@ -42,5 +42,5 @@
|
|||
<pre><button hx-get="/api/raw/<?= $email ?>/<?= $mailid ?>" hx-swap="outerHTML">Load Raw Email</button></pre>
|
||||
</article>
|
||||
|
||||
|
||||
<script>history.pushState({email:"<?= $email ?>",id:"<?= $mailid ?>"}, "", "/read/<?= $email ?>/<?= $mailid ?>");</script>
|
||||
<!--
|
||||
<script>history.pushState({email:"<?= $email ?>",id:"<?= $mailid ?>"}, "", "/read/<?= $email ?>/<?= $mailid ?>");</script> -->
|
|
@ -22,6 +22,8 @@
|
|||
</nav>
|
||||
</div>
|
||||
|
||||
<button class="htmx-indicator" aria-busy="true">Loading…</button>
|
||||
|
||||
<main id="main" class="container" hx-get="/api/<?= $url ?>" hx-trigger="load">
|
||||
|
||||
</main>
|
||||
|
|
Loading…
Reference in a new issue