mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-03 07:49:57 +00:00
Prevented created/update_by filters be wiped in search
Updating filters via sidebar would wipe the created_by/update_by filters since these were not part of the sidebar filter form. This adds them, if existing, as hidden inputs. Includes tests to cover. Closes #2736
This commit is contained in:
parent
8e71cd9bac
commit
2e49b16177
2 changed files with 14 additions and 0 deletions
|
@ -61,6 +61,13 @@
|
||||||
@include('search.parts.date-filter', ['name' => 'created_after', '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' => 'created_before', 'filters' => $options->filters])
|
||||||
|
|
||||||
|
@if(isset($options->filters['created_by']))
|
||||||
|
<input type="hidden" name="filters[created_by]" value="{{ $options->filters['created_by'] }}">
|
||||||
|
@endif
|
||||||
|
@if(isset($options->filters['updated_by']))
|
||||||
|
<input type="hidden" name="filters[updated_by]" value="{{ $options->filters['updated_by'] }}">
|
||||||
|
@endif
|
||||||
|
|
||||||
<button type="submit" class="button">{{ trans('entities.search_update') }}</button>
|
<button type="submit" class="button">{{ trans('entities.search_update') }}</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
|
@ -411,4 +411,11 @@ class EntitySearchTest extends TestCase
|
||||||
$search->assertSee('My <cool> <strong>TestPageContent</strong>', false);
|
$search->assertSee('My <cool> <strong>TestPageContent</strong>', false);
|
||||||
$search->assertSee('My supercool <great> <strong>TestPageContent</strong> page', false);
|
$search->assertSee('My supercool <great> <strong>TestPageContent</strong> page', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_searches_with_user_filters_adds_them_into_advanced_search_form()
|
||||||
|
{
|
||||||
|
$resp = $this->asEditor()->get('/search?term=' . urlencode('test {updated_by:me} {created_by:dan}'));
|
||||||
|
$resp->assertElementExists('form input[type="hidden"][name="filters[updated_by]"][value="me"]');
|
||||||
|
$resp->assertElementExists('form input[type="hidden"][name="filters[created_by]"][value="dan"]');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue