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