mirror of
https://github.com/a2nt/silverstripe-webpack.git
synced 2024-10-22 17:05:31 +02:00
[IMPR] Minor search improvements
This commit is contained in:
parent
56a58e3d6c
commit
0e70a5c690
@ -15,6 +15,7 @@ use SilverStripe\Control\Controller;
|
||||
use SilverStripe\Control\Director;
|
||||
use SilverStripe\Control\HTTPRequest;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\ErrorPage\ErrorPage;
|
||||
use SilverStripe\Forms\FieldList;
|
||||
use SilverStripe\Forms\Form;
|
||||
use SilverStripe\Forms\FormAction;
|
||||
@ -93,7 +94,7 @@ class PageController extends ContentController
|
||||
__FUNCTION__,
|
||||
FieldList::create(
|
||||
TextField::create('q', 'Search ...')
|
||||
->setAttribute('placeholder', 'Search ' . $config->getField('Title') . ' Website')
|
||||
->setAttribute('placeholder', 'What are you looking for?')
|
||||
),
|
||||
FieldList::create(
|
||||
FormAction::create(
|
||||
@ -135,6 +136,7 @@ class PageController extends ContentController
|
||||
$pages = SiteTree::get()->filterAny([
|
||||
'Title:PartialMatch' => $term,
|
||||
'Content:PartialMatch' => $term,
|
||||
'ClassName:not' => ErrorPage::class,
|
||||
])->sort('Created DESC');
|
||||
|
||||
$results->merge($pages);
|
||||
@ -166,7 +168,12 @@ class PageController extends ContentController
|
||||
);
|
||||
|
||||
foreach ($elements as $element) {
|
||||
$page = $element->Page();
|
||||
$page = $element->getPage();
|
||||
|
||||
if (!$element->hasMethod('getPage')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! $page) {
|
||||
continue;
|
||||
}
|
||||
|
@ -10,29 +10,29 @@
|
||||
<div class="element element-search-results">
|
||||
<div class="element-container {$Top.DefaultContainer}">
|
||||
<% if $Results %>
|
||||
<div id="SearchAccordion{$ID}">
|
||||
<div id="SearchAccordion{$ID}" class="accordion accordion-flush">
|
||||
<% loop $Results %>
|
||||
<div class="card">
|
||||
<div class="card-header" id="Heading{$ID}{$Up.ID}">
|
||||
<h3
|
||||
class="mb-0 a"
|
||||
data-bs-toggle="collapse"
|
||||
data-bs-target="#Collapse{$ID}{$Up.ID}"
|
||||
aria-expanded="false"
|
||||
aria-controls="Collapse{$ID}{$Up.ID}"
|
||||
>
|
||||
$Title
|
||||
<i class="fas fa-plus accordion-icon pull-right"></i>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="accordion-item">
|
||||
<h3 class="accordion-header">
|
||||
<button
|
||||
class="accordion-button collapsed"
|
||||
type="button"
|
||||
data-bs-toggle="collapse"
|
||||
data-bs-target="#Collapse{$ID}{$Up.ID}"
|
||||
aria-expanded="false"
|
||||
aria-controls="Collapse{$ID}{$Up.ID}"
|
||||
>
|
||||
$Title
|
||||
</button>
|
||||
</h3>
|
||||
|
||||
<div
|
||||
id="Collapse{$ID}{$Up.ID}"
|
||||
class="collapse"
|
||||
class="accordion-collapse collapse"
|
||||
aria-labelledby="Heading{$ID}{$Up.ID}"
|
||||
data-bs-parent="#SearchAccordion{$Up.ID}"
|
||||
>
|
||||
<div class="card-body">
|
||||
<div class="accordion-body">
|
||||
<p>$Summary(100)</p>
|
||||
<a href="{$Link}">Learn More</a>
|
||||
</div>
|
||||
@ -41,7 +41,7 @@
|
||||
<% end_loop %>
|
||||
</div>
|
||||
<% else %>
|
||||
<h3>Nothing was found.</h3>
|
||||
<h3 class="alert alert-danger not-found">Nothing was found.</h3>
|
||||
<% end_if %>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user