[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();
|
||||
$note_qb->select('note')->from('App\Entity\Note', 'note');
|
||||
$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 = [];
|
||||
if (!\is_null($note_criteria)) {
|
||||
$note_qb->addCriteria($note_criteria);
|
||||
|
|
|
@ -41,12 +41,13 @@ class Search extends Component
|
|||
|
||||
/**
|
||||
* Add the search form to the site header
|
||||
* @throws RedirectException
|
||||
*/
|
||||
public function onAddExtraHeaderForms(Request $request, array &$elements)
|
||||
{
|
||||
$form = Form::create([
|
||||
['query', TextType::class, [
|
||||
'attr' => ['placeholder' => _m('Search tags...')],
|
||||
['search_tags', TextType::class, [
|
||||
'attr' => ['placeholder' => _m('Input desired query...')],
|
||||
]],
|
||||
[$form_name = 'submit_search', SubmitType::class,
|
||||
[
|
||||
|
@ -63,7 +64,7 @@ class Search extends Component
|
|||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$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 %}
|
||||
|
||||
{% 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 %}
|
||||
{% for note in notes %}
|
||||
{% block current_note %}
|
||||
<div class="section-widget">
|
||||
{{ noteView.macro_note(note) }}
|
||||
</div>
|
||||
{% endblock current_note %}
|
||||
{% endfor %}
|
||||
{% if error %}
|
||||
<label class="alert alert-danger">
|
||||
{{ error.getMessage() }}
|
||||
</label>
|
||||
{% endif %}
|
||||
|
||||
{% for actor in actors %}
|
||||
{% include 'actor/view.html.twig' with {'actor': actor} %}
|
||||
{% endfor %}
|
||||
{# 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 %}
|
||||
{% block current_note %}
|
||||
<div class="section-widget">
|
||||
{{ noteView.macro_note(note) }}
|
||||
<hr tabindex="0" title="{{ 'End of note and replies.' | trans }}">
|
||||
</div>
|
||||
{% endblock current_note %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<div id="empty-notes"><h1>{% trans %}No notes here.{% endtrans %}</h1></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
{{ "Page: " ~ page }}
|
||||
{% endblock %}
|
||||
{% for actor in actors %}
|
||||
{% include 'actor/view.html.twig' with {'actor': actor} %}
|
||||
{% endfor %}
|
||||
|
||||
{{ "Page: " ~ page }}
|
||||
{% endblock body %}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user