diff --git a/app/Models/Film.php b/app/Models/Film.php index ae3bd7c..c181f22 100644 --- a/app/Models/Film.php +++ b/app/Models/Film.php @@ -71,4 +71,10 @@ class Film extends Model public function scopeSuggested($query) { return $query->whereNull('seen')->whereNull('rejected')->orderBy('updated_at', 'DESC'); } + + public function userMayEvaluate(int $userid) { + if(is_null($this->seen)) return false; + if($this->comments()->where('user', $userid)->where('evaluation', '>', 0)->count() > 0) return false; + return true; + } } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 77277ed..93b6baf 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -17,7 +17,7 @@ class RouteServiceProvider extends ServiceProvider * * @var string */ - public const HOME = '/dashboard'; + public const HOME = '/'; /** * Define your route model bindings, pattern filters, etc. diff --git a/public/css/app.css b/public/css/app.css index 13ac212..6534857 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -643,12 +643,12 @@ select { .top-0 { top: 0px; } -.right-0 { - right: 0px; -} .left-0 { left: 0px; } +.right-0 { + right: 0px; +} .z-0 { z-index: 0; } @@ -670,9 +670,6 @@ select { .clear-both { clear: both; } -.m-4 { - margin: 1rem; -} .mx-auto { margin-left: auto; margin-right: auto; @@ -723,6 +720,12 @@ select { .mt-2 { margin-top: 0.5rem; } +.mr-1 { + margin-right: 0.25rem; +} +.mb-1 { + margin-bottom: 0.25rem; +} .mt-3 { margin-top: 0.75rem; } @@ -744,20 +747,11 @@ select { .-mr-2 { margin-right: -0.5rem; } -.mr-1 { - margin-right: 0.25rem; -} -.mb-1 { - margin-bottom: 0.25rem; -} .ml-\[4\.5rem\] { margin-left: 4.5rem; } -.mb-10 { - margin-bottom: 2.5rem; -} -.mb-12 { - margin-bottom: 3rem; +.mb-8 { + margin-bottom: 2rem; } .block { display: block; @@ -795,6 +789,9 @@ select { .h-40 { height: 10rem; } +.h-full { + height: 100%; +} .h-8 { height: 2rem; } @@ -807,9 +804,6 @@ select { .h-4 { height: 1rem; } -.h-full { - height: 100%; -} .max-h-7 { max-height: 1.75rem; } @@ -822,8 +816,11 @@ select { .min-h-screen { min-height: 100vh; } -.min-h-\[4rem\] { - min-height: 4rem; +.min-h-\[6rem\] { + min-height: 6rem; +} +.min-h-\[5rem\] { + min-height: 5rem; } .w-5 { width: 1.25rem; @@ -846,11 +843,6 @@ select { .w-4 { width: 1rem; } -.w-fit { - width: -webkit-fit-content; - width: -moz-fit-content; - width: fit-content; -} .w-80 { width: 20rem; } @@ -866,29 +858,24 @@ select { .w-48 { width: 12rem; } -.w-max { - width: -webkit-max-content; - width: -moz-max-content; - width: max-content; -} .max-w-7xl { max-width: 80rem; } .max-w-md { max-width: 28rem; } -.max-w-xl { - max-width: 36rem; -} -.max-w-6xl { - max-width: 72rem; -} .max-w-xs { max-width: 20rem; } .max-w-\[100px\] { max-width: 100px; } +.max-w-xl { + max-width: 36rem; +} +.max-w-6xl { + max-width: 72rem; +} .flex-1 { flex: 1 1 0%; } @@ -982,6 +969,11 @@ select { margin-right: calc(0.25rem * var(--tw-space-x-reverse)); margin-left: calc(0.25rem * calc(1 - var(--tw-space-x-reverse))); } +.space-x-2 > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(0.5rem * var(--tw-space-x-reverse)); + margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse))); +} .space-x-8 > :not([hidden]) ~ :not([hidden]) { --tw-space-x-reverse: 0; margin-right: calc(2rem * var(--tw-space-x-reverse)); @@ -992,11 +984,6 @@ select { margin-top: calc(0.25rem * calc(1 - var(--tw-space-y-reverse))); margin-bottom: calc(0.25rem * var(--tw-space-y-reverse)); } -.space-x-2 > :not([hidden]) ~ :not([hidden]) { - --tw-space-x-reverse: 0; - margin-right: calc(0.5rem * var(--tw-space-x-reverse)); - margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse))); -} .overflow-hidden { overflow: hidden; } @@ -1106,14 +1093,14 @@ select { --tw-bg-opacity: 1; background-color: rgb(104 79 67 / var(--tw-bg-opacity)); } -.bg-gray-100 { - --tw-bg-opacity: 1; - background-color: rgb(243 244 246 / var(--tw-bg-opacity)); -} .bg-burnt { --tw-bg-opacity: 1; background-color: rgb(212 81 19 / var(--tw-bg-opacity)); } +.bg-gray-100 { + --tw-bg-opacity: 1; + background-color: rgb(243 244 246 / var(--tw-bg-opacity)); +} .fill-current { fill: currentColor; } @@ -1165,6 +1152,12 @@ select { padding-top: 0.25rem; padding-bottom: 0.25rem; } +.pl-6 { + padding-left: 1.5rem; +} +.pb-2 { + padding-bottom: 0.5rem; +} .pt-1 { padding-top: 0.25rem; } @@ -1192,12 +1185,6 @@ select { .pb-1 { padding-bottom: 0.25rem; } -.pl-6 { - padding-left: 1.5rem; -} -.pb-2 { - padding-bottom: 0.5rem; -} .text-center { text-align: center; } @@ -1306,6 +1293,10 @@ select { --tw-text-opacity: 1; color: rgb(255 255 255 / var(--tw-text-opacity)); } +.text-coal { + --tw-text-opacity: 1; + color: rgb(40 32 29 / var(--tw-text-opacity)); +} .text-red-600 { --tw-text-opacity: 1; color: rgb(220 38 38 / var(--tw-text-opacity)); @@ -1338,10 +1329,6 @@ select { --tw-text-opacity: 1; color: rgb(17 24 39 / var(--tw-text-opacity)); } -.text-coal { - --tw-text-opacity: 1; - color: rgb(40 32 29 / var(--tw-text-opacity)); -} .text-gray-800 { --tw-text-opacity: 1; color: rgb(31 41 55 / var(--tw-text-opacity)); @@ -1459,14 +1446,14 @@ select { --tw-bg-opacity: 1; background-color: rgb(212 81 19 / var(--tw-bg-opacity)); } -.hover\:bg-coal:hover { - --tw-bg-opacity: 1; - background-color: rgb(40 32 29 / var(--tw-bg-opacity)); -} .hover\:bg-crayola:hover { --tw-bg-opacity: 1; background-color: rgb(246 245 174 / var(--tw-bg-opacity)); } +.hover\:bg-coal:hover { + --tw-bg-opacity: 1; + background-color: rgb(40 32 29 / var(--tw-bg-opacity)); +} .hover\:bg-field:hover { --tw-bg-opacity: 1; background-color: rgb(104 79 67 / var(--tw-bg-opacity)); @@ -1495,10 +1482,6 @@ select { --tw-text-opacity: 1; color: rgb(17 24 39 / var(--tw-text-opacity)); } -.hover\:text-fogra:hover { - --tw-text-opacity: 1; - color: rgb(16 14 12 / var(--tw-text-opacity)); -} .focus\:z-10:focus { z-index: 10; } @@ -1637,11 +1620,6 @@ select { margin-bottom: -1px; } - .sm\:mx-4 { - margin-left: 1rem; - margin-right: 1rem; - } - .sm\:mr-2 { margin-right: 0.5rem; } @@ -1650,14 +1628,14 @@ select { margin-left: 1.5rem; } - .sm\:ml-10 { - margin-left: 2.5rem; - } - .sm\:ml-0 { margin-left: 0px; } + .sm\:ml-10 { + margin-left: 2.5rem; + } + .sm\:block { display: block; } @@ -1786,10 +1764,6 @@ select { margin-left: 1.5rem; } - .lg\:mr-6 { - margin-right: 1.5rem; - } - .lg\:w-1\/4 { width: 25%; } diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index 025a79a..cc83f71 100644 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -1,16 +1,29 @@ -

- {{ __('Dashboard') }} +

+ {{ __('Einstellungen') }}

-
-
-
- You're logged in! -
+
+ + + +

+ Passwort +

+ +
+ Zum Ändern des Passworts, Abmelden und "Passwort vergessen" Funktion benutzen. +
+ +

+ Avatar +

+ +
+ TBA
diff --git a/resources/views/film.blade.php b/resources/views/film.blade.php index 4afb50b..d8d8551 100644 --- a/resources/views/film.blade.php +++ b/resources/views/film.blade.php @@ -243,14 +243,18 @@ Kommentare -
+
@if (is_null(auth()->user()))

Melde Dich an, um diesen Film zu kommentieren.

@else -
+ +
User Avatar
+
+ @csrf

Neuer Kommentar

+ @if($film->userMayEvaluate(auth()->user()->id))

Bewerten:

@@ -304,14 +308,17 @@
+
- + @endif + Absenden +
@endif @foreach ($film->comments()->orderBy('created_at', 'DESC')->get() as $comment) -
+
{{ $comment->author->name }} Avatar

{{ $comment->author->name }} @@ -336,6 +343,8 @@

{{ $comment->body }}

+
+ @csrf @if($comment->evaluation > 0)
@@ -390,10 +399,12 @@
+
@endif - + Speichern +

@else

{{ $comment->body }}

diff --git a/resources/views/layouts/navigation.blade.php b/resources/views/layouts/navigation.blade.php index 1ef6644..a84d0fb 100644 --- a/resources/views/layouts/navigation.blade.php +++ b/resources/views/layouts/navigation.blade.php @@ -44,11 +44,13 @@
@csrf - + + {{ __('Einstellungen') }} + - {{ __('Log Out') }} + {{ __('Abmelden') }}
@@ -97,6 +99,9 @@
+ + {{ __('Einstellungen') }} +
@csrf @@ -104,7 +109,7 @@ - {{ __('Log Out') }} + {{ __('Abmelden') }}
diff --git a/routes/auth.php b/routes/auth.php index 54c9ae1..b47eeb9 100644 --- a/routes/auth.php +++ b/routes/auth.php @@ -8,6 +8,7 @@ use App\Http\Controllers\Auth\NewPasswordController; use App\Http\Controllers\Auth\PasswordResetLinkController; use App\Http\Controllers\Auth\RegisteredUserController; use App\Http\Controllers\Auth\VerifyEmailController; +use Illuminate\Support\Facades\Request; use Illuminate\Support\Facades\Route; Route::middleware('guest')->group(function () { diff --git a/routes/web.php b/routes/web.php index 62e7e99..e82055e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -4,16 +4,16 @@ use App\Models\Film; use Illuminate\Support\Facades\Route; use Tmdb\Repository\MovieRepository; use App\Http\Helpers\TmdbProvider; +use App\Models\Comment; use App\Models\Setting; use Tmdb\Helper\ImageHelper; use Tmdb\Repository\ConfigurationRepository; use Tmdb\Repository\SearchRepository; use App\Models\News; use App\Models\Vote; -use Hamcrest\Core\Set; -use Symfony\Component\EventDispatcher\EventDispatcher; -use Tmdb\Event\Listener\HydrationListener; use Tmdb\Model\Search\SearchQuery\MovieSearchQuery; +use Illuminate\Http\Request; +use Illuminate\Support\Facades\Auth; /* |-------------------------------------------------------------------------- @@ -225,4 +225,26 @@ Route::get('/vorschlag/{id}/vorschlagen', function($id) { })->middleware(['auth']); +Route::post('/comment/new/{film}', function($film, Request $request) { + $c = new Comment(); + $c->film = $film; + $c->user = Auth::user()->id; + $c->body = $request->input('body', ''); + if(is_null($c->body)) $c->body = ""; + $c->evaluation = $request->input('vote', 0); + $c->save(); + + return redirect("/film/" . $film)->with('status', auth()->user()->name . ', Kommentar/Bewertung hinzugefügt.'); +})->middleware(['auth']); + +Route::post('/comment/edit/{comment}', function($comment, Request $request) { + $c = Comment::findOrFail($comment); + $c->body = $request->input('body', ''); + if(is_null($c->body)) $c->body = ""; + $c->evaluation = $request->input('vote', $c->evaluation); + $c->save(); + + return redirect("/film/" . $c->film)->with('status', auth()->user()->name . ', Kommentar/Bewertung hinzugefügt.'); +})->middleware(['auth']); + require __DIR__.'/auth.php';