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

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> </style>
<div class="container"> <div class="container">
<div> <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"> <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" <input type="radio" class="btn-check" onclick="this.form.submit()" name="filter[category]" value="all"
id="option_all" autocomplete="off" checked> id="option_all" autocomplete="off" checked>
@ -30,7 +30,7 @@
<div class="ms-auto py-2 hstack gap-2"> <div class="ms-auto py-2 hstack gap-2">
@can('create', \Modules\Post\Models\Post::class) @can('create', \Modules\Post\Models\Post::class)
<div class="mb-3"> <div class="">
@livewire('post.form', ['post' => new \Modules\Post\Models\Post()]) @livewire('post.form', ['post' => new \Modules\Post\Models\Post()])
</div> </div>
@endcan @endcan
@ -50,21 +50,8 @@
</form> </form>
</div> </div>
<div> <div>
@livewire('posts.list', $filter) @livewire('posts.list', $filter)
</div> </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> </div>
@endsection @endsection

View File

@ -19,12 +19,14 @@
background-size: cover; "> background-size: cover; ">
</div> </div>
@endif @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) @can('update', $post)
<div class="mb-3"> <div class="ms-auto">
@livewire('post.form', ['post' => $post]) @livewire('post.form', ['post' => $post])
</div> </div>
@endcan @endcan
</div>
<p> <p>
{!! $post->trixRender('content') !!} {!! $post->trixRender('content') !!}
</p> </p>