]> BookStack Code Mirror - bookstack/blob - resources/views/books/show.blade.php
Added filtering to activity lists. Fixes #14.
[bookstack] / resources / views / books / show.blade.php
1 @extends('base')
2
3 @section('content')
4
5     <div class="row faded-small">
6         <div class="col-md-6"></div>
7         <div class="col-md-6">
8             <div class="action-buttons faded">
9                 @if($currentUser->can('page-create'))
10                     <a href="{{$book->getUrl() . '/page/create'}}" class="text-pos"><i class="zmdi zmdi-plus"></i> New Page</a>
11                 @endif
12                 @if($currentUser->can('chapter-create'))
13                     <a href="{{$book->getUrl() . '/chapter/create'}}" class="text-pos"><i class="zmdi zmdi-plus"></i> New Chapter</a>
14                 @endif
15                 @if($currentUser->can('book-update'))
16                     <a href="{{$book->getEditUrl()}}" class="text-primary"><i class="zmdi zmdi-edit"></i>Edit</a>
17                     <a href="{{ $book->getUrl() }}/sort" class="text-primary"><i class="zmdi zmdi-sort"></i>Sort</a>
18                 @endif
19                 @if($currentUser->can('book-delete'))
20                     <a href="{{ $book->getUrl() }}/delete" class="text-neg"><i class="zmdi zmdi-delete"></i>Delete</a>
21                 @endif
22             </div>
23         </div>
24     </div>
25
26     <div class="row">
27         <div class="col-md-6 col-md-offset-1">
28
29             <div class="page-content">
30                 <h1>{{$book->name}}</h1>
31                 <p class="text-muted">{{$book->description}}</p>
32
33                 <div class="page-list">
34                     <hr>
35                     @foreach($book->children() as $childElement)
36                         <div class="book-child">
37                             <h3>
38                                 <a href="{{ $childElement->getUrl() }}">
39                                     @if(is_a($childElement, 'Oxbow\Chapter'))
40                                         <i class="zmdi zmdi-collection-bookmark chapter-toggle"></i>
41                                     @else
42                                         <i class="zmdi zmdi-file-text"></i>
43                                     @endif
44                                     {{ $childElement->name }}
45                                 </a>
46                             </h3>
47                             <p class="text-muted">
48                                 {{$childElement->getExcerpt()}}
49                             </p>
50
51                             @if(is_a($childElement, 'Oxbow\Chapter') && count($childElement->pages) > 0)
52                                 <div class="inset-list">
53                                     @foreach($childElement->pages as $page)
54                                         <h4><a href="{{$page->getUrl()}}"><i class="zmdi zmdi-file-text"></i> {{$page->name}}</a></h4>
55                                     @endforeach
56                                 </div>
57                             @endif
58                         </div>
59                         <hr>
60                     @endforeach
61                 </div>
62
63                 <p class="text-muted small">
64                     Created {{$book->created_at->diffForHumans()}} @if($book->createdBy) by {{$book->createdBy->name}} @endif
65                     <br>
66                     Last Updated {{$book->updated_at->diffForHumans()}} @if($book->createdBy) by {{$book->updatedBy->name}} @endif
67                 </p>
68
69             </div>
70
71         </div>
72
73         <div class="col-md-3 col-md-offset-1">
74             <div class="margin-top large"><br></div>
75             <h3>Recent Activity</h3>
76             @include('partials/activity-list', ['activity' => Activity::entityActivity($book, 20, 0)])
77         </div>
78     </div>
79
80
81
82
83     <script>
84         $(function() {
85
86             $('.chapter-toggle').click(function(e) {
87                 e.preventDefault();
88                 $(this).closest('.book-child').find('.inset-list').slideToggle(180);
89             });
90
91         });
92     </script>
93
94 @stop