From 84e92c366d891cf46c50a7fc00fbaa993bee0a6f Mon Sep 17 00:00:00 2001 From: Tony Messias Date: Mon, 4 Sep 2023 23:41:38 -0300 Subject: [PATCH] Add some basic styles to the workbench app --- .../Http/Controllers/ArticlesController.php | 2 +- .../views/articles/_article.blade.php | 18 +++++++----- .../views/articles/_article_card.blade.php | 8 +++-- .../articles/_create_article_link.blade.php | 12 ++++++-- .../resources/views/articles/_form.blade.php | 29 +++++++++++++++++++ .../resources/views/articles/create.blade.php | 28 +++--------------- .../resources/views/articles/delete.blade.php | 14 ++++----- .../resources/views/articles/edit.blade.php | 25 +--------------- .../resources/views/articles/index.blade.php | 4 +-- .../resources/views/articles/show.blade.php | 6 ++-- .../resources/views/components/app.blade.php | 7 ++++- 11 files changed, 78 insertions(+), 75 deletions(-) create mode 100644 workbench/resources/views/articles/_form.blade.php diff --git a/workbench/app/Http/Controllers/ArticlesController.php b/workbench/app/Http/Controllers/ArticlesController.php index 84c4686..b9eae51 100644 --- a/workbench/app/Http/Controllers/ArticlesController.php +++ b/workbench/app/Http/Controllers/ArticlesController.php @@ -39,7 +39,7 @@ public function store(Request $request) turbo_stream()->prepend('articles', view('articles._article_card', [ 'article' => $article, ])), - turbo_stream()->replace('create_article', view('articles._create_article_link')), + turbo_stream()->replace('create_article_details', view('articles._create_article_link')), ]); } diff --git a/workbench/resources/views/articles/_article.blade.php b/workbench/resources/views/articles/_article.blade.php index 8e7f41a..72e23a9 100644 --- a/workbench/resources/views/articles/_article.blade.php +++ b/workbench/resources/views/articles/_article.blade.php @@ -1,12 +1,14 @@ - -

{{ $article->title }}

+ +

{{ $article->title }}

-

{{ $article->content }}

+

{{ $article->content }}

-

{{ __('Actions') }}

+
diff --git a/workbench/resources/views/articles/_article_card.blade.php b/workbench/resources/views/articles/_article_card.blade.php index e821223..9c06efa 100644 --- a/workbench/resources/views/articles/_article_card.blade.php +++ b/workbench/resources/views/articles/_article_card.blade.php @@ -1,3 +1,7 @@ -
-

{{ $article->title }} - {{ __('View') }}

+
+

{{ $article->title }}

+ + + {{ __('View') }} +
diff --git a/workbench/resources/views/articles/_create_article_link.blade.php b/workbench/resources/views/articles/_create_article_link.blade.php index 641cadc..cc13018 100644 --- a/workbench/resources/views/articles/_create_article_link.blade.php +++ b/workbench/resources/views/articles/_create_article_link.blade.php @@ -1,3 +1,9 @@ - - {{ __('New Article') }} - +
+ + {{ __('New Article') }} + + + +

{{ __('Loading...') }}

+
+
diff --git a/workbench/resources/views/articles/_form.blade.php b/workbench/resources/views/articles/_form.blade.php new file mode 100644 index 0000000..5761c3a --- /dev/null +++ b/workbench/resources/views/articles/_form.blade.php @@ -0,0 +1,29 @@ +
+ @if ($article->exists ?? false) + @method('PUT') + @endif + +
+ + + @error('title') + {{ $message }} + @enderror +
+ +
+ + + @error('content') + {{ $message }} + @enderror +
+ +
+ @if ($article?->exists) + {{ __('Cancel') }} + @endif + + +
+
diff --git a/workbench/resources/views/articles/create.blade.php b/workbench/resources/views/articles/create.blade.php index 330dc73..d040431 100644 --- a/workbench/resources/views/articles/create.blade.php +++ b/workbench/resources/views/articles/create.blade.php @@ -1,35 +1,15 @@ {{ __('New Article') }} -

{{ __('New Article') }}

+

{{ __('New Article') }}

-
- {{ __('Back to Index') }} +
-
-
- - - @error('title') - {{ $message }} - @enderror -
- -
- - - @error('content') - {{ $message }} - @enderror -
- -
- -
-
+ @include('articles._form', ['article' => null])
diff --git a/workbench/resources/views/articles/delete.blade.php b/workbench/resources/views/articles/delete.blade.php index b5088c1..f376619 100644 --- a/workbench/resources/views/articles/delete.blade.php +++ b/workbench/resources/views/articles/delete.blade.php @@ -1,10 +1,10 @@ {{ __('Delete Article') }} -

{{ __('Delete Article') }}

+

{{ __('Delete Article') }}

-
- {{ __('Back to Article') }} +
+ {{ __('Back to Article') }}

{{ __('My cookie: :value.', ['value' => request()->cookie('my-cookie', 'no-cookie')]) }}

{{ __('Response cookie: :value.', ['value' => request()->cookie('response-cookie', 'no-cookie')]) }}

@@ -14,12 +14,12 @@
@method('DELETE') -

{{ __('Are you sure you wanna delete this article?') }}

+

{{ __('Are you sure you wanna delete this article?') }}

-
- {{ __('No, cancel.') }} +
+ {{ __('No, cancel.') }} - +
diff --git a/workbench/resources/views/articles/edit.blade.php b/workbench/resources/views/articles/edit.blade.php index fd12696..18bccb6 100644 --- a/workbench/resources/views/articles/edit.blade.php +++ b/workbench/resources/views/articles/edit.blade.php @@ -14,29 +14,6 @@
-
- @method('PUT') - -
- - - @error('title') - {{ $message }} - @enderror -
- -
- - - @error('content') - {{ $message }} - @enderror -
- -
- {{ __('Cancel') }} - -
-
+ @include('articles._form', ['article' => $article])
diff --git a/workbench/resources/views/articles/index.blade.php b/workbench/resources/views/articles/index.blade.php index 309e830..35d1bad 100644 --- a/workbench/resources/views/articles/index.blade.php +++ b/workbench/resources/views/articles/index.blade.php @@ -1,11 +1,11 @@ {{ __('Articles') }} -

{{ __('Articles Index') }}

+

{{ __('Articles Index') }}

@include('articles._create_article_link') -
+
@each('articles._article_card', $articles, 'article')
diff --git a/workbench/resources/views/articles/show.blade.php b/workbench/resources/views/articles/show.blade.php index 081778e..3f83bf2 100644 --- a/workbench/resources/views/articles/show.blade.php +++ b/workbench/resources/views/articles/show.blade.php @@ -1,11 +1,11 @@ {{ $article->title }} -

{{ __('View Article') }}

+

{{ __('View Article') }}

-
+
@unlessturbonative - {{ __('Back to Index') }} + {{ __('Back to Index') }} @endturbonative @turbonative diff --git a/workbench/resources/views/components/app.blade.php b/workbench/resources/views/components/app.blade.php index 3931285..17a074a 100644 --- a/workbench/resources/views/components/app.blade.php +++ b/workbench/resources/views/components/app.blade.php @@ -9,12 +9,17 @@ {{ $head ?? null }} + {{-- Use Tailwind CDN --}} + + {{-- Install Turbo via CDN --}} - {{ $slot }} +
+ {{ $slot }} +