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