]> BookStack Code Mirror - bookstack/blob - resources/views/chapters/show.blade.php
Code cleanup, bug squashing
[bookstack] / resources / views / chapters / show.blade.php
1 @extends('tri-layout')
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     <meta property="og:image" content="{{ $chapter->book->getBookCover() }}">
12 @endpush
13
14 @section('body')
15
16     <div class="mb-m print-hidden">
17         @include('partials.breadcrumbs', ['crumbs' => [
18             $chapter->book,
19             $chapter,
20         ]])
21     </div>
22
23     <main class="content-wrap card">
24         <h1 class="break-text">{{ $chapter->name }}</h1>
25         <div refs="entity-search@contentView" class="chapter-content">
26             <p class="text-muted break-text">{!! nl2br(e($chapter->description)) !!}</p>
27             @if(count($pages) > 0)
28                 <div class="entity-list book-contents">
29                     @foreach($pages as $page)
30                         @include('pages.list-item', ['page' => $page])
31                     @endforeach
32                 </div>
33             @else
34                 <div class="mt-xl">
35                     <hr>
36                     <p class="text-muted italic mb-m mt-xl">{{ trans('entities.chapters_empty') }}</p>
37
38                     <div class="icon-list block inline">
39                         @if(userCan('page-create', $chapter))
40                             <a href="{{ $chapter->getUrl('/create-page') }}" class="icon-list-item text-page">
41                                 <span class="icon">@icon('page')</span>
42                                 <span>{{ trans('entities.books_empty_create_page') }}</span>
43                             </a>
44                         @endif
45                         @if(userCan('book-update', $book))
46                             <a href="{{ $book->getUrl('/sort') }}" class="icon-list-item text-book">
47                                 <span class="icon">@icon('book')</span>
48                                 <span>{{ trans('entities.books_empty_sort_current_book') }}</span>
49                             </a>
50                         @endif
51                     </div>
52
53                 </div>
54             @endif
55         </div>
56
57         @include('partials.entity-search-results')
58     </main>
59
60 @stop
61
62 @section('right')
63
64     <div class="mb-xl">
65         <h5>{{ trans('common.details') }}</h5>
66         <div class="blended-links text-small text-muted">
67             @include('partials.entity-meta', ['entity' => $chapter])
68
69             @if($book->restricted)
70                 <div class="active-restriction">
71                     @if(userCan('restrictions-manage', $book))
72                         <a href="{{ $book->getUrl('/permissions') }}">@icon('lock'){{ trans('entities.books_permissions_active') }}</a>
73                     @else
74                         @icon('lock'){{ trans('entities.books_permissions_active') }}
75                     @endif
76                 </div>
77             @endif
78
79             @if($chapter->restricted)
80                 <div class="active-restriction">
81                     @if(userCan('restrictions-manage', $chapter))
82                         <a href="{{ $chapter->getUrl('/permissions') }}">@icon('lock'){{ trans('entities.chapters_permissions_active') }}</a>
83                     @else
84                         @icon('lock'){{ trans('entities.chapters_permissions_active') }}
85                     @endif
86                 </div>
87             @endif
88         </div>
89     </div>
90
91     <div class="actions mb-xl">
92         <h5>{{ trans('common.actions') }}</h5>
93         <div class="icon-list text-primary">
94
95             @if(userCan('page-create', $chapter))
96                 <a href="{{ $chapter->getUrl('/create-page') }}" class="icon-list-item">
97                     <span>@icon('add')</span>
98                     <span>{{ trans('entities.pages_new') }}</span>
99                 </a>
100             @endif
101
102             <hr class="primary-background"/>
103
104             @if(userCan('chapter-update', $chapter))
105                 <a href="{{ $chapter->getUrl('/edit') }}" class="icon-list-item">
106                     <span>@icon('edit')</span>
107                     <span>{{ trans('common.edit') }}</span>
108                 </a>
109             @endif
110             @if(userCan('chapter-update', $chapter) && userCan('chapter-delete', $chapter))
111                 <a href="{{ $chapter->getUrl('/move') }}" class="icon-list-item">
112                     <span>@icon('folder')</span>
113                     <span>{{ trans('common.move') }}</span>
114                 </a>
115             @endif
116             @if(userCan('restrictions-manage', $chapter))
117                 <a href="{{ $chapter->getUrl('/permissions') }}" class="icon-list-item">
118                     <span>@icon('lock')</span>
119                     <span>{{ trans('entities.permissions') }}</span>
120                 </a>
121             @endif
122             @if(userCan('chapter-delete', $chapter))
123                 <a href="{{ $chapter->getUrl('/delete') }}" class="icon-list-item">
124                     <span>@icon('delete')</span>
125                     <span>{{ trans('common.delete') }}</span>
126                 </a>
127             @endif
128
129             <hr class="primary-background"/>
130
131             @include('partials.entity-export-menu', ['entity' => $chapter])
132         </div>
133     </div>
134 @stop
135
136 @section('left')
137
138     @include('partials.entity-search-form', ['label' => trans('entities.chapters_search_this')])
139
140     @if($chapter->tags->count() > 0)
141         <div class="mb-xl">
142             @include('components.tag-list', ['entity' => $chapter])
143         </div>
144     @endif
145
146     @include('partials.book-tree', ['book' => $book, 'sidebarTree' => $sidebarTree])
147 @stop
148
149