Добавлена возможность редактировать и создавать новости

This commit is contained in:
developer 2026-05-08 14:09:21 +08:00
parent 9223d2dcad
commit d40abee083
2 changed files with 6 additions and 17 deletions

View File

@ -14,7 +14,7 @@
</style>
<div class="container">
<div>
<form class="d-lg-flex mb-3" method="GET" action="{{ route('posts') }}">
<form class="d-lg-flex mb-3 justify-content-between align-items-center" method="GET" action="{{ route('posts') }}">
<div class="p-2 border rounded-3 border-1 p-1 bg-white">
<input type="radio" class="btn-check" onclick="this.form.submit()" name="filter[category]" value="all"
id="option_all" autocomplete="off" checked>
@ -30,7 +30,7 @@
<div class="ms-auto py-2 hstack gap-2">
@can('create', \Modules\Post\Models\Post::class)
<div class="mb-3">
<div class="">
@livewire('post.form', ['post' => new \Modules\Post\Models\Post()])
</div>
@endcan
@ -50,21 +50,8 @@
</form>
</div>
<div>
@livewire('posts.list', $filter)
</div>
<div class="position-fixed bottom-0 end-0 me-0 me-md-5" style="z-index:2000">
<a class="m-2 me-md-5 btn btn-primary rounded-circle d-flex justify-content-center align-items-center"
style="width:4rem;height:4rem" href="{{ route('post.create') }}">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-plus-lg"
viewBox="0 0 16 16">
<path fill-rule="evenodd"
d="M8 2a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 8 2" />
</svg>
</a>
</div>
</div>
@endsection

View File

@ -19,12 +19,14 @@
background-size: cover; ">
</div>
@endif
<h1 class="mt-3">{{ $post->name }}</h1>
<div class="mt-2 d-flex justify-content-between align-items-center">
<h1 class="flex-fill">{{ $post->name }}</h1>
@can('update', $post)
<div class="mb-3">
<div class="ms-auto">
@livewire('post.form', ['post' => $post])
</div>
@endcan
</div>
<p>
{!! $post->trixRender('content') !!}
</p>