Added search engine in baggy theme

This commit is contained in:
Nicolas Lœuillet 2016-11-05 15:24:42 +01:00
parent ee122a7528
commit 398de40517
5 changed files with 26 additions and 15 deletions

View file

@ -1,11 +1,14 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}
{% set currentTag = '' %}
{% set filter = '' %}
{% if tag is defined %}
{% set currentTag = tag %}
{% set filter = tag %}
{% endif %}
{% include "@WallabagCore/themes/common/Entry/_title.html.twig" with {'currentTag': currentTag} %}
{% if searchTerm is defined and searchTerm is not empty %}
{% set filter = searchTerm %}
{% endif %}
{% include "@WallabagCore/themes/common/Entry/_title.html.twig" with {'filter': filter} %}
{% endblock %}
{% block content %}

View file

@ -0,0 +1,15 @@
<form name="search" method="GET" action="{{ path('search')}}">
<h2>{{ 'menu.left.search'|trans }}</h2>
<a href="javascript: void(null);" id="search-form-close" class="close-button--popup close-button">&times;</a>
{% if form_errors(form) %}
<span class="black-text">{{ form_errors(form) }}</span>
{% endif %}
{% if form_errors(form.term) %}
<span class="black-text">{{ form_errors(form.term) }}</span>
{% endif %}
{{ form_widget(form.term, { 'attr': {'autocomplete': 'off', 'placeholder': 'entry.search.placeholder'} }) }}
{{ form_rest(form) }}
</form>

View file

@ -31,17 +31,11 @@
<li class="menu all"><a href="{{ path('all') }}">{{ 'menu.left.all_articles'|trans }}</a></li>
<li class="menu tag"><a href="{{ path('tag') }}">{{ 'menu.left.tags'|trans }}</a></li>
<li class="menu new"><a href="{{ path('new') }}">{{ 'menu.left.save_link'|trans }}</a></li>
<!--<li style="position: relative;"><a href="javascript: void(null);" id="search">{{ 'menu.left.search'|trans }}</a>
<li style="position: relative;"><a href="javascript: void(null);" id="search">{{ 'menu.left.search'|trans }}</a>
<div id="search-form" class="messages info popup-form">
<form method="get" action="index.php">
<h2>{{ 'menu.left.search'|trans }}</h2>
<a href="javascript: void(null);" id="search-form-close" class="close-button--popup close-button">&times;</a>
<input type="hidden" name="view" value="search">
<input required placeholder="{{ 'menu.search_form.input_label'|trans }}" type="text" name="search" id="searchfield"><br>
<input id="submit-search" type="submit" value="{{ 'menu.left.search'|trans }}">
</form>
{{ render(controller("WallabagCoreBundle:Entry:searchForm")) }}
</div>
</li>-->
</li>
<li class="menu config"><a href="{{ path('config') }}">{{ 'menu.left.config'|trans }}</a></li>
{% if is_granted('ROLE_SUPER_ADMIN') %}
<li class="menu users"><a href="{{ path('user_index') }}">{{ 'menu.left.users_management'|trans }}</a></li>

View file

@ -5,7 +5,7 @@
{% if tag is defined %}
{% set filter = tag %}
{% endif %}
{% if searchTerm is not empty %}
{% if searchTerm is defined and searchTerm is not empty %}
{% set filter = searchTerm %}
{% endif %}
{% include "@WallabagCore/themes/common/Entry/_title.html.twig" with {'filter': filter} %}

View file

@ -1,5 +1,4 @@
<form name="search
" method="GET" action="{{ path('search')}}">
<form name="search" method="GET" action="{{ path('search')}}">
{% if form_errors(form) %}
<span class="black-text">{{ form_errors(form) }}</span>
{% endif %}