Skip to content

Commit b4dfac4

Browse files
committed
Added feature for new post on tribute page
1 parent 26352d7 commit b4dfac4

File tree

2 files changed

+43
-31
lines changed

2 files changed

+43
-31
lines changed

resources/views/components/new-item.blade.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
@if(auth()->user()?->id === $user->id)
1+
@php
2+
$user = $user ?? auth()->user();
3+
@endphp
4+
5+
@if($user !== null)
26
<div {{ $attributes->merge(['class' => 'bg-body-tertiary rounded overflow-hidden my-5 px-4 px-md-5 py-4 position-relative'])->except(['user', 'link']) }}>
37
<div class="row align-items-center">
48
<div class="col-auto col">
@@ -14,7 +18,7 @@
1418
</div>
1519

1620
<div class="col-xxl-auto col-8 col-sm-6 ms-auto text-end">
17-
<a href="{{ $link }}" class="btn btn-outline-primary stretched-link">Новая запись</a>
21+
<a href="{{ $link }}" class="btn btn-outline-primary stretched-link">Опубликовать</a>
1822
</div>
1923
</div>
2024
</div>

resources/views/post/index.blade.php

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,36 @@
22
@extends('layout')
33

44
@section('content')
5+
6+
@empty(!$most)
7+
<x-container>
8+
<div class="row">
9+
<div class="col-xl-8 col-md-12 mx-auto hotwire-frame">
10+
<div class="d-flex flex-md-row flex-column px-4 px-xl-5 py-3 py-xl-4 bg-body-secondary rounded position-relative align-items-md-center">
11+
<div class="vr bg-primary position-absolute start-0 opacity-100" style="top: 1.5em; bottom: 1.5em;"></div>
12+
<x-icon path="i.tickets" width="2em" height="2em" class="d-none d-md-inline-block"/>
13+
14+
<div class="ms-md-4 mt-3 mt-md-0 col-md-6">
15+
<div class="d-flex align-items-center mb-3 mb-md-0">
16+
<x-icon path="i.tickets" width="2em" height="2em" class="d-md-none d-inline-block me-3"/>
17+
<h5 class="mb-0"><a href="{{ $most->link }}" class="link-body-emphasis stretched-link text-decoration-none">{{ $most->name }}</a></h5>
18+
</div>
19+
<time class="small">{{ $most->start_date->isoFormat('DD MMMM', 'Do MMMM') }}, начало в {{ $most->start_date->isoFormat('HH:mm', 'Do MMMM') }}</time>
20+
<small class="opacity-50 d-block">{{ $most->location }}</small>
21+
</div>
22+
23+
<div class="ms-auto d-none d-md-block">
24+
<a href="{{ $most->link }}" class="link-body-emphasis stretched-link text-decoration-none icon-link icon-link-hover">
25+
Принять участие
26+
<x-icon path="i.arrow-right" class="bi"/>
27+
</a>
28+
</div>
29+
</div>
30+
</div>
31+
</div>
32+
</x-container>
33+
@endempty
34+
535
<x-container>
636
<div class="col-xl-8 col-md-12 mx-auto">
737
<div class="p-4 p-xl-5 bg-body-secondary rounded position-relative">
@@ -15,35 +45,13 @@
1545
</x-container>
1646

1747

18-
@empty(!$most)
19-
<x-container>
20-
<div class="row">
21-
<div class="col-xl-8 col-md-12 mx-auto hotwire-frame">
22-
<div class="d-flex flex-md-row flex-column px-4 px-xl-5 py-3 py-xl-4 bg-body-secondary rounded position-relative align-items-md-center">
23-
<div class="vr bg-primary position-absolute start-0 opacity-100" style="top: 1.5em; bottom: 1.5em;"></div>
24-
<x-icon path="i.tickets" width="2em" height="2em" class="d-none d-md-inline-block"/>
25-
26-
<div class="ms-md-4 mt-3 mt-md-0 col-md-6">
27-
<div class="d-flex align-items-center mb-3 mb-md-0">
28-
<x-icon path="i.tickets" width="2em" height="2em" class="d-md-none d-inline-block me-3"/>
29-
<h5 class="mb-0"><a href="{{ $most->link }}" class="link-body-emphasis stretched-link text-decoration-none">{{ $most->name }}</a></h5>
30-
</div>
31-
<time class="small">{{ $most->start_date->isoFormat('DD MMMM', 'Do MMMM') }}, начало в {{ $most->start_date->isoFormat('HH:mm', 'Do MMMM') }}</time>
32-
<small class="opacity-50 d-block">{{ $most->location }}</small>
33-
</div>
34-
35-
<div class="ms-auto d-none d-md-block">
36-
<a href="{{ $most->link }}" class="link-body-emphasis stretched-link text-decoration-none icon-link icon-link-hover">
37-
Принять участие
38-
<x-icon path="i.arrow-right" class="bi"/>
39-
</a>
40-
</div>
41-
</div>
42-
</div>
43-
</div>
44-
</x-container>
45-
@endempty
46-
48+
@auth
49+
<x-container>
50+
<div class="col-xl-8 col-md-12 mx-auto">
51+
<x-new-item :link="route('post.create')"/>
52+
</div>
53+
</x-container>
54+
@endauth
4755

4856
<x-container>
4957
<div class="row">

0 commit comments

Comments
 (0)