_toc.blade.php 1.2 KB

12345678910111213141516171819202122232425262728
  1. {{-- resources/views/library/book/_toc.blade.php
  2. TOC 列表局部视图,在 offcanvas 和侧边栏中复用。
  3. 变量:$toc array,$anthologyId(可选)
  4. --}}
  5. @if(!empty($toc))
  6. <ul>
  7. @foreach ($toc as $item)
  8. <li class="toc_item toc-level-{{ $item['level'] }}
  9. {{ ($item['active'] ?? false) ? 'toc-active' : ($item['disabled'] ? 'toc-disabled' : '') }}">
  10. @if($item['active'] ?? false)
  11. <span title="{{ $item['title'] }}">{{ $item['title'] }}</span>
  12. @elseif(!$item['disabled'])
  13. @if(isset($anthologyId))
  14. <a href="{{ route('library.anthology.read', ['anthology' => $anthologyId, 'article' => $item['id'], 'channel' => request('channel')]) }}"
  15. title="{{ $item['title'] }}">{{ $item['title'] }}</a>
  16. @else
  17. <a href="{{ route('library.tipitaka.read', ['id' => $item['id'], 'channel' => request('channel')]) }}"
  18. title="{{ $item['title'] }}">{{ $item['title'] }}</a>
  19. @endif
  20. @else
  21. <span title="{{ $item['title'] }}">{{ $item['title'] }}</span>
  22. @endif
  23. </li>
  24. @endforeach
  25. </ul>
  26. @else
  27. <div class="alert alert-warning">此书没有目录</div>
  28. @endif