Added a simple search engine

Fix #18
This commit is contained in:
Nicolas Lœuillet
2016-11-04 23:24:43 +01:00
parent 27dce581ca
commit ee122a7528
15 changed files with 151 additions and 50 deletions

View File

@ -162,6 +162,7 @@ entry:
archived: 'Archived entries'
filtered: 'Filtered entries'
filtered_tags: 'Filtered by tags:'
filtered_search: 'Filtered by search:'
untagged: 'Untagged entries'
list:
number_on_the_page: '{0} There are no entries.|{1} There is one entry.|]1,Inf[ There are %count% entries.'
@ -227,6 +228,8 @@ entry:
placeholder: 'http://website.com'
form_new:
url_label: Url
search:
placeholder: 'What are you looking for?'
edit:
page_title: 'Edit an entry'
title_label: 'Title'

View File

@ -6,8 +6,10 @@
{{ 'entry.page_titles.archived'|trans }}
{% elseif currentRoute == 'all' %}
{{ 'entry.page_titles.filtered'|trans }}
{% elseif currentRoute == 'search' %}
{{ 'entry.page_titles.filtered_search'|trans }} {{ filter }}
{% elseif currentRoute == 'tag_entries' %}
{{ 'entry.page_titles.filtered_tags'|trans }} {{ currentTag }}
{{ 'entry.page_titles.filtered_tags'|trans }} {{ filter }}
{% elseif currentRoute == 'untagged' %}
{{ 'entry.page_titles.untagged'|trans }}
{% else %}

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 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,14 @@
<form name="search
" method="GET" action="{{ path('search')}}">
{% 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

@ -89,11 +89,11 @@
<i class="material-icons">add</i>
</a>
</li>
<!--<li>
<li>
<a title="{{ 'menu.top.search'|trans }}" class="waves-effect" href="javascript: void(null);" id="nav-btn-search">
<i class="material-icons">search</i>
</a>
</li>-->
</li>
<li id="button_filters">
<a class="nav-panel-menu button-collapse-right tooltipped" data-position="bottom" data-delay="50" data-tooltip="{{ 'menu.top.filter_entries'|trans }}" href="#" data-activates="filters">
<i class="material-icons">filter_list</i>
@ -106,13 +106,11 @@
</li>
</ul>
</div>
<form method="get" action="index.php">
<div class="input-field nav-panel-search" style="display: none">
<input name="search" id="searchfield" type="search" required placeholder="{{ 'menu.search_form.input_label'|trans }}">
<label for="search"><i class="material-icons search">search</i></label>
<i class="material-icons close">clear</i>
</div>
</form>
<div class="input-field nav-panel-search" style="display: none">
{{ render(controller("WallabagCoreBundle:Entry:searchForm")) }}
<label for="search" class="active"><i class="material-icons search">search</i></label>
<i class="material-icons close">clear</i>
</div>
<div class="input-field nav-panel-add" style="display: none">
{{ render(controller("WallabagCoreBundle:Entry:addEntryForm")) }}
<label for="add" class="active"><i class="material-icons add">add</i></label>