nyaabooru/resources/views/livewire/posts/edit.blade.php

79 lines
2.4 KiB
PHP

<div class="wa-flank wa-align-items-start wa-gap-3xl" style="--flank-size: 20rem;">
{{-- Sidebar --}}
<div class="wa-stack">
<wa-callout variant="brand" appearance="outlined">
<wa-icon slot="icon" name="circle-info"></wa-icon>
<span>Changes are automatically saved.</span>
</wa-callout>
<form wire:submit class="wa-stack wa-gap-xl">
<wa-select wire:model.live="rating" label="Rating" value="{{ $post->rating }}" wire:loading.attr="disabled" @error('rating') hint="{{ $message }}" @enderror>
<wa-option value="safe">Safe</wa-option>
<wa-option value="suggestive">Suggestive</wa-option>
<wa-option value="explicit">Explicit</wa-option>
</wa-select>
@if ($post->rating == 'safe')
<wa-switch
wire:model.live="featured"
{{ $post->featured ? 'checked' : '' }}
wire:loading.attr="disabled"
hint="Featured posts will be randomly selected to show on the front page.">
Feature post
</wa-switch>
@endif
</form>
<wa-divider></wa-divider>
{{-- Tags --}}
<div class="wa-cluster wa-heading-m">
<wa-icon fixed-width name="tags"></wa-icon>
<span>Tags</span>
</div>
<wa-divider></wa-divider>
<div class="wa-split">
<wa-button href="{{ url("posts/$post->id") }}" appearance="outlined" variant="neutral" size="small" wire:navigate.hover>
<wa-icon slot="prefix" name="arrow-left"></wa-icon>
<span>Exit</span>
</wa-button>
<wa-button appearance="outlined" variant="danger" size="small" wire:click="$js.openDialog">
<wa-icon slot="prefix" name="trash"></wa-icon>
<span>Delete post</span>
</wa-button>
</div>
</div>
{{-- Main content --}}
<div class="wa-stack wa-gap-2xl">
<livewire:posts.image :$post lazy />
</div>
{{-- Confirm deletion dialog --}}
<wa-dialog label="Confirm post deletion" without-header light-dismiss id="modal-confirm-post-delete" style="--width: 360px;">
<div class="wa-stack wa-align-items-center">
<span>Are you sure you want to delete this post?</span>
<div class="wa-split">
<wa-button variant="neutral" appearance="outlined" data-dialog="close">
No, go back
</wa-button>
<wa-button href="{{ url("delete/post/$post->id") }}" appearance="outlined" variant="danger" wire:navigate>
Yes, delete it
</wa-button>
</div>
</div>
</wa-dialog>
@script
<script>
const dialog = document.querySelector('#modal-confirm-post-delete');
$js('openDialog', () => { dialog.open = true})
</script>
@endscript
</div>