mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-08-09 10:22:51 +03:00
Search: Added structure for search term inputs
Sets things up to allow more complex terms ready to handle negation.
This commit is contained in:
@@ -8,15 +8,18 @@
|
||||
<div>
|
||||
<h5>{{ trans('entities.search_advanced') }}</h5>
|
||||
|
||||
@php
|
||||
$filterMap = $options->filters->toValueMap();
|
||||
@endphp
|
||||
<form method="get" action="{{ url('/search') }}">
|
||||
<h6>{{ trans('entities.search_terms') }}</h6>
|
||||
<input type="text" name="search" value="{{ implode(' ', $options->searches) }}">
|
||||
<input type="text" name="search" value="{{ implode(' ', $options->searches->toValueArray()) }}">
|
||||
|
||||
<h6>{{ trans('entities.search_content_type') }}</h6>
|
||||
<div class="form-group">
|
||||
|
||||
<?php
|
||||
$types = explode('|', $options->filters['type'] ?? '');
|
||||
$types = explode('|', $filterMap['type'] ?? '');
|
||||
$hasTypes = $types[0] !== '';
|
||||
?>
|
||||
@include('search.parts.type-filter', ['checked' => !$hasTypes || in_array('page', $types), 'entity' => 'page', 'transKey' => 'page'])
|
||||
@@ -27,46 +30,43 @@
|
||||
</div>
|
||||
|
||||
<h6>{{ trans('entities.search_exact_matches') }}</h6>
|
||||
@include('search.parts.term-list', ['type' => 'exact', 'currentList' => $options->exacts])
|
||||
@include('search.parts.term-list', ['type' => 'exact', 'currentList' => $options->exacts->toValueArray()])
|
||||
|
||||
<h6>{{ trans('entities.search_tags') }}</h6>
|
||||
@include('search.parts.term-list', ['type' => 'tags', 'currentList' => $options->tags])
|
||||
@include('search.parts.term-list', ['type' => 'tags', 'currentList' => $options->tags->toValueArray()])
|
||||
|
||||
@if(!user()->isGuest())
|
||||
<h6>{{ trans('entities.search_options') }}</h6>
|
||||
|
||||
@component('search.parts.boolean-filter', ['filters' => $options->filters, 'name' => 'viewed_by_me', 'value' => null])
|
||||
@component('search.parts.boolean-filter', ['filters' => $filterMap, 'name' => 'viewed_by_me', 'value' => null])
|
||||
{{ trans('entities.search_viewed_by_me') }}
|
||||
@endcomponent
|
||||
@component('search.parts.boolean-filter', ['filters' => $options->filters, 'name' => 'not_viewed_by_me', 'value' => null])
|
||||
@component('search.parts.boolean-filter', ['filters' => $filterMap, 'name' => 'not_viewed_by_me', 'value' => null])
|
||||
{{ trans('entities.search_not_viewed_by_me') }}
|
||||
@endcomponent
|
||||
@component('search.parts.boolean-filter', ['filters' => $options->filters, 'name' => 'is_restricted', 'value' => null])
|
||||
@component('search.parts.boolean-filter', ['filters' => $filterMap, 'name' => 'is_restricted', 'value' => null])
|
||||
{{ trans('entities.search_permissions_set') }}
|
||||
@endcomponent
|
||||
@component('search.parts.boolean-filter', ['filters' => $options->filters, 'name' => 'created_by', 'value' => 'me'])
|
||||
@component('search.parts.boolean-filter', ['filters' => $filterMap, 'name' => 'created_by', 'value' => 'me'])
|
||||
{{ trans('entities.search_created_by_me') }}
|
||||
@endcomponent
|
||||
@component('search.parts.boolean-filter', ['filters' => $options->filters, 'name' => 'updated_by', 'value' => 'me'])
|
||||
@component('search.parts.boolean-filter', ['filters' => $filterMap, 'name' => 'updated_by', 'value' => 'me'])
|
||||
{{ trans('entities.search_updated_by_me') }}
|
||||
@endcomponent
|
||||
@component('search.parts.boolean-filter', ['filters' => $options->filters, 'name' => 'owned_by', 'value' => 'me'])
|
||||
@component('search.parts.boolean-filter', ['filters' => $filterMap, 'name' => 'owned_by', 'value' => 'me'])
|
||||
{{ trans('entities.search_owned_by_me') }}
|
||||
@endcomponent
|
||||
@endif
|
||||
|
||||
<h6>{{ trans('entities.search_date_options') }}</h6>
|
||||
@include('search.parts.date-filter', ['name' => 'updated_after', 'filters' => $options->filters])
|
||||
@include('search.parts.date-filter', ['name' => 'updated_before', 'filters' => $options->filters])
|
||||
@include('search.parts.date-filter', ['name' => 'created_after', 'filters' => $options->filters])
|
||||
@include('search.parts.date-filter', ['name' => 'created_before', 'filters' => $options->filters])
|
||||
@include('search.parts.date-filter', ['name' => 'updated_after', 'filters' => $filterMap])
|
||||
@include('search.parts.date-filter', ['name' => 'updated_before', 'filters' => $filterMap])
|
||||
@include('search.parts.date-filter', ['name' => 'created_after', 'filters' => $filterMap])
|
||||
@include('search.parts.date-filter', ['name' => 'created_before', 'filters' => $filterMap])
|
||||
|
||||
@if(isset($options->filters['created_by']) && $options->filters['created_by'] !== "me")
|
||||
<input type="hidden" name="filters[created_by]" value="{{ $options->filters['created_by'] }}">
|
||||
@endif
|
||||
@if(isset($options->filters['updated_by']) && $options->filters['updated_by'] !== "me")
|
||||
<input type="hidden" name="filters[updated_by]" value="{{ $options->filters['updated_by'] }}">
|
||||
@endif
|
||||
@foreach($options->getHiddenInputValuesByFieldName() as $fieldName => $value)
|
||||
<input type="hidden" name="{{ $fieldName }}" value="{{ $value }}">
|
||||
@endforeach
|
||||
|
||||
<button type="submit" class="button">{{ trans('entities.search_update') }}</button>
|
||||
</form>
|
||||
|
Reference in New Issue
Block a user