|
| 1 | +<main class="py-4" style="min-height: 88vh"> |
| 2 | + <div class="container"> |
| 3 | + <section class="posts-section mb-2"> |
| 4 | + <h2 class="posts-section__header">Posts</h2> |
| 5 | + |
| 6 | + @if ($posts->count()) |
| 7 | + <div class="posts-section__posts row post"> |
| 8 | + @foreach($posts as $post) |
| 9 | + <div class="post__item col-md-6 "> |
| 10 | + <div class="post__intro text-break row py-2 no-gutters border rounded overflow-hidden flex-md-row mb-4 shadow-sm h-md-250 position-relative"> |
| 11 | + <div class="post__heading col-6 p-4 d-flex flex-column position-static" style="height: 280px;"> |
| 12 | + <strong class="d-inline-block mb-2 text-primary">Post #{{ $post->id }}</strong> |
| 13 | + |
| 14 | + <h3 class="post__name mb-0">{{ $post->name }}</h3> |
| 15 | + |
| 16 | + <div class="post__created-at mb-1 text-muted">{{ $post->created_at->toFormattedDateString() }}</div> |
| 17 | + |
| 18 | + <p class="post__preview card-text mb-auto text-justify"> {{ str_limit($post->text, $limit = 100, $end = '...') }} </p> |
| 19 | + |
| 20 | + @if($post->tags->isNotEmpty()) |
| 21 | + <div class="post__tags mb-2"> |
| 22 | + @foreach($post->tags as $tag) |
| 23 | + <span class="badge badge-info text-white">{{ $tag->name }}</span> |
| 24 | + @endforeach |
| 25 | + </div> |
| 26 | + @endif |
| 27 | + |
| 28 | + <a href="{{ route('posts.show', $post->id) }}" class="post__view">Continue reading</a> |
| 29 | + </div> |
| 30 | + |
| 31 | + <div class="post__photo col-6 d-none d-lg-flex align-items-center p-2"> |
| 32 | + <svg class="bd-placeholder-img" width="auto" height="250" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" focusable="false" role="img" aria-label="Placeholder: Thumbnail"> |
| 33 | + <title>Placeholder</title> |
| 34 | + <rect width="100%" height="100%" fill="#55595c"></rect> |
| 35 | + <text x="35%" y="50%" fill="#eceeef" dy=".3em">Thumbnail</text> |
| 36 | + </svg> |
| 37 | + </div> |
| 38 | + |
| 39 | + <div class="d-flex col-12 justify-content-end pr-2"> |
| 40 | + <a href="{{ route('posts.edit', $post) }}" class="btn btn-outline-secondary" style="width: 80px; font-size: 0.7rem">Edit</a> |
| 41 | + |
| 42 | + <form method="post" action="{{ route('posts.destroy', $post) }}"> |
| 43 | + @csrf |
| 44 | + @method('DELETE') |
| 45 | + <button type="submit" class="btn btn-outline-secondary" style="width: 80px; font-size: 0.7rem">Delete</button> |
| 46 | + </form> |
| 47 | + </div> |
| 48 | + </div> |
| 49 | + </div> |
| 50 | + @endforeach |
| 51 | + </div> |
| 52 | + @else |
| 53 | + <p class="no-posts">No available posts yet</p> |
| 54 | + @endif |
| 55 | + </section> |
| 56 | + </div> |
| 57 | +</main> |
0 commit comments