BookStack/resources/views/pages/show.blade.php

99 lines
3.4 KiB
PHP
Raw Normal View History

2015-07-12 16:31:15 -04:00
@extends('base')
@section('content')
<div class="row faded-small">
<div class="col-md-6 faded">
2015-07-21 17:11:30 -04:00
<div class="breadcrumbs padded-horizontal">
<a href="{{$book->getUrl()}}"><i class="zmdi zmdi-book"></i>{{ $book->name }}</a>
@if($page->hasChapter())
<span class="sep">&raquo;</span>
<a href="{{ $page->chapter->getUrl() }}">
<i class="zmdi zmdi-collection-bookmark"></i>
{{$page->chapter->name}}
</a>
2015-07-20 17:05:26 -04:00
@endif
</div>
2015-07-15 17:55:49 -04:00
</div>
<div class="col-md-6 faded">
<div class="action-buttons">
<a href="{{$page->getUrl() . '/edit'}}" class="text-primary" ><i class="zmdi zmdi-edit"></i>Edit</a>
<a href="{{$page->getUrl() . '/delete'}}" class="text-neg"><i class="zmdi zmdi-delete"></i>Delete</a>
</div>
</div>
2015-07-12 16:31:15 -04:00
</div>
2015-07-15 17:55:49 -04:00
<div class="side-nav faded">
<h4>Page Navigation</h4>
<ul class="page-nav-list">
</ul>
</div>
2015-07-21 17:11:30 -04:00
<div class="page-content">
<h1>{{$page->name}}</h1>
@if(count($page->children) > 0)
<h4 class="text-muted">Sub-pages</h4>
<div class="page-list">
@foreach($page->children as $childPage)
<a href="{{ $childPage->getUrl() }}">{{ $childPage->name }}</a>
@endforeach
</div>
@endif
{!! $page->html !!}
</div>
2015-07-15 17:55:49 -04:00
<script>
$(document).ready(function() {
// Set up document navigation
var pageNav = $('.page-nav-list');
var pageContent = $('.page-content');
var headers = pageContent.find('h1, h2, h3, h4, h5, h6');
if(headers.length > 5) {
headers.each(function() {
var header = $(this);
var tag = header.prop('tagName');
var listElem = $('<li></li>').addClass('nav-'+tag);
var link = $('<a></a>').text(header.text().trim()).attr('href', '#');
listElem.append(link);
pageNav.append(listElem);
link.click(function(e) {
e.preventDefault();
header.smoothScrollTo();
})
});
} else {
$('.side-nav').hide();
}
2015-07-16 14:15:22 -04:00
// Set up link hooks
var pageId = {{$page->id}};
headers.each(function() {
var text = $(this).text().trim();
var link = '/link/' + pageId + '#' + encodeURIComponent(text);
2015-07-30 18:43:18 -04:00
var linkHook = $('<a class="link-hook"><i class="zmdi zmdi-link"></i></a>')
2015-07-16 14:15:22 -04:00
.attr({"data-content": link, href: link, target: '_blank'});
linkHook.click(function(e) {
e.preventDefault();
goToText(text);
});
$(this).append(linkHook);
});
function goToText(text) {
$('.page-content').find(':contains("'+text+'")').smoothScrollTo();
}
if(window.location.hash) {
var text = window.location.hash.replace(/\%20/g, ' ').substr(1);
goToText(text);
}
//$('[data-toggle="popover"]').popover()
2015-07-15 17:55:49 -04:00
});
</script>
2015-07-12 16:31:15 -04:00
@stop