[COMPONENTS][Search] Polished template
[COMPONENTS][Search] Fix event typo
This commit is contained in:
parent
5cd96669fd
commit
f35dbbd8c1
|
@ -40,7 +40,7 @@ class Search extends Controller
|
||||||
$actor_qb = DB::createQueryBuilder();
|
$actor_qb = DB::createQueryBuilder();
|
||||||
$note_qb->select('note')->from('App\Entity\Note', 'note');
|
$note_qb->select('note')->from('App\Entity\Note', 'note');
|
||||||
$actor_qb->select('actor')->from('App\Entity\Actor', 'actor');
|
$actor_qb->select('actor')->from('App\Entity\Actor', 'actor');
|
||||||
Event::handle('SeachQueryAddJoins', [&$note_qb, &$actor_qb]);
|
Event::handle('SearchQueryAddJoins', [&$note_qb, &$actor_qb]);
|
||||||
$notes = $actors = [];
|
$notes = $actors = [];
|
||||||
if (!\is_null($note_criteria)) {
|
if (!\is_null($note_criteria)) {
|
||||||
$note_qb->addCriteria($note_criteria);
|
$note_qb->addCriteria($note_criteria);
|
||||||
|
|
|
@ -41,12 +41,13 @@ class Search extends Component
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the search form to the site header
|
* Add the search form to the site header
|
||||||
|
* @throws RedirectException
|
||||||
*/
|
*/
|
||||||
public function onAddExtraHeaderForms(Request $request, array &$elements)
|
public function onAddExtraHeaderForms(Request $request, array &$elements)
|
||||||
{
|
{
|
||||||
$form = Form::create([
|
$form = Form::create([
|
||||||
['query', TextType::class, [
|
['search_tags', TextType::class, [
|
||||||
'attr' => ['placeholder' => _m('Search tags...')],
|
'attr' => ['placeholder' => _m('Input desired query...')],
|
||||||
]],
|
]],
|
||||||
[$form_name = 'submit_search', SubmitType::class,
|
[$form_name = 'submit_search', SubmitType::class,
|
||||||
[
|
[
|
||||||
|
@ -63,7 +64,7 @@ class Search extends Component
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$data = $form->getData();
|
$data = $form->getData();
|
||||||
throw new RedirectException('search', ['q' => $data['query']]);
|
throw new RedirectException('search', ['q' => $data['search_tags']]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,42 @@
|
||||||
{% extends 'base.html.twig' %}
|
{% extends 'stdgrid.html.twig' %}
|
||||||
|
|
||||||
{% import '/cards/note/view.html.twig' as noteView %}
|
{% import '/cards/note/view.html.twig' as noteView %}
|
||||||
|
|
||||||
|
{% block title %}{% if page_title is defined %}{{ page_title | trans }}{% endif %}{% endblock %}
|
||||||
|
|
||||||
|
{% block stylesheets %}
|
||||||
|
{{ parent() }}
|
||||||
|
<link rel="stylesheet" href="{{ asset('assets/default_theme/css/pages/feeds.css') }}" type="text/css">
|
||||||
|
{% endblock stylesheets %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
{% if error %}
|
||||||
|
<label class="alert alert-danger">
|
||||||
|
{{ error.getMessage() }}
|
||||||
|
</label>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{# Backwards compatibility with hAtom 0.1 #}
|
||||||
|
<main class="feed" tabindex="0" role="feed">
|
||||||
|
<div class="h-feed hfeed notes">
|
||||||
|
{% if notes is defined and notes is not empty %}
|
||||||
{% for note in notes %}
|
{% for note in notes %}
|
||||||
{% block current_note %}
|
{% block current_note %}
|
||||||
<div class="section-widget">
|
<div class="section-widget">
|
||||||
{{ noteView.macro_note(note) }}
|
{{ noteView.macro_note(note) }}
|
||||||
|
<hr tabindex="0" title="{{ 'End of note and replies.' | trans }}">
|
||||||
</div>
|
</div>
|
||||||
{% endblock current_note %}
|
{% endblock current_note %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
<div id="empty-notes"><h1>{% trans %}No notes here.{% endtrans %}</h1></div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
{% for actor in actors %}
|
{% for actor in actors %}
|
||||||
{% include 'actor/view.html.twig' with {'actor': actor} %}
|
{% include 'actor/view.html.twig' with {'actor': actor} %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{{ "Page: " ~ page }}
|
{{ "Page: " ~ page }}
|
||||||
{% endblock %}
|
{% endblock body %}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user