mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Allow toggling between grid and list view in shelf view (shelves.show)
This commit is contained in:
parent
189a598d56
commit
6cd26e23a8
@ -103,6 +103,7 @@ class BookshelfController extends Controller
|
|||||||
public function show(string $slug)
|
public function show(string $slug)
|
||||||
{
|
{
|
||||||
$shelf = $this->bookshelfRepo->getBySlug($slug);
|
$shelf = $this->bookshelfRepo->getBySlug($slug);
|
||||||
|
$view = setting()->getForCurrentUser('books_view_type', config('app.views.books'));
|
||||||
$this->checkOwnablePermission('book-view', $shelf);
|
$this->checkOwnablePermission('book-view', $shelf);
|
||||||
|
|
||||||
Views::add($shelf);
|
Views::add($shelf);
|
||||||
@ -111,6 +112,7 @@ class BookshelfController extends Controller
|
|||||||
$this->setPageTitle($shelf->getShortName());
|
$this->setPageTitle($shelf->getShortName());
|
||||||
return view('shelves.show', [
|
return view('shelves.show', [
|
||||||
'shelf' => $shelf,
|
'shelf' => $shelf,
|
||||||
|
'view' => $view,
|
||||||
'activity' => Activity::entityActivity($shelf, 20, 1)
|
'activity' => Activity::entityActivity($shelf, 20, 1)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,19 @@
|
|||||||
<div class="book-content">
|
<div class="book-content">
|
||||||
<p class="text-muted">{!! nl2br(e($shelf->description)) !!}</p>
|
<p class="text-muted">{!! nl2br(e($shelf->description)) !!}</p>
|
||||||
@if(count($shelf->visibleBooks) > 0)
|
@if(count($shelf->visibleBooks) > 0)
|
||||||
|
@if($view === 'list')
|
||||||
<div class="entity-list">
|
<div class="entity-list">
|
||||||
@foreach($shelf->visibleBooks as $book)
|
@foreach($shelf->visibleBooks as $book)
|
||||||
@include('books.list-item', ['book' => $book])
|
@include('books.list-item', ['book' => $book])
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
|
@else
|
||||||
|
<div class="grid third">
|
||||||
|
@foreach($shelf->visibleBooks as $key => $book)
|
||||||
|
@include('books.grid-item', ['book' => $book])
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
@else
|
@else
|
||||||
<div class="mt-xl">
|
<div class="mt-xl">
|
||||||
<hr>
|
<hr>
|
||||||
@ -87,6 +95,8 @@
|
|||||||
</a>
|
</a>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@include('partials.view-toggle', ['view' => $view, 'type' => 'book'])
|
||||||
|
|
||||||
<hr class="primary-background">
|
<hr class="primary-background">
|
||||||
|
|
||||||
@if(userCan('bookshelf-update', $shelf))
|
@if(userCan('bookshelf-update', $shelf))
|
||||||
|
Loading…
Reference in New Issue
Block a user