]> BookStack Code Mirror - bookstack/blob - resources/views/books/show.blade.php
Started implementation of UI shortcuts system
[bookstack] / resources / views / books / show.blade.php
1 @extends('layouts.tri')
2
3 @section('container-attrs')
4     component="entity-search"
5     option:entity-search:entity-id="{{ $book->id }}"
6     option:entity-search:entity-type="book"
7 @stop
8
9 @push('social-meta')
10     <meta property="og:description" content="{{ Str::limit($book->description, 100, '...') }}">
11     @if($book->cover)
12         <meta property="og:image" content="{{ $book->getBookCover() }}">
13     @endif
14 @endpush
15
16 @include('entities.body-tag-classes', ['entity' => $book])
17
18 @section('body')
19
20     <div class="mb-s">
21         @include('entities.breadcrumbs', ['crumbs' => [
22             $book,
23         ]])
24     </div>
25
26     <main class="content-wrap card">
27         <h1 class="break-text">{{$book->name}}</h1>
28         <div refs="entity-search@contentView" class="book-content">
29             <p class="text-muted">{!! nl2br(e($book->description)) !!}</p>
30             @if(count($bookChildren) > 0)
31                 <div class="entity-list book-contents">
32                     @foreach($bookChildren as $childElement)
33                         @if($childElement->isA('chapter'))
34                             @include('chapters.parts.list-item', ['chapter' => $childElement])
35                         @else
36                             @include('pages.parts.list-item', ['page' => $childElement])
37                         @endif
38                     @endforeach
39                 </div>
40             @else
41                 <div class="mt-xl">
42                     <hr>
43                     <p class="text-muted italic mb-m mt-xl">{{ trans('entities.books_empty_contents') }}</p>
44
45                     <div class="icon-list block inline">
46                         @if(userCan('page-create', $book))
47                             <a href="{{ $book->getUrl('/create-page') }}" class="icon-list-item text-page">
48                                 <span class="icon">@icon('page')</span>
49                                 <span>{{ trans('entities.books_empty_create_page') }}</span>
50                             </a>
51                         @endif
52                         @if(userCan('chapter-create', $book))
53                             <a href="{{ $book->getUrl('/create-chapter') }}" class="icon-list-item text-chapter">
54                                 <span class="icon">@icon('chapter')</span>
55                                 <span>{{ trans('entities.books_empty_add_chapter') }}</span>
56                             </a>
57                         @endif
58                     </div>
59
60                 </div>
61             @endif
62         </div>
63
64         @include('entities.search-results')
65     </main>
66
67 @stop
68
69 @section('right')
70     <div class="mb-xl">
71         <h5>{{ trans('common.details') }}</h5>
72         <div class="blended-links">
73             @include('entities.meta', ['entity' => $book])
74             @if($book->hasPermissions())
75                 <div class="active-restriction">
76                     @if(userCan('restrictions-manage', $book))
77                         <a href="{{ $book->getUrl('/permissions') }}" class="entity-meta-item">
78                             @icon('lock')
79                             <div>{{ trans('entities.books_permissions_active') }}</div>
80                         </a>
81                     @else
82                         <div class="entity-meta-item">
83                             @icon('lock')
84                             <div>{{ trans('entities.books_permissions_active') }}</div>
85                         </div>
86                     @endif
87                 </div>
88             @endif
89         </div>
90     </div>
91
92     <div class="actions mb-xl">
93         <h5>{{ trans('common.actions') }}</h5>
94         <div class="icon-list text-primary">
95
96             @if(userCan('page-create', $book))
97                 <a href="{{ $book->getUrl('/create-page') }}" class="icon-list-item">
98                     <span>@icon('add')</span>
99                     <span>{{ trans('entities.pages_new') }}</span>
100                 </a>
101             @endif
102             @if(userCan('chapter-create', $book))
103                 <a href="{{ $book->getUrl('/create-chapter') }}" class="icon-list-item">
104                     <span>@icon('add')</span>
105                     <span>{{ trans('entities.chapters_new') }}</span>
106                 </a>
107             @endif
108
109             <hr class="primary-background">
110
111             @if(userCan('book-update', $book))
112                 <a href="{{ $book->getUrl('/edit') }}" data-shortcut="edit" class="icon-list-item">
113                     <span>@icon('edit')</span>
114                     <span>{{ trans('common.edit') }}</span>
115                 </a>
116                 <a href="{{ $book->getUrl('/sort') }}" class="icon-list-item">
117                     <span>@icon('sort')</span>
118                     <span>{{ trans('common.sort') }}</span>
119                 </a>
120             @endif
121             @if(userCan('book-create-all'))
122                 <a href="{{ $book->getUrl('/copy') }}" class="icon-list-item">
123                     <span>@icon('copy')</span>
124                     <span>{{ trans('common.copy') }}</span>
125                 </a>
126             @endif
127             @if(userCan('restrictions-manage', $book))
128                 <a href="{{ $book->getUrl('/permissions') }}" class="icon-list-item">
129                     <span>@icon('lock')</span>
130                     <span>{{ trans('entities.permissions') }}</span>
131                 </a>
132             @endif
133             @if(userCan('book-delete', $book))
134                 <a href="{{ $book->getUrl('/delete') }}" class="icon-list-item">
135                     <span>@icon('delete')</span>
136                     <span>{{ trans('common.delete') }}</span>
137                 </a>
138             @endif
139
140             <hr class="primary-background">
141
142             @if(signedInUser())
143                 @include('entities.favourite-action', ['entity' => $book])
144             @endif
145             @if(userCan('content-export'))
146                 @include('entities.export-menu', ['entity' => $book])
147             @endif
148         </div>
149     </div>
150
151 @stop
152
153 @section('left')
154
155     @include('entities.search-form', ['label' => trans('entities.books_search_this')])
156
157     @if($book->tags->count() > 0)
158         <div class="mb-xl">
159             @include('entities.tag-list', ['entity' => $book])
160         </div>
161     @endif
162
163     @if(count($bookParentShelves) > 0)
164         <div class="actions mb-xl">
165             <h5>{{ trans('entities.shelves') }}</h5>
166             @include('entities.list', ['entities' => $bookParentShelves, 'style' => 'compact'])
167         </div>
168     @endif
169
170     @if(count($activity) > 0)
171         <div class="mb-xl">
172             <h5>{{ trans('entities.recent_activity') }}</h5>
173             @include('common.activity-list', ['activity' => $activity])
174         </div>
175     @endif
176 @stop
177