1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Added entity-specific search results pages. Cleaned & Fixed search results bugs

Added search result pages for pages, chapters and books.
Limited the results on the global search as it just listed out an infinate amount.
Fixed styling on new detailed page listings and also removed the 'bars' from the side to create  a cleaner view.
Fixed bad sql fulltext query format that may have thrown off searches.
Reduced the number of database queries down a thousand or so.
This commit is contained in:
Dan Brown
2016-02-21 12:53:58 +00:00
parent b4dec2a99c
commit 61577cf6bf
12 changed files with 222 additions and 100 deletions

View File

@ -10,7 +10,7 @@
<p class="text-muted">{{ $chapter->getExcerpt() }}</p>
@endif
@if(count($chapter->pages) > 0 && !isset($hidePages))
@if(!isset($hidePages) && count($chapter->pages) > 0)
<p class="text-muted chapter-toggle"><i class="zmdi zmdi-caret-right"></i> <i class="zmdi zmdi-file-text"></i> <span>{{ count($chapter->pages) }} Pages</span></p>
<div class="inset-list">
@foreach($chapter->pages as $page)

View File

@ -16,10 +16,10 @@
Last updated {{ $page->updated_at->diffForHumans() }} @if($page->updatedBy)by {{$page->updatedBy->name}} @endif
</div>
<div class="col-md-8">
<a class="text-book" href="{{ $page->book->getUrl() }}"><i class="zmdi zmdi-book"></i>{{ $page->book->getExcerpt(30) }}</a>
<a class="text-book" href="{{ $page->book->getUrl() }}"><i class="zmdi zmdi-book"></i>{{ $page->book->getShortName(30) }}</a>
<br>
@if($page->chapter)
<a class="text-chapter" href="{{ $page->chapter->getUrl() }}"><i class="zmdi zmdi-collection-bookmark"></i>{{ $page->chapter->getExcerpt(30) }}</a>
<a class="text-chapter" href="{{ $page->chapter->getUrl() }}"><i class="zmdi zmdi-collection-bookmark"></i>{{ $page->chapter->getShortName(30) }}</a>
@else
<i class="zmdi zmdi-collection-bookmark"></i> Page is not in a chapter
@endif

View File

@ -6,41 +6,36 @@
<h1>Search Results&nbsp;&nbsp;&nbsp; <span class="text-muted">{{$searchTerm}}</span></h1>
<p>
<a href="/search/pages?term={{$searchTerm}}" class="text-page"><i class="zmdi zmdi-file-text"></i>View all matched pages</a>
@if(count($chapters) > 0)
&nbsp; &nbsp;&nbsp;
<a href="/search/chapters?term={{$searchTerm}}" class="text-chapter"><i class="zmdi zmdi-collection-bookmark"></i>View all matched chapters</a>
@endif
@if(count($books) > 0)
&nbsp; &nbsp;&nbsp;
<a href="/search/books?term={{$searchTerm}}" class="text-book"><i class="zmdi zmdi-book"></i>View all matched books</a>
@endif
</p>
<div class="row">
<div class="col-md-6">
<h3>Matching Pages</h3>
<div class="page-list">
@if(count($pages) > 0)
@foreach($pages as $page)
@include('pages/list-item', ['page' => $page, 'style' => 'detailed'])
<hr>
@endforeach
@else
<p class="text-muted">No pages matched this search</p>
@endif
</div>
<h3><a href="/search/pages?term={{$searchTerm}}" class="no-color">Matching Pages</a></h3>
@include('partials/entity-list', ['entities' => $pages, 'style' => 'detailed'])
</div>
<div class="col-md-5 col-md-offset-1">
@if(count($books) > 0)
<h3>Matching Books</h3>
<div class="page-list">
@foreach($books as $book)
@include('books/list-item', ['book' => $book])
<hr>
@endforeach
</div>
<h3><a href="/search/books?term={{$searchTerm}}" class="no-color">Matching Books</a></h3>
@include('partials/entity-list', ['entities' => $books])
@endif
@if(count($chapters) > 0)
<h3>Matching Chapters</h3>
<div class="page-list">
@foreach($chapters as $chapter)
@include('chapters/list-item', ['chapter' => $chapter, 'hidePages' => true])
@endforeach
</div>
<h3><a href="/search/chapters?term={{$searchTerm}}" class="no-color">Matching Chapters</a></h3>
@include('partials/entity-list', ['entities' => $chapters])
@endif
</div>

View File

@ -0,0 +1,18 @@
@extends('base')
@section('content')
<div class="container">
<div class="row">
<div class="col-sm-7">
<h1>{{ $title }} <small>{{$searchTerm}}</small></h1>
@include('partials.entity-list', ['entities' => $entities, 'style' => 'detailed'])
{!! $entities->links() !!}
</div>
<div class="col-sm-4 col-sm-offset-1"></div>
</div>
</div>
@stop