From 057d7be0bc7eb7bc6b62136da6e98c199f82f12f Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sun, 8 Feb 2026 17:03:48 +0000 Subject: [PATCH] Views: Made index/show sidebars a lot more modular Split out each sidebar block into their own template for easier customization of those elements, and less code to manage when overriding the parent show/index views. --- resources/views/books/index.blade.php | 55 +----- .../index-sidebar-section-actions.blade.php | 25 +++ .../parts/index-sidebar-section-new.blade.php | 8 + .../index-sidebar-section-popular.blade.php | 8 + .../index-sidebar-section-recents.blade.php | 6 + .../show-sidebar-section-actions.blade.php | 61 +++++++ .../show-sidebar-section-activity.blade.php | 6 + .../show-sidebar-section-details.blade.php | 21 +++ .../show-sidebar-section-shelves.blade.php | 6 + .../parts/show-sidebar-section-tags.blade.php | 5 + resources/views/books/show.blade.php | 110 +----------- .../show-sidebar-section-actions.blade.php | 65 ++++++++ .../show-sidebar-section-details.blade.php | 38 +++++ .../parts/show-sidebar-section-tags.blade.php | 5 + resources/views/chapters/show.blade.php | 116 +------------ .../show-sidebar-section-actions.blade.php | 57 +++++++ ...show-sidebar-section-attachments.blade.php | 8 + .../show-sidebar-section-details.blade.php | 61 +++++++ .../show-sidebar-section-page-nav.blade.php | 15 ++ .../parts/show-sidebar-section-tags.blade.php | 5 + resources/views/pages/show.blade.php | 156 +----------------- resources/views/shelves/index.blade.php | 48 +----- .../index-sidebar-section-actions.blade.php | 18 ++ .../parts/index-sidebar-section-new.blade.php | 8 + .../index-sidebar-section-popular.blade.php | 8 + .../index-sidebar-section-recents.blade.php | 6 + .../show-sidebar-section-actions.blade.php | 43 +++++ .../show-sidebar-section-activity.blade.php | 6 + .../show-sidebar-section-details.blade.php | 21 +++ .../parts/show-sidebar-section-tags.blade.php | 5 + resources/views/shelves/show.blade.php | 82 +-------- 31 files changed, 540 insertions(+), 542 deletions(-) create mode 100644 resources/views/books/parts/index-sidebar-section-actions.blade.php create mode 100644 resources/views/books/parts/index-sidebar-section-new.blade.php create mode 100644 resources/views/books/parts/index-sidebar-section-popular.blade.php create mode 100644 resources/views/books/parts/index-sidebar-section-recents.blade.php create mode 100644 resources/views/books/parts/show-sidebar-section-actions.blade.php create mode 100644 resources/views/books/parts/show-sidebar-section-activity.blade.php create mode 100644 resources/views/books/parts/show-sidebar-section-details.blade.php create mode 100644 resources/views/books/parts/show-sidebar-section-shelves.blade.php create mode 100644 resources/views/books/parts/show-sidebar-section-tags.blade.php create mode 100644 resources/views/chapters/parts/show-sidebar-section-actions.blade.php create mode 100644 resources/views/chapters/parts/show-sidebar-section-details.blade.php create mode 100644 resources/views/chapters/parts/show-sidebar-section-tags.blade.php create mode 100644 resources/views/pages/parts/show-sidebar-section-actions.blade.php create mode 100644 resources/views/pages/parts/show-sidebar-section-attachments.blade.php create mode 100644 resources/views/pages/parts/show-sidebar-section-details.blade.php create mode 100644 resources/views/pages/parts/show-sidebar-section-page-nav.blade.php create mode 100644 resources/views/pages/parts/show-sidebar-section-tags.blade.php create mode 100644 resources/views/shelves/parts/index-sidebar-section-actions.blade.php create mode 100644 resources/views/shelves/parts/index-sidebar-section-new.blade.php create mode 100644 resources/views/shelves/parts/index-sidebar-section-popular.blade.php create mode 100644 resources/views/shelves/parts/index-sidebar-section-recents.blade.php create mode 100644 resources/views/shelves/parts/show-sidebar-section-actions.blade.php create mode 100644 resources/views/shelves/parts/show-sidebar-section-activity.blade.php create mode 100644 resources/views/shelves/parts/show-sidebar-section-details.blade.php create mode 100644 resources/views/shelves/parts/show-sidebar-section-tags.blade.php diff --git a/resources/views/books/index.blade.php b/resources/views/books/index.blade.php index 52d23241a..660c008df 100644 --- a/resources/views/books/index.blade.php +++ b/resources/views/books/index.blade.php @@ -5,58 +5,11 @@ @stop @section('left') - @if($recents) -
-
{{ trans('entities.recently_viewed') }}
- @include('entities.list', ['entities' => $recents, 'style' => 'compact']) -
- @endif - - - -
-
{{ trans('entities.books_new') }}
- @if(count($new) > 0) - @include('entities.list', ['entities' => $new, 'style' => 'compact']) - @else -

{{ trans('entities.books_new_empty') }}

- @endif -
+ @include('books.parts.index-sidebar-section-recents', ['recents' => $recents]) + @include('books.parts.index-sidebar-section-popular', ['popular' => $popular]) + @include('books.parts.index-sidebar-section-new', ['new' => $new]) @stop @section('right') - -
-
{{ trans('common.actions') }}
- -
- + @include('books.parts.index-sidebar-section-actions', ['view' => $view]) @stop diff --git a/resources/views/books/parts/index-sidebar-section-actions.blade.php b/resources/views/books/parts/index-sidebar-section-actions.blade.php new file mode 100644 index 000000000..8f8b254c8 --- /dev/null +++ b/resources/views/books/parts/index-sidebar-section-actions.blade.php @@ -0,0 +1,25 @@ +
+
{{ trans('common.actions') }}
+ +
\ No newline at end of file diff --git a/resources/views/books/parts/index-sidebar-section-new.blade.php b/resources/views/books/parts/index-sidebar-section-new.blade.php new file mode 100644 index 000000000..a9aa52c59 --- /dev/null +++ b/resources/views/books/parts/index-sidebar-section-new.blade.php @@ -0,0 +1,8 @@ +
+
{{ trans('entities.books_new') }}
+ @if(count($new) > 0) + @include('entities.list', ['entities' => $new, 'style' => 'compact']) + @else +

{{ trans('entities.books_new_empty') }}

+ @endif +
\ No newline at end of file diff --git a/resources/views/books/parts/index-sidebar-section-popular.blade.php b/resources/views/books/parts/index-sidebar-section-popular.blade.php new file mode 100644 index 000000000..030c75eb9 --- /dev/null +++ b/resources/views/books/parts/index-sidebar-section-popular.blade.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/resources/views/books/parts/index-sidebar-section-recents.blade.php b/resources/views/books/parts/index-sidebar-section-recents.blade.php new file mode 100644 index 000000000..f1a68ba4f --- /dev/null +++ b/resources/views/books/parts/index-sidebar-section-recents.blade.php @@ -0,0 +1,6 @@ +@if($recents) +
+
{{ trans('entities.recently_viewed') }}
+ @include('entities.list', ['entities' => $recents, 'style' => 'compact']) +
+@endif \ No newline at end of file diff --git a/resources/views/books/parts/show-sidebar-section-actions.blade.php b/resources/views/books/parts/show-sidebar-section-actions.blade.php new file mode 100644 index 000000000..8e5b5c4d7 --- /dev/null +++ b/resources/views/books/parts/show-sidebar-section-actions.blade.php @@ -0,0 +1,61 @@ +
+
{{ trans('common.actions') }}
+ +
\ No newline at end of file diff --git a/resources/views/books/parts/show-sidebar-section-activity.blade.php b/resources/views/books/parts/show-sidebar-section-activity.blade.php new file mode 100644 index 000000000..c1c5c1d3e --- /dev/null +++ b/resources/views/books/parts/show-sidebar-section-activity.blade.php @@ -0,0 +1,6 @@ +@if(count($activity) > 0) +
+
{{ trans('entities.recent_activity') }}
+ @include('common.activity-list', ['activity' => $activity]) +
+@endif \ No newline at end of file diff --git a/resources/views/books/parts/show-sidebar-section-details.blade.php b/resources/views/books/parts/show-sidebar-section-details.blade.php new file mode 100644 index 000000000..709d0ffd9 --- /dev/null +++ b/resources/views/books/parts/show-sidebar-section-details.blade.php @@ -0,0 +1,21 @@ +
+
{{ trans('common.details') }}
+ +
\ No newline at end of file diff --git a/resources/views/books/parts/show-sidebar-section-shelves.blade.php b/resources/views/books/parts/show-sidebar-section-shelves.blade.php new file mode 100644 index 000000000..9de9b95c6 --- /dev/null +++ b/resources/views/books/parts/show-sidebar-section-shelves.blade.php @@ -0,0 +1,6 @@ +@if(count($bookParentShelves) > 0) +
+
{{ trans('entities.shelves') }}
+ @include('entities.list', ['entities' => $bookParentShelves, 'style' => 'compact']) +
+@endif \ No newline at end of file diff --git a/resources/views/books/parts/show-sidebar-section-tags.blade.php b/resources/views/books/parts/show-sidebar-section-tags.blade.php new file mode 100644 index 000000000..440a780c8 --- /dev/null +++ b/resources/views/books/parts/show-sidebar-section-tags.blade.php @@ -0,0 +1,5 @@ +@if($book->tags->count() > 0) +
+ @include('entities.tag-list', ['entity' => $book]) +
+@endif \ No newline at end of file diff --git a/resources/views/books/show.blade.php b/resources/views/books/show.blade.php index d510c8fd5..4eb83164f 100644 --- a/resources/views/books/show.blade.php +++ b/resources/views/books/show.blade.php @@ -67,114 +67,14 @@ @stop @section('right') -
-
{{ trans('common.details') }}
- -
- -
-
{{ trans('common.actions') }}
- -
- + @include('books.parts.show-sidebar-section-details', ['book' => $book, 'watchOptions' => $watchOptions]) + @include('books.parts.show-sidebar-section-actions', ['book' => $book, 'watchOptions' => $watchOptions]) @stop @section('left') - @include('entities.search-form', ['label' => trans('entities.books_search_this')]) - - @if($book->tags->count() > 0) -
- @include('entities.tag-list', ['entity' => $book]) -
- @endif - - @if(count($bookParentShelves) > 0) -
-
{{ trans('entities.shelves') }}
- @include('entities.list', ['entities' => $bookParentShelves, 'style' => 'compact']) -
- @endif - - @if(count($activity) > 0) -
-
{{ trans('entities.recent_activity') }}
- @include('common.activity-list', ['activity' => $activity]) -
- @endif + @include('books.parts.show-sidebar-section-tags', ['book' => $book]) + @include('books.parts.show-sidebar-section-shelves', ['bookParentShelves' => $bookParentShelves]) + @include('books.parts.show-sidebar-section-activity', ['activity' => $activity]) @stop diff --git a/resources/views/chapters/parts/show-sidebar-section-actions.blade.php b/resources/views/chapters/parts/show-sidebar-section-actions.blade.php new file mode 100644 index 000000000..55df999a2 --- /dev/null +++ b/resources/views/chapters/parts/show-sidebar-section-actions.blade.php @@ -0,0 +1,65 @@ +
+
{{ trans('common.actions') }}
+ +
\ No newline at end of file diff --git a/resources/views/chapters/parts/show-sidebar-section-details.blade.php b/resources/views/chapters/parts/show-sidebar-section-details.blade.php new file mode 100644 index 000000000..a424b8d3f --- /dev/null +++ b/resources/views/chapters/parts/show-sidebar-section-details.blade.php @@ -0,0 +1,38 @@ +
+
{{ trans('common.details') }}
+ +
\ No newline at end of file diff --git a/resources/views/chapters/parts/show-sidebar-section-tags.blade.php b/resources/views/chapters/parts/show-sidebar-section-tags.blade.php new file mode 100644 index 000000000..d28ff6383 --- /dev/null +++ b/resources/views/chapters/parts/show-sidebar-section-tags.blade.php @@ -0,0 +1,5 @@ +@if($chapter->tags->count() > 0) +
+ @include('entities.tag-list', ['entity' => $chapter]) +
+@endif \ No newline at end of file diff --git a/resources/views/chapters/show.blade.php b/resources/views/chapters/show.blade.php index 585bf8a3b..7ef877661 100644 --- a/resources/views/chapters/show.blade.php +++ b/resources/views/chapters/show.blade.php @@ -63,123 +63,13 @@ @stop @section('right') - -
-
{{ trans('common.details') }}
- -
- -
-
{{ trans('common.actions') }}
- -
+ @include('chapters.parts.show-sidebar-section-details', ['chapter' => $chapter, 'book' => $book, 'watchOptions' => $watchOptions]) + @include('chapters.parts.show-sidebar-section-actions', ['chapter' => $chapter, 'watchOptions' => $watchOptions]) @stop @section('left') - @include('entities.search-form', ['label' => trans('entities.chapters_search_this')]) - - @if($chapter->tags->count() > 0) -
- @include('entities.tag-list', ['entity' => $chapter]) -
- @endif - + @include('chapters.parts.show-sidebar-section-tags', ['chapter' => $chapter]) @include('entities.book-tree', ['book' => $book, 'sidebarTree' => $sidebarTree]) @stop diff --git a/resources/views/pages/parts/show-sidebar-section-actions.blade.php b/resources/views/pages/parts/show-sidebar-section-actions.blade.php new file mode 100644 index 000000000..ae115b69e --- /dev/null +++ b/resources/views/pages/parts/show-sidebar-section-actions.blade.php @@ -0,0 +1,57 @@ +
+
{{ trans('common.actions') }}
+ + + +
\ No newline at end of file diff --git a/resources/views/pages/parts/show-sidebar-section-attachments.blade.php b/resources/views/pages/parts/show-sidebar-section-attachments.blade.php new file mode 100644 index 000000000..975724015 --- /dev/null +++ b/resources/views/pages/parts/show-sidebar-section-attachments.blade.php @@ -0,0 +1,8 @@ +@if($page->attachments->count() > 0) +
+
{{ trans('entities.pages_attachments') }}
+
+ @include('attachments.list', ['attachments' => $page->attachments]) +
+
+@endif \ No newline at end of file diff --git a/resources/views/pages/parts/show-sidebar-section-details.blade.php b/resources/views/pages/parts/show-sidebar-section-details.blade.php new file mode 100644 index 000000000..391f30ce4 --- /dev/null +++ b/resources/views/pages/parts/show-sidebar-section-details.blade.php @@ -0,0 +1,61 @@ +
+
{{ trans('common.details') }}
+ +
\ No newline at end of file diff --git a/resources/views/pages/parts/show-sidebar-section-page-nav.blade.php b/resources/views/pages/parts/show-sidebar-section-page-nav.blade.php new file mode 100644 index 000000000..88db87e64 --- /dev/null +++ b/resources/views/pages/parts/show-sidebar-section-page-nav.blade.php @@ -0,0 +1,15 @@ +@if(isset($pageNav) && count($pageNav)) + +@endif \ No newline at end of file diff --git a/resources/views/pages/parts/show-sidebar-section-tags.blade.php b/resources/views/pages/parts/show-sidebar-section-tags.blade.php new file mode 100644 index 000000000..354da627c --- /dev/null +++ b/resources/views/pages/parts/show-sidebar-section-tags.blade.php @@ -0,0 +1,5 @@ +@if($page->tags->count() > 0) +
+ @include('entities.tag-list', ['entity' => $page]) +
+@endif \ No newline at end of file diff --git a/resources/views/pages/show.blade.php b/resources/views/pages/show.blade.php index 3338646a5..d34bfc6ae 100644 --- a/resources/views/pages/show.blade.php +++ b/resources/views/pages/show.blade.php @@ -36,159 +36,13 @@ @stop @section('left') - - @if($page->tags->count() > 0) -
- @include('entities.tag-list', ['entity' => $page]) -
- @endif - - @if ($page->attachments->count() > 0) -
-
{{ trans('entities.pages_attachments') }}
-
- @include('attachments.list', ['attachments' => $page->attachments]) -
-
- @endif - - @if (isset($pageNav) && count($pageNav)) - - @endif - + @include('pages.parts.show-sidebar-section-tags', ['page' => $page]) + @include('pages.parts.show-sidebar-section-attachments', ['page' => $page]) + @include('pages.parts.show-sidebar-section-page-nav', ['pageNav' => $pageNav]) @include('entities.book-tree', ['book' => $book, 'sidebarTree' => $sidebarTree]) @stop @section('right') -
-
{{ trans('common.details') }}
- -
- -
-
{{ trans('common.actions') }}
- - - -
+ @include('pages.parts.show-sidebar-section-details', ['page' => $page, 'watchOptions' => $watchOptions, 'book' => $book]) + @include('pages.parts.show-sidebar-section-actions', ['page' => $page, 'watchOptions' => $watchOptions]) @stop diff --git a/resources/views/shelves/index.blade.php b/resources/views/shelves/index.blade.php index bb7c57e0f..70357068d 100644 --- a/resources/views/shelves/index.blade.php +++ b/resources/views/shelves/index.blade.php @@ -5,51 +5,11 @@ @stop @section('right') - -
-
{{ trans('common.actions') }}
- -
- + @include('shelves.parts.index-sidebar-section-actions', ['view' => $view]) @stop @section('left') - @if($recents) -
-
{{ trans('entities.recently_viewed') }}
- @include('entities.list', ['entities' => $recents, 'style' => 'compact']) -
- @endif - - - -
-
{{ trans('entities.shelves_new') }}
- @if(count($new) > 0) - @include('entities.list', ['entities' => $new, 'style' => 'compact']) - @else -

{{ trans('entities.shelves_new_empty') }}

- @endif -
+ @include('shelves.parts.index-sidebar-section-recents', ['recents' => $recents]) + @include('shelves.parts.index-sidebar-section-popular', ['popular' => $popular]) + @include('shelves.parts.index-sidebar-section-new', ['new' => $new]) @stop \ No newline at end of file diff --git a/resources/views/shelves/parts/index-sidebar-section-actions.blade.php b/resources/views/shelves/parts/index-sidebar-section-actions.blade.php new file mode 100644 index 000000000..d5cdb4056 --- /dev/null +++ b/resources/views/shelves/parts/index-sidebar-section-actions.blade.php @@ -0,0 +1,18 @@ +
+
{{ trans('common.actions') }}
+ +
\ No newline at end of file diff --git a/resources/views/shelves/parts/index-sidebar-section-new.blade.php b/resources/views/shelves/parts/index-sidebar-section-new.blade.php new file mode 100644 index 000000000..602f60ebe --- /dev/null +++ b/resources/views/shelves/parts/index-sidebar-section-new.blade.php @@ -0,0 +1,8 @@ +
+
{{ trans('entities.shelves_new') }}
+ @if(count($new) > 0) + @include('entities.list', ['entities' => $new, 'style' => 'compact']) + @else +

{{ trans('entities.shelves_new_empty') }}

+ @endif +
\ No newline at end of file diff --git a/resources/views/shelves/parts/index-sidebar-section-popular.blade.php b/resources/views/shelves/parts/index-sidebar-section-popular.blade.php new file mode 100644 index 000000000..956321c5e --- /dev/null +++ b/resources/views/shelves/parts/index-sidebar-section-popular.blade.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/resources/views/shelves/parts/index-sidebar-section-recents.blade.php b/resources/views/shelves/parts/index-sidebar-section-recents.blade.php new file mode 100644 index 000000000..f1a68ba4f --- /dev/null +++ b/resources/views/shelves/parts/index-sidebar-section-recents.blade.php @@ -0,0 +1,6 @@ +@if($recents) +
+
{{ trans('entities.recently_viewed') }}
+ @include('entities.list', ['entities' => $recents, 'style' => 'compact']) +
+@endif \ No newline at end of file diff --git a/resources/views/shelves/parts/show-sidebar-section-actions.blade.php b/resources/views/shelves/parts/show-sidebar-section-actions.blade.php new file mode 100644 index 000000000..ba92e5f70 --- /dev/null +++ b/resources/views/shelves/parts/show-sidebar-section-actions.blade.php @@ -0,0 +1,43 @@ +
+
{{ trans('common.actions') }}
+ +
\ No newline at end of file diff --git a/resources/views/shelves/parts/show-sidebar-section-activity.blade.php b/resources/views/shelves/parts/show-sidebar-section-activity.blade.php new file mode 100644 index 000000000..c1c5c1d3e --- /dev/null +++ b/resources/views/shelves/parts/show-sidebar-section-activity.blade.php @@ -0,0 +1,6 @@ +@if(count($activity) > 0) +
+
{{ trans('entities.recent_activity') }}
+ @include('common.activity-list', ['activity' => $activity]) +
+@endif \ No newline at end of file diff --git a/resources/views/shelves/parts/show-sidebar-section-details.blade.php b/resources/views/shelves/parts/show-sidebar-section-details.blade.php new file mode 100644 index 000000000..8933cc419 --- /dev/null +++ b/resources/views/shelves/parts/show-sidebar-section-details.blade.php @@ -0,0 +1,21 @@ +
+
{{ trans('common.details') }}
+ +
\ No newline at end of file diff --git a/resources/views/shelves/parts/show-sidebar-section-tags.blade.php b/resources/views/shelves/parts/show-sidebar-section-tags.blade.php new file mode 100644 index 000000000..265d61cd0 --- /dev/null +++ b/resources/views/shelves/parts/show-sidebar-section-tags.blade.php @@ -0,0 +1,5 @@ +@if($shelf->tags->count() > 0) +
+ @include('entities.tag-list', ['entity' => $shelf]) +
+@endif \ No newline at end of file diff --git a/resources/views/shelves/show.blade.php b/resources/views/shelves/show.blade.php index 9ee14f1bf..9d07e5da0 100644 --- a/resources/views/shelves/show.blade.php +++ b/resources/views/shelves/show.blade.php @@ -69,87 +69,13 @@ @stop @section('left') - - @if($shelf->tags->count() > 0) -
- @include('entities.tag-list', ['entity' => $shelf]) -
- @endif - -
-
{{ trans('common.details') }}
- -
- - @if(count($activity) > 0) -
-
{{ trans('entities.recent_activity') }}
- @include('common.activity-list', ['activity' => $activity]) -
- @endif + @include('shelves.parts.show-sidebar-section-tags', ['shelf' => $shelf]) + @include('shelves.parts.show-sidebar-section-details', ['shelf' => $shelf]) + @include('shelves.parts.show-sidebar-section-activity', ['activity' => $activity]) @stop @section('right') -
-
{{ trans('common.actions') }}
- -
+ @include('shelves.parts.show-sidebar-section-actions', ['shelf' => $shelf, 'view' => $view]) @stop