-
-
Notifications
You must be signed in to change notification settings - Fork 9
Determine default template behavior for locator page #253
Copy link
Copy link
Open
Description
Summary
The locator module has two database fields that control default visibility behavior, but they require manual CMS configuration and the default values may not provide the expected user experience.
Current Behavior
| Field | Database Type | Default Value | Purpose |
|---|---|---|---|
ShowResultsDefault |
Boolean | false (assumed) |
Show locations on initial page load |
ShowFormDefault |
Boolean | true (assumed) |
Show the search form on initial page load |
Controller Logic:
LocationSearch()returnsnullifShowFormDefaultis false, hiding the formindex()returns emptyArrayListifShowResultsDefaultis false, showing no locations
User Experience Issue
When a user visits /locator for the first time:
- Form is hidden (unless
ShowFormDefault = truein CMS) - No locations shown (unless
ShowResultsDefault = truein CMS) - User sees empty page with no guidance
This requires administrators to manually configure these settings in the CMS for basic functionality.
Current Implementation
// Locator.php - Database fields
private static $db = [
'Unit' => 'Enum("m,km","m")',
'ShowResultsDefault' => 'Boolean',
'ShowFormDefault' => 'Boolean',
];
// LocatorController.php
public function LocationSearch(): ?LocatorForm
{
if (!$this->ShowFormDefault) {
return null; // Form hidden
}
// ...
}
public function index(HTTPRequest $request)
{
if ($this->getTrigger($request) || $this->ShowResultsDefault) {
$locations = $this->getLocations();
} else {
$locations = ArrayList::create(); // Empty
}
// ...
}Recommended Approach
Option A: Show form by default, hide results
ShowFormDefault = true(show search form)ShowResultsDefault = false(don't show results until search)- User sees search form with no results initially
Option B: Show form AND results by default
ShowFormDefault = trueShowResultsDefault = true- User sees search form and all locations on initial load
Option C: Remove these fields entirely
- Always show form
- Always show all locations (or add a setting)
- Simplifies the module configuration
Recommendation
Option A seems most appropriate for most use cases:
- Users see the search form immediately
- Results are only shown after aents showing empty state search (prev)
- Maintains the search-first paradigm
However, some use cases (like a directory) might want Option B.
Next Steps
- Decide on the default behavior
- Set appropriate defaults in
Locator::$defaults - Update controller logic if needed
- Update documentation
Labels: enhancement, user-experience, help-wanted
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels