]> BookStack Code Mirror - bookstack/blob - resources/views/books/show.blade.php
Show bookshelves that a book belongs to on a book view
[bookstack] / resources / views / books / show.blade.php
1 @extends('tri-layout')
2
3 @section('container-attrs')
4     id="entity-dashboard"
5     entity-id="{{ $book->id }}"
6     entity-type="book"
7 @stop
8
9 @section('body')
10
11     <div class="mb-s">
12         @include('partials.breadcrumbs', ['crumbs' => [
13             $book,
14         ]])
15     </div>
16
17     <main class="content-wrap card">
18         <h1 class="break-text" v-pre>{{$book->name}}</h1>
19         <div class="book-content" v-show="!searching">
20             <p class="text-muted" v-pre>{!! nl2br(e($book->description)) !!}</p>
21             @if(count($bookChildren) > 0)
22                 <div class="entity-list book-contents" v-pre>
23                     @foreach($bookChildren as $childElement)
24                         @if($childElement->isA('chapter'))
25                             @include('chapters.list-item', ['chapter' => $childElement])
26                         @else
27                             @include('pages.list-item', ['page' => $childElement])
28                         @endif
29                     @endforeach
30                 </div>
31             @else
32                 <div class="mt-xl" v-pre>
33                     <hr>
34                     <p class="text-muted italic mb-m mt-xl">{{ trans('entities.books_empty_contents') }}</p>
35
36                     <div class="icon-list block inline">
37                         @if(userCan('page-create', $book))
38                             <a href="{{ $book->getUrl('/create-page') }}" class="icon-list-item text-page">
39                                 <span class="icon">@icon('page')</span>
40                                 <span>{{ trans('entities.books_empty_create_page') }}</span>
41                             </a>
42                         @endif
43                         @if(userCan('chapter-create', $book))
44                             <a href="{{ $book->getUrl('/create-chapter') }}" class="icon-list-item text-chapter">
45                                 <span class="icon">@icon('chapter')</span>
46                                 <span>{{ trans('entities.books_empty_add_chapter') }}</span>
47                             </a>
48                         @endif
49                     </div>
50
51                 </div>
52             @endif
53         </div>
54
55         @include('partials.entity-dashboard-search-results')
56     </main>
57
58 @stop
59
60 @section('right')
61     <div class="mb-xl">
62         <h5>{{ trans('common.details') }}</h5>
63         <div class="text-small text-muted blended-links">
64             @include('partials.entity-meta', ['entity' => $book])
65             @if($book->restricted)
66                 <div class="active-restriction">
67                     @if(userCan('restrictions-manage', $book))
68                         <a href="{{ $book->getUrl('/permissions') }}">@icon('lock'){{ trans('entities.books_permissions_active') }}</a>
69                     @else
70                         @icon('lock'){{ trans('entities.books_permissions_active') }}
71                     @endif
72                 </div>
73             @endif
74         </div>
75     </div>
76
77     <div class="actions mb-xl">
78         <h5>{{ trans('common.actions') }}</h5>
79         <div class="icon-list text-primary">
80
81             @if(userCan('page-create', $book))
82                 <a href="{{ $book->getUrl('/create-page') }}" class="icon-list-item">
83                     <span>@icon('add')</span>
84                     <span>{{ trans('entities.pages_new') }}</span>
85                 </a>
86             @endif
87             @if(userCan('chapter-create', $book))
88                 <a href="{{ $book->getUrl('/create-chapter') }}" class="icon-list-item">
89                     <span>@icon('add')</span>
90                     <span>{{ trans('entities.chapters_new') }}</span>
91                 </a>
92             @endif
93
94             <hr class="primary-background">
95
96             @if(userCan('book-update', $book))
97                 <a href="{{ $book->getUrl('/edit') }}" class="icon-list-item">
98                     <span>@icon('edit')</span>
99                     <span>{{ trans('common.edit') }}</span>
100                 </a>
101                 <a href="{{ $book->getUrl('/sort') }}" class="icon-list-item">
102                     <span>@icon('sort')</span>
103                     <span>{{ trans('common.sort') }}</span>
104                 </a>
105             @endif
106             @if(userCan('restrictions-manage', $book))
107                 <a href="{{ $book->getUrl('/permissions') }}" class="icon-list-item">
108                     <span>@icon('lock')</span>
109                     <span>{{ trans('entities.permissions') }}</span>
110                 </a>
111             @endif
112             @if(userCan('book-delete', $book))
113                 <a href="{{ $book->getUrl('/delete') }}" class="icon-list-item">
114                     <span>@icon('delete')</span>
115                     <span>{{ trans('common.delete') }}</span>
116                 </a>
117             @endif
118
119             <hr class="primary-background">
120
121             @include('partials.entity-export-menu', ['entity' => $book])
122         </div>
123     </div>
124
125     <div class="actions mb-xl">
126         <h5>{{ trans('entities.shelves_long') }}</h5>
127
128         @if(count($bookParentShelves) > 0)
129             @include('partials.entity-list', ['entities' => $bookParentShelves, 'style' => 'compact'])
130         @else
131             <div class="body text-muted">{{ trans('entities.book_parent_shelves_empty') }}</div>
132         @endif
133     </div>
134
135 @stop
136
137 @section('left')
138
139     @include('partials.entity-dashboard-search-box')
140
141     @if($book->tags->count() > 0)
142         <div class="mb-xl">
143             @include('components.tag-list', ['entity' => $book])
144         </div>
145     @endif
146
147     @if(count($activity) > 0)
148         <div class="mb-xl">
149             <h5>{{ trans('entities.recent_activity') }}</h5>
150             @include('partials.activity-list', ['activity' => $activity])
151         </div>
152     @endif
153 @stop
154