diff options
| author | Greg Roach <greg@subaqua.co.uk> | 2021-06-28 18:42:28 +0100 |
|---|---|---|
| committer | Greg Roach <greg@subaqua.co.uk> | 2021-06-28 18:42:28 +0100 |
| commit | 058ba7243339e0f2f5f84aa0f772e56ee5252797 (patch) | |
| tree | 5e37f55087df7b77800dcb7c915b0cee1061dba5 /resources | |
| parent | b403cedd081696643a934eb21948c1f631a84d88 (diff) | |
| download | webtrees-058ba7243339e0f2f5f84aa0f772e56ee5252797.tar.gz webtrees-058ba7243339e0f2f5f84aa0f772e56ee5252797.tar.bz2 webtrees-058ba7243339e0f2f5f84aa0f772e56ee5252797.zip | |
Fix: #3786 - add locations to the general search
Diffstat (limited to 'resources')
| -rw-r--r-- | resources/views/search-advanced-page.phtml | 2 | ||||
| -rw-r--r-- | resources/views/search-general-page.phtml | 104 | ||||
| -rw-r--r-- | resources/views/search-phonetic-page.phtml | 2 | ||||
| -rw-r--r-- | resources/views/search-results.phtml | 20 |
4 files changed, 88 insertions, 40 deletions
diff --git a/resources/views/search-advanced-page.phtml b/resources/views/search-advanced-page.phtml index 7d7e1235aa..300ba2cf30 100644 --- a/resources/views/search-advanced-page.phtml +++ b/resources/views/search-advanced-page.phtml @@ -96,7 +96,7 @@ use Illuminate\Support\Collection; <?= I18N::translate('No results found.') ?> </div> <?php else : ?> - <?= view('search-results', ['individuals' => $individuals, 'search_families' => false, 'search_individuals' => true, 'search_notes' => false, 'search_sources' => false, 'search_repositories' => false, 'tree' => $tree]) ?> + <?= view('search-results', ['individuals' => $individuals, 'search_families' => false, 'search_individuals' => true, 'search_locations' => false, 'search_notes' => false, 'search_sources' => false, 'search_repositories' => false, 'tree' => $tree]) ?> <?php endif ?> <?php endif ?> diff --git a/resources/views/search-general-page.phtml b/resources/views/search-general-page.phtml index 54636f7618..d42974eaa9 100644 --- a/resources/views/search-general-page.phtml +++ b/resources/views/search-general-page.phtml @@ -1,26 +1,38 @@ <?php +use Fisharebest\Webtrees\Family; use Fisharebest\Webtrees\Http\RequestHandlers\SearchGeneralAction; use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Individual; +use Fisharebest\Webtrees\Location; +use Fisharebest\Webtrees\Note; +use Fisharebest\Webtrees\Repository; +use Fisharebest\Webtrees\Source; use Fisharebest\Webtrees\Tree; use Illuminate\Support\Collection; /** - * @var Collection<Tree> $all_trees - * @var Collection $families - * @var Collection $individuals - * @var Collection $notes - * @var string $query - * @var Collection $repositories - * @var Collection $sources - * @var bool $search_families - * @var bool $search_individuals - * @var bool $search_notes - * @var bool $search_repositories - * @var bool $search_sources - * @var Collection<Tree> $search_trees - * @var string $title - * @var Tree $tree + * @var Collection<Tree> $all_trees + * @var bool $exist_locations + * @var bool $exist_notes + * @var bool $exist_repositories + * @var bool $exist_sources + * @var Collection<Family> $families + * @var Collection<Individual> $individuals + * @var Collection<Location> $locations + * @var Collection<Note> $notes + * @var string $query + * @var Collection<Repository> $repositories + * @var Collection<Source> $sources + * @var bool $search_families + * @var bool $search_individuals + * @var bool $search_locations + * @var bool $search_notes + * @var bool $search_repositories + * @var bool $search_sources + * @var Collection<Tree> $search_trees + * @var string $title + * @var Tree $tree */ ?> @@ -65,29 +77,45 @@ use Illuminate\Support\Collection; </label> </div> - <div class="form-check form-check-inline"> - <label class="form-check-label"> - <input class="form-check-input" <?= $search_sources ? 'checked' : '' ?> name="search_sources" - type="checkbox"> - <?= I18N::translate('Sources') ?> - </label> - </div> + <?php if ($exist_sources) : ?> + <div class="form-check form-check-inline"> + <label class="form-check-label"> + <input class="form-check-input" <?= $search_sources ? 'checked' : '' ?> name="search_sources" + type="checkbox"> + <?= I18N::translate('Sources') ?> + </label> + </div> + <?php endif ?> - <div class="form-check form-check-inline"> - <label class="form-check-label"> - <input class="form-check-input" <?= $search_repositories ? 'checked' : '' ?> - name="search_repositories" type="checkbox"> - <?= I18N::translate('Repositories') ?> - </label> - </div> + <?php if ($exist_repositories) : ?> + <div class="form-check form-check-inline"> + <label class="form-check-label"> + <input class="form-check-input" <?= $search_repositories ? 'checked' : '' ?> + name="search_repositories" type="checkbox"> + <?= I18N::translate('Repositories') ?> + </label> + </div> + <?php endif ?> - <div class="form-check form-check-inline"> - <label class="form-check-label"> - <input class="form-check-input" <?= $search_notes ? 'checked' : '' ?> name="search_notes" - type="checkbox"> - <?= I18N::translate('Shared notes') ?> - </label> - </div> + <?php if ($exist_notes) : ?> + <div class="form-check form-check-inline"> + <label class="form-check-label"> + <input class="form-check-input" <?= $search_notes ? 'checked' : '' ?> name="search_notes" + type="checkbox"> + <?= I18N::translate('Shared notes') ?> + </label> + </div> + <?php endif ?> + + <?php if ($exist_locations) : ?> + <div class="form-check form-check-inline"> + <label class="form-check-label"> + <input class="form-check-input" <?= $search_locations ? 'checked' : '' ?> name="search_locations" + type="checkbox"> + <?= I18N::translate('Locations') ?> + </label> + </div> + <?php endif ?> </div> </div> </fieldset> @@ -104,12 +132,12 @@ use Illuminate\Support\Collection; </form> <?php if ($query !== '') : ?> - <?php if ($individuals->isEmpty() && $families->isEmpty() && $repositories->isEmpty() && $sources->isEmpty() && $notes->isEmpty()) : ?> + <?php if ($individuals->isEmpty() && $families->isEmpty() && $locations->isEmpty() && $repositories->isEmpty() && $sources->isEmpty() && $notes->isEmpty()) : ?> <div class="alert alert-info row"> <?= I18N::translate('No results found.') ?> </div> <?php else : ?> - <?= view('search-results', ['families' => $families, 'individuals' => $individuals, 'notes' => $notes, 'repositories' => $repositories, 'sources' => $sources, 'search_families' => $search_families, 'search_individuals' => $search_individuals, 'search_notes' => $search_notes, 'search_repositories' => $search_repositories, 'search_sources' => $search_sources, 'tree' => $tree]) ?> + <?= view('search-results', ['families' => $families, 'individuals' => $individuals, 'locations' => $locations, 'notes' => $notes, 'repositories' => $repositories, 'sources' => $sources, 'search_families' => $search_families, 'search_individuals' => $search_individuals, 'search_locations' => $search_locations, 'search_notes' => $search_notes, 'search_repositories' => $search_repositories, 'search_sources' => $search_sources, 'tree' => $tree]) ?> <?php endif ?> <?php endif ?> diff --git a/resources/views/search-phonetic-page.phtml b/resources/views/search-phonetic-page.phtml index e2921ff91b..3d1baed59a 100644 --- a/resources/views/search-phonetic-page.phtml +++ b/resources/views/search-phonetic-page.phtml @@ -98,7 +98,7 @@ use Illuminate\Support\Collection; <?= I18N::translate('No results found.') ?> </div> <?php else : ?> - <?= view('search-results', ['individuals' => $individuals, 'search_families' => false, 'search_individuals' => true, 'search_notes' => false, 'search_sources' => false, 'search_repositories' => false, 'tree' => $tree]) ?> + <?= view('search-results', ['individuals' => $individuals, 'search_families' => false, 'search_individuals' => true, 'search_locations' => false, 'search_notes' => false, 'search_sources' => false, 'search_repositories' => false, 'tree' => $tree]) ?> <?php endif ?> <?php endif ?> diff --git a/resources/views/search-results.phtml b/resources/views/search-results.phtml index cc82602854..0b228baac8 100644 --- a/resources/views/search-results.phtml +++ b/resources/views/search-results.phtml @@ -3,6 +3,7 @@ use Fisharebest\Webtrees\Family; use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Individual; +use Fisharebest\Webtrees\Location; use Fisharebest\Webtrees\Note; use Fisharebest\Webtrees\Repository; use Fisharebest\Webtrees\Source; @@ -13,11 +14,13 @@ use Illuminate\Support\Collection; /** * @var Collection<Family> $families * @var Collection<Individual> $individuals + * @var Collection<Location> $locations * @var Collection<Note> $notes * @var Collection<Repository> $repositories * @var Collection<Source> $sources * @var bool $search_families * @var bool $search_individuals + * @var bool $search_locations * @var bool $search_notes * @var bool $search_repositories * @var bool $search_sources @@ -82,6 +85,17 @@ use Illuminate\Support\Collection; </a> </li> <?php endif ?> + + <?php if ($search_locations) : ?> + <li class="nav-item" role="presentation"> + <a class="nav-link <?= $locations->isEmpty() ? 'text-muted' : '' ?>" id="locations-tab" data-toggle="tab" href="#locations" role="tab" aria-controls="locations"> + <?= I18N::translate('Locations') ?> + <span class="badge badge-secondary"> + <?= I18N::number(count($locations)) ?> + </span> + </a> + </li> + <?php endif ?> </ul> <div class="tab-content wt-search-results-content"> @@ -114,6 +128,12 @@ use Illuminate\Support\Collection; <?= view('lists/notes-table', ['notes' => $notes, 'tree' => $tree]) ?> </div> <?php endif ?> + + <?php if ($search_locations) : ?> + <div class="tab-pane fade" id="locations" role="tabpanel" aria-labelledby="locations-tab"> + <?= view('lists/locations-table', ['locations' => $locations, 'tree' => $tree]) ?> + </div> + <?php endif ?> </div> </div> |
