Kommentieren und Bewerten hinzugefügt. Einstellungsseite hinzufügt (macht noch nichts).
This commit is contained in:
@@ -243,14 +243,18 @@
|
||||
Kommentare
|
||||
</h2>
|
||||
|
||||
<div class="px-2">
|
||||
<div class="px-2" x-data="{xnew: false, comments: {{$film->comments->count()}}}">
|
||||
@if (is_null(auth()->user()))
|
||||
<p>Melde Dich an, um diesen Film zu kommentieren.</p>
|
||||
@else
|
||||
<div>
|
||||
<button x-show="comments > 0" class="text-yelmax float-right" @@click="xnew = !xnew" x-text="xnew ? 'Abbrechen' : '+ Kommentar und Bewertung hinzufügen'"></button>
|
||||
<div x-show="xnew || comments < 1" x-transition>
|
||||
<img src="/avatar/{{ auth()->user()->getAvatar() }}" alt="User Avatar" class="rounded-lg w-16 float-left mr-2">
|
||||
<div class="">
|
||||
<form method="POST" action="/comment/new/{{ $film->id }}/">
|
||||
@csrf
|
||||
<h4 class="font-semibold">Neuer Kommentar</h4>
|
||||
@if($film->userMayEvaluate(auth()->user()->id))
|
||||
<div class="flex" x-data="{ stars: 0 }">
|
||||
<input type="hidden" name="vote" id="vote" x-bind:value="stars">
|
||||
<p @@click="stars = 0">Bewerten: </p>
|
||||
@@ -304,14 +308,17 @@
|
||||
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
|
||||
</svg>
|
||||
</div>
|
||||
<span x-text="' (' + stars + ')'"></span>
|
||||
</div>
|
||||
<textarea class="block w-[calc(100%-4.5rem)] my-1 rounded-lg border-1 border-field bg-coal"></textarea>
|
||||
@endif
|
||||
<textarea name="body" id="body" class="block w-[calc(100%-4.5rem)] my-1 rounded-lg border-1 border-field bg-coal"></textarea>
|
||||
<x-button class="ml-[4.5rem]">Absenden</x-button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@foreach ($film->comments()->orderBy('created_at', 'DESC')->get() as $comment)
|
||||
<div class="clear-left my-2 min-h-[4rem]" x-data="{edit: false}">
|
||||
<div class="clear-left my-2 min-h-[5rem]" x-data="{edit: false}">
|
||||
<img src="/avatar/{{ $comment->author->getAvatar() }}" alt="{{ $comment->author->name }} Avatar" class="rounded-lg w-16 float-left mr-2">
|
||||
<h4 class="font-bold">
|
||||
{{ $comment->author->name }}
|
||||
@@ -336,6 +343,8 @@
|
||||
<button class="text-yelmax float-right" @@click="edit = !edit" x-text="edit ? 'Abbrechen' : 'Bearbeiten'"></button>
|
||||
<p x-show="!edit" x-transition>{{ $comment->body }}</p>
|
||||
<div x-show="edit" x-transition>
|
||||
<form method="post" action="/comment/edit/{{ $comment->id }}">
|
||||
@csrf
|
||||
@if($comment->evaluation > 0)
|
||||
<div class="flex" x-data="{ stars: {{ $comment->evaluation }} }">
|
||||
<input type="hidden" name="vote" id="vote" x-bind:value="stars">
|
||||
@@ -390,10 +399,12 @@
|
||||
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z" />
|
||||
</svg>
|
||||
</div>
|
||||
<span x-text="' (' + stars + ')'"></span>
|
||||
</div>
|
||||
@endif
|
||||
<textarea class="block w-[calc(100%-4.5rem)] my-1 rounded-lg border-1 border-field bg-coal">{{ $comment->body }}</textarea>
|
||||
<textarea name="body" id="body" class="block w-[calc(100%-4.5rem)] my-1 rounded-lg border-1 border-field bg-coal">{{ $comment->body }}</textarea>
|
||||
<x-button class="ml-[4.5rem]">Speichern</x-button>
|
||||
</form>
|
||||
</div>
|
||||
@else
|
||||
<p>{{ $comment->body }}</p>
|
||||
|
||||
Reference in New Issue
Block a user