From 47e645909e7e5dd315dce150cfb9faa19a5bde31 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Thu, 9 Apr 2020 17:29:22 +0100 Subject: [PATCH] Reviewed #1688, Show parent shelves on books page - Moved list to the left of the page to align with other navigational items. - Hid list of no shelves, to help hide shelf references if not in use. - Tweaked test to ensure it wasn't finding shelf name in breadcrumb rather than list being tested. --- app/Entities/Repos/EntityRepo.php | 0 app/Http/Controllers/BookController.php | 2 +- resources/lang/en/entities.php | 1 - resources/views/books/show.blade.php | 17 +++++++---------- tests/Entity/BookShelfTest.php | 2 +- 5 files changed, 9 insertions(+), 13 deletions(-) delete mode 100644 app/Entities/Repos/EntityRepo.php diff --git a/app/Entities/Repos/EntityRepo.php b/app/Entities/Repos/EntityRepo.php deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/Http/Controllers/BookController.php b/app/Http/Controllers/BookController.php index 2213dedba..1643c62f9 100644 --- a/app/Http/Controllers/BookController.php +++ b/app/Http/Controllers/BookController.php @@ -114,7 +114,7 @@ class BookController extends Controller { $book = $this->bookRepo->getBySlug($slug); $bookChildren = (new BookContents($book))->getTree(true); - $bookParentShelves = $book->shelves()->visible(); + $bookParentShelves = $book->shelves()->visible()->get(); Views::add($book); if ($request->has('shelf')) { diff --git a/resources/lang/en/entities.php b/resources/lang/en/entities.php index 79e640378..6bbc723b0 100644 --- a/resources/lang/en/entities.php +++ b/resources/lang/en/entities.php @@ -135,7 +135,6 @@ return [ 'books_sort_chapters_last' => 'Chapters Last', 'books_sort_show_other' => 'Show Other Books', 'books_sort_save' => 'Save New Order', - 'book_parent_shelves_empty' => 'Shelves that this book is on will appear here.', // Chapters 'chapter' => 'Chapter', diff --git a/resources/views/books/show.blade.php b/resources/views/books/show.blade.php index 41581e123..e3a536fc9 100644 --- a/resources/views/books/show.blade.php +++ b/resources/views/books/show.blade.php @@ -122,16 +122,6 @@ -
-
{{ trans('entities.shelves_long') }}
- - @if(count($bookParentShelves) > 0) - @include('partials.entity-list', ['entities' => $bookParentShelves, 'style' => 'compact']) - @else -
{{ trans('entities.book_parent_shelves_empty') }}
- @endif -
- @stop @section('left') @@ -144,6 +134,13 @@ @endif + @if(count($bookParentShelves) > 0) +
+
{{ trans('entities.shelves_long') }}
+ @include('partials.entity-list', ['entities' => $bookParentShelves, 'style' => 'compact']) +
+ @endif + @if(count($activity) > 0)
{{ trans('entities.recent_activity') }}
diff --git a/tests/Entity/BookShelfTest.php b/tests/Entity/BookShelfTest.php index 8f41e83ab..abee4d34a 100644 --- a/tests/Entity/BookShelfTest.php +++ b/tests/Entity/BookShelfTest.php @@ -284,7 +284,7 @@ class BookShelfTest extends TestCase $newBook = Book::query()->orderBy('id', 'desc')->first(); $resp = $this->asEditor()->get($newBook->getUrl()); - $resp->assertSee($shelfInfo['name']); + $resp->assertElementContains('.tri-layout-left-contents', $shelfInfo['name']); // Remove shelf $this->delete($shelf->getUrl());