BookStack/resources/views/partials/book-tree.blade.php
Dan Brown 3f3fad7113
Fixed book-tree-gen page visibility issue
When book trees were generated, pages in chapters where ALL pages within
were not supposed to be visibile, would be visible due to the code
falling back on the raw relation which would not account for
permissions.

This has now been changed so that a custom 'visible_pages' attribute is set and used by any book tree structures, to ensure it does not fall back to the raw relation.

Added an extra test to cover.

For #2414
2020-12-17 17:31:18 +00:00

35 lines
1.5 KiB
PHP

<nav id="book-tree"
class="book-tree mb-xl"
aria-label="{{ trans('entities.books_navigation') }}">
<h5>{{ trans('entities.books_navigation') }}</h5>
<ul class="sidebar-page-list mt-xs menu entity-list">
@if (userCan('view', $book))
<li class="list-item-book book">
@include('partials.entity-list-item-basic', ['entity' => $book, 'classes' => ($current->matches($book)? 'selected' : '')])
</li>
@endif
@foreach($sidebarTree as $bookChild)
<li class="list-item-{{ $bookChild->getClassName() }} {{ $bookChild->getClassName() }} {{ $bookChild->isA('page') && $bookChild->draft ? 'draft' : '' }}">
@include('partials.entity-list-item-basic', ['entity' => $bookChild, 'classes' => $current->matches($bookChild)? 'selected' : ''])
@if($bookChild->isA('chapter') && count($bookChild->visible_pages) > 0)
<div class="entity-list-item no-hover">
<span role="presentation" class="icon text-chapter"></span>
<div class="content">
@include('chapters.child-menu', [
'chapter' => $bookChild,
'current' => $current,
'isOpen' => $bookChild->matchesOrContains($current)
])
</div>
</div>
@endif
</li>
@endforeach
</ul>
</nav>