]> BookStack Code Mirror - bookstack/blob - resources/views/books/show.blade.php
Tweaked some styles and started automated testing. Fixes #11.
[bookstack] / resources / views / books / show.blade.php
1 @extends('base')
2
3 @section('content')
4
5     <div class="faded-small">
6         <div class="container">
7             <div class="row">
8                 <div class="col-md-12">
9                     <div class="action-buttons faded">
10                         @if($currentUser->can('page-create'))
11                             <a href="{{$book->getUrl() . '/page/create'}}" class="text-pos text-button"><i class="zmdi zmdi-plus"></i> New Page</a>
12                         @endif
13                         @if($currentUser->can('chapter-create'))
14                             <a href="{{$book->getUrl() . '/chapter/create'}}" class="text-pos text-button"><i class="zmdi zmdi-plus"></i> New Chapter</a>
15                         @endif
16                         @if($currentUser->can('book-update'))
17                             <a href="{{$book->getEditUrl()}}" class="text-primary text-button"><i class="zmdi zmdi-edit"></i>Edit</a>
18                             <a href="{{ $book->getUrl() }}/sort" class="text-primary text-button"><i class="zmdi zmdi-sort"></i>Sort</a>
19                         @endif
20                         @if($currentUser->can('book-delete'))
21                             <a href="{{ $book->getUrl() }}/delete" class="text-neg text-button"><i class="zmdi zmdi-delete"></i>Delete</a>
22                         @endif
23                     </div>
24                 </div>
25             </div>
26         </div>
27     </div>
28
29
30     <div class="container" id="book-dashboard">
31         <div class="row">
32             <div class="col-md-7">
33
34                 <h1>{{$book->name}}</h1>
35                 <div class="book-content anim fadeIn" v-if="!searching">
36                     <p class="text-muted">{{$book->description}}</p>
37
38                     <div class="page-list">
39                         <hr>
40                         @if(count($book->children()) > 0)
41                             @foreach($book->children() as $childElement)
42                                 <div class="book-child {{ $childElement->getName() }}">
43                                     <h3>
44                                         <a href="{{ $childElement->getUrl() }}" class="{{ $childElement->getName() }}">
45                                             <i class="zmdi {{ $childElement->isA('chapter') ? 'zmdi-collection-bookmark':'zmdi-file-text'}}"></i>{{ $childElement->name }}
46                                         </a>
47                                     </h3>
48                                     <p class="text-muted">
49                                         {{$childElement->getExcerpt()}}
50                                     </p>
51
52                                     @if($childElement->isA('chapter') && count($childElement->pages) > 0)
53                                         <p class="text-muted chapter-toggle open"><i class="zmdi zmdi-caret-right"></i> {{ count($childElement->pages) }} Pages</p>
54                                         <div class="inset-list">
55                                             @foreach($childElement->pages as $page)
56                                                 <h4><a href="{{$page->getUrl()}}"><i class="zmdi zmdi-file-text"></i>{{$page->name}}</a></h4>
57                                             @endforeach
58                                         </div>
59                                     @endif
60                                 </div>
61                                 <hr>
62                             @endforeach
63                         @else
64                             <p class="text-muted">No pages or chapters have been created for this book.</p>
65                             <p>
66                                 <a href="{{$book->getUrl() . '/page/create'}}" class="text-page"><i class="zmdi zmdi-file-text"></i>Create a new page</a>
67                                 &nbsp;&nbsp;<em class="text-muted">-or-</em>&nbsp;&nbsp;&nbsp;
68                                 <a href="{{$book->getUrl() . '/chapter/create'}}" class="text-chapter"><i class="zmdi zmdi-collection-bookmark"></i>Add a chapter</a>
69                             </p>
70                             <hr>
71                         @endif
72                         <p class="text-muted small">
73                             Created {{$book->created_at->diffForHumans()}} @if($book->createdBy) by {{$book->createdBy->name}} @endif
74                             <br>
75                             Last Updated {{$book->updated_at->diffForHumans()}} @if($book->createdBy) by {{$book->updatedBy->name}} @endif
76                         </p>
77                     </div>
78                 </div>
79                 <div class="search-results" v-if="searching">
80                     <h3 class="text-muted">Search Results <a v-if="searching" v-on="click: clearSearch" class="text-small"><i class="zmdi zmdi-close"></i>Clear Search</a></h3>
81                     <div v-html="searchResults"></div>
82                 </div>
83
84
85             </div>
86
87             <div class="col-md-4 col-md-offset-1">
88                 <div class="margin-top large"></div>
89                 {{--<h3>Search This Book</h3>--}}
90                 <div class="search-box">
91                     <form v-on="submit: searchBook, input: checkSearchForm" v-el="form" action="/search/book/{{ $book->id }}">
92                         {!! csrf_field() !!}
93                         <input v-model="searchTerm" type="text" name="term" placeholder="Search This Book">
94                         <button type="submit"><i class="zmdi zmdi-search"></i></button>
95                         <button v-if="searching" v-on="click: clearSearch" type="button primary"><i class="zmdi zmdi-close"></i></button>
96                     </form>
97                 </div>
98                 <div class="activity anim fadeIn">
99                     <h3>Recent Activity</h3>
100                     @include('partials/activity-list', ['activity' => Activity::entityActivity($book, 20, 0)])
101                 </div>
102             </div>
103         </div>
104     </div>
105
106
107
108     <script>
109         $(function() {
110
111             $('.chapter-toggle').click(function(e) {
112                 e.preventDefault();
113                 $(this).toggleClass('open');
114                 $(this).closest('.book-child').find('.inset-list').slideToggle(180);
115             });
116
117         });
118     </script>
119
120     <script src="/js/book-sidebar.js"></script>
121
122 @stop