public function show(string $slug)
{
$shelf = $this->bookshelfRepo->getBySlug($slug);
+ $view = setting()->getForCurrentUser('books_view_type', config('app.views.books'));
$this->checkOwnablePermission('book-view', $shelf);
Views::add($shelf);
$this->setPageTitle($shelf->getShortName());
return view('shelves.show', [
'shelf' => $shelf,
+ 'view' => $view,
'activity' => Activity::entityActivity($shelf, 20, 1)
]);
}
<div class="book-content">
<p class="text-muted">{!! nl2br(e($shelf->description)) !!}</p>
@if(count($shelf->visibleBooks) > 0)
- <div class="entity-list">
- @foreach($shelf->visibleBooks as $book)
- @include('books.list-item', ['book' => $book])
- @endforeach
- </div>
+ @if($view === 'list')
+ <div class="entity-list">
+ @foreach($shelf->visibleBooks as $book)
+ @include('books.list-item', ['book' => $book])
+ @endforeach
+ </div>
+ @else
+ <div class="grid third">
+ @foreach($shelf->visibleBooks as $key => $book)
+ @include('books.grid-item', ['book' => $book])
+ @endforeach
+ </div>
+ @endif
@else
<div class="mt-xl">
<hr>
</a>
@endif
+ @include('partials.view-toggle', ['view' => $view, 'type' => 'book'])
+
<hr class="primary-background">
@if(userCan('bookshelf-update', $shelf))