]> BookStack Code Mirror - bookstack/blob - resources/views/pages/show.blade.php
6376e42bd4aedf77ba3ef1d4c2e814f7d3563160
[bookstack] / resources / views / pages / show.blade.php
1 @extends('base')
2
3 @section('content')
4
5     <div class="row faded-small">
6         <div class="col-md-6 faded">
7             <div class="breadcrumbs padded-horizontal">
8                 <a href="{{$book->getUrl()}}"><i class="zmdi zmdi-book"></i>{{ $book->name }}</a>
9                 @if($page->hasChapter())
10                     <span class="sep">&raquo;</span>
11                     <a href="{{ $page->chapter->getUrl() }}">
12                         <i class="zmdi zmdi-collection-bookmark"></i>
13                         {{$page->chapter->name}}
14                     </a>
15                 @endif
16             </div>
17         </div>
18         <div class="col-md-6 faded">
19             <div class="action-buttons">
20                 <a href="{{$page->getUrl() . '/revisions'}}" class="text-primary"><i class="zmdi zmdi-replay"></i>Revisions</a>
21                 <a href="{{$page->getUrl() . '/edit'}}" class="text-primary" ><i class="zmdi zmdi-edit"></i>Edit</a>
22                 <a href="{{$page->getUrl() . '/delete'}}" class="text-neg"><i class="zmdi zmdi-delete"></i>Delete</a>
23             </div>
24         </div>
25     </div>
26
27     <div class="side-nav faded">
28         <h4>Page Navigation</h4>
29         <ul class="page-nav-list">
30         </ul>
31     </div>
32
33
34     <div class="page-content">
35         @include('pages/page-display')
36         <hr>
37         <p class="text-muted small">
38             Created {{$page->created_at->diffForHumans()}} @if($page->createdBy) by {{$page->createdBy->name}} @endif
39             <br>
40             Last Updated {{$page->updated_at->diffForHumans()}} @if($page->createdBy) by {{$page->updatedBy->name}} @endif
41         </p>
42     </div>
43
44
45     <script>
46         $(document).ready(function() {
47
48             // Set up document navigation
49             var pageNav = $('.page-nav-list');
50             var pageContent = $('.page-content');
51             var headers = pageContent.find('h1, h2, h3, h4, h5, h6');
52             if(headers.length > 5) {
53                 headers.each(function() {
54                     var header = $(this);
55                     var tag = header.prop('tagName');
56                     var listElem = $('<li></li>').addClass('nav-'+tag);
57                     var link = $('<a></a>').text(header.text().trim()).attr('href', '#');
58                     listElem.append(link);
59                     pageNav.append(listElem);
60                     link.click(function(e) {
61                         e.preventDefault();
62                         header.smoothScrollTo();
63                     })
64                 });
65                 $('.side-nav').fadeIn();
66             } else {
67                 $('.side-nav').hide();
68             }
69
70
71             // Set up link hooks
72             var pageId = {{$page->id}};
73             headers.each(function() {
74                 var text = $(this).text().trim();
75                 var link = '/link/' + pageId + '#' + encodeURIComponent(text);
76                 var linkHook = $('<a class="link-hook"><i class="zmdi zmdi-link"></i></a>')
77                         .attr({"data-content": link, href: link, target: '_blank'});
78                 linkHook.click(function(e) {
79                     e.preventDefault();
80                     goToText(text);
81                 });
82                 $(this).append(linkHook);
83             });
84
85             function goToText(text) {
86                 $('.page-content').find(':contains("'+text+'")').smoothScrollTo();
87             }
88
89             if(window.location.hash) {
90                 var text = window.location.hash.replace(/\%20/g, ' ').substr(1);
91                 goToText(text);
92             }
93
94             //$('[data-toggle="popover"]').popover()
95         });
96     </script>
97
98     <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.7/styles/solarized_light.min.css">
99     <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.7/highlight.min.js"></script>
100     <script>
101         window.onload = function() {
102             var aCodes = document.getElementsByTagName('pre');
103             for (var i=0; i < aCodes.length; i++) {
104                 hljs.highlightBlock(aCodes[i]);
105             }
106         };
107     </script>
108 @stop