]> BookStack Code Mirror - bookstack/blob - resources/views/chapters/show.blade.php
Added restriction tests and fixed any bugs in the process
[bookstack] / resources / views / chapters / show.blade.php
1 @extends('base')
2
3 @section('content')
4
5     <div class="faded-small toolbar" ng-non-bindable>
6         <div class="container">
7             <div class="row">
8                 <div class="col-md-4 faded">
9                     <div class="breadcrumbs">
10                         <a href="{{$book->getUrl()}}" class="text-book text-button"><i class="zmdi zmdi-book"></i>{{ $book->name }}</a>
11                     </div>
12                 </div>
13                 <div class="col-md-8 faded">
14                     <div class="action-buttons">
15                         @if(userCan('page-create', $chapter))
16                             <a href="{{$chapter->getUrl() . '/create-page'}}" class="text-pos text-button"><i class="zmdi zmdi-plus"></i>New Page</a>
17                         @endif
18                         @if(userCan('chapter-update', $chapter))
19                             <a href="{{$chapter->getUrl() . '/edit'}}" class="text-primary text-button"><i class="zmdi zmdi-edit"></i>Edit</a>
20                         @endif
21                         @if(userCan('restrictions-manage', $chapter))
22                             <a href="{{$chapter->getUrl()}}/restrict" class="text-primary text-button"><i class="zmdi zmdi-lock-outline"></i>Restrict</a>
23                         @endif
24                         @if(userCan('chapter-delete', $chapter))
25                             <a href="{{$chapter->getUrl() . '/delete'}}" class="text-neg text-button"><i class="zmdi zmdi-delete"></i>Delete</a>
26                         @endif
27                     </div>
28                 </div>
29             </div>
30         </div>
31     </div>
32
33
34     <div class="container" ng-non-bindable>
35         <div class="row">
36             <div class="col-md-8">
37                 <h1>{{ $chapter->name }}</h1>
38                 <p class="text-muted">{{ $chapter->description }}</p>
39
40                 @if(count($pages) > 0)
41                     <div class="page-list">
42                         <hr>
43                         @foreach($pages as $page)
44                             @include('pages/list-item', ['page' => $page])
45                             <hr>
46                         @endforeach
47                     </div>
48                 @else
49                     <hr>
50                     <p class="text-muted">No pages are currently in this chapter.</p>
51                     <p>
52                         <a href="{{$chapter->getUrl() . '/create-page'}}" class="text-page"><i class="zmdi zmdi-file-text"></i>Create a new page</a>
53                         &nbsp;&nbsp;<em class="text-muted">-or-</em>&nbsp;&nbsp;&nbsp;
54                         <a href="{{$book->getUrl() . '/sort'}}" class="text-book"><i class="zmdi zmdi-book"></i>Sort the current book</a>
55                     </p>
56                     <hr>
57                 @endif
58
59                 <p class="text-muted small">
60                     Created {{$chapter->created_at->diffForHumans()}} @if($chapter->createdBy) by {{$chapter->createdBy->name}} @endif
61                     <br>
62                     Last Updated {{$chapter->updated_at->diffForHumans()}} @if($chapter->updatedBy) by {{$chapter->updatedBy->name}} @endif
63                 </p>
64             </div>
65             <div class="col-md-3 col-md-offset-1">
66                 <div class="margin-top large"></div>
67                 @if($book->restricted || $chapter->restricted)
68                     <div class="text-muted">
69
70                         @if($book->restricted)
71                             @if(userCan('restrictions-manage', $book))
72                                 <a href="{{ $book->getUrl() }}/restrict"><i class="zmdi zmdi-lock-outline"></i>Book Restricted</a>
73                             @else
74                                 <i class="zmdi zmdi-lock-outline"></i>Book Restricted
75                             @endif
76                                 <br>
77                         @endif
78
79                         @if($chapter->restricted)
80                             @if(userCan('restrictions-manage', $chapter))
81                                 <a href="{{ $chapter->getUrl() }}/restrict"><i class="zmdi zmdi-lock-outline"></i>Chapter Restricted</a>
82                             @else
83                                 <i class="zmdi zmdi-lock-outline"></i>Chapter Restricted
84                             @endif
85                         @endif
86                     </div>
87                 @endif
88
89                 @include('pages/sidebar-tree-list', ['book' => $book, 'sidebarTree' => $sidebarTree])
90             </div>
91         </div>
92     </div>
93
94
95
96
97 @stop