From 2652e95467c9b74fe7c6185f33d336c90b54e9e8 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 31 Dec 2022 00:39:51 -0700 Subject: [PATCH] Update newsroom --- app/Http/Controllers/AdminController.php | 12 +- resources/views/admin/newsroom/edit.blade.php | 189 ++++++++---------- resources/views/admin/newsroom/home.blade.php | 131 +++++++----- 3 files changed, 170 insertions(+), 162 deletions(-) diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 24faacf7e..32b27939d 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -264,6 +264,10 @@ class AdminController extends Controller ]); $changed = false; $changedFields = []; + $slug = str_slug($request->input('title')); + if(Newsroom::whereSlug($slug)->exists()) { + $slug = $slug . '-' . str_random(4); + } $news = Newsroom::findOrFail($id); $fields = [ 'title' => 'string', @@ -281,7 +285,7 @@ class AdminController extends Controller case 'string': if($request->{$field} != $news->{$field}) { if($field == 'title') { - $news->slug = str_slug($request->{$field}); + $news->slug = $slug; } $news->{$field} = $request->{$field}; $changed = true; @@ -327,6 +331,10 @@ class AdminController extends Controller ]); $changed = false; $changedFields = []; + $slug = str_slug($request->input('title')); + if(Newsroom::whereSlug($slug)->exists()) { + $slug = $slug . '-' . str_random(4); + } $news = new Newsroom(); $fields = [ 'title' => 'string', @@ -344,7 +352,7 @@ class AdminController extends Controller case 'string': if($request->{$field} != $news->{$field}) { if($field == 'title') { - $news->slug = str_slug($request->{$field}); + $news->slug = $slug; } $news->{$field} = $request->{$field}; $changed = true; diff --git a/resources/views/admin/newsroom/edit.blade.php b/resources/views/admin/newsroom/edit.blade.php index c98a23378..3687a2a9c 100644 --- a/resources/views/admin/newsroom/edit.blade.php +++ b/resources/views/admin/newsroom/edit.blade.php @@ -1,114 +1,81 @@ @extends('admin.partial.template-full') @section('section') -
-
-
+
+
+
+
+
+
+

Newsroom - Edit

+

Editing #{{$news->id}}

+
-
-

Newsroom

-

Edit Announcement

-
- -
-
-
-
-
-
- @csrf -
- - -

We recommend titles shorter than 80 characters.

-
-
- - -
-
- - -

Click here to enable the rich text editor.

-
-
- - -
-
- -
-
- -
-
-
- {{$news->title}} - -
-

- {{$news->summary}} -

-

- Read more - - - - - - - - - - - -

-
-
-
-

- -

-
-
- published_at ? 'checked="checked"' : ''}}> - -
-
-
-
- show_timeline ? 'checked="checked"' : ''}}> - -
-
-
-
- auth_only ? 'checked="checked"' : ''}}> - -
-
-
-
- show_link ? 'checked="checked"' : ''}}> - -
-
- {{--
-
- force_modal ? 'checked="checked"' : ''}}> - -
-
--}} -
- -

- - -

- -
+
+
+ + @if($news->published_at) + View + @endif + +
+
+
+
+
+
+
+
+
+
+
+ @csrf +
+ + +

We recommend titles shorter than 80 characters.

+
+
+ + +
+
+ + +
+
+ + +
+ +
+
+ published_at ? 'checked="checked"' : ''}}> + +
+
+
+
+ show_timeline ? 'checked="checked"' : ''}}> + +
+
+
+
+ auth_only ? 'checked="checked"' : ''}}> + +
+
+
+
+ show_link ? 'checked="checked"' : ''}}> + +
+
+
+
+
+
@method('delete') @@ -118,6 +85,12 @@ @push('scripts') -@endpush \ No newline at end of file +@endpush diff --git a/resources/views/admin/newsroom/home.blade.php b/resources/views/admin/newsroom/home.blade.php index 78976bd71..ce557a9be 100644 --- a/resources/views/admin/newsroom/home.blade.php +++ b/resources/views/admin/newsroom/home.blade.php @@ -1,62 +1,89 @@ @extends('admin.partial.template-full') @section('section') -
- -
-

Newsroom

-

Manage News and Platform Tips

-
+
+
+
+
+
+
+

Newsroom

+

Manage News and Platform Tips

+
- + +
+
+
-
-
-
-
- Announcements -
- @if($newsroom->count() > 0) -
    - @foreach($newsroom as $news) -
  • -
    -

    {{str_limit($news->title,30)}}

    -

    {{str_limit($news->summary, 40)}}

    -
    -
    - @if($news->published_at != null) - PUBLISHED - @else - DRAFT - @endif - - - - @if($news->published_at) - - - - @endif -
    -
  • - @endforeach -
- @else -
-

No Announcements Found!

-
- @endif -
-
- {!!$newsroom->links()!!} -
-
+
+
+
+ @if($newsroom->count() > 0) +
+ + + + + + + + + + + + @foreach($newsroom as $news) + + + + + + + + @endforeach + +
IDTitleSlugStatusUpdated
+ + {{ $news->id }} + + +
+

{{str_limit($news->title, 50)}}

+ {{--

{{str_limit($news->summary, 80)}}

--}} +
+
+ @if($news->published_at) + {{$news->slug}} + @else + {{ $news->slug }} + @endif + + @if($news->published_at != null) + PUBLISHED + @else + DRAFT + @endif + + {{ $news->updated_at->diffForHumans() }} +
+
+
+ {!!$newsroom->links()!!} +
+ @else +
+

No Announcements Found!

+
+ @endif +
+
@endsection