From 398de40517356981a9fe1b9185f5f9e5e498c346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sat, 5 Nov 2016 15:24:42 +0100 Subject: Added search engine in baggy theme --- .../Resources/views/themes/baggy/Entry/entries.html.twig | 9 ++++++--- .../views/themes/baggy/Entry/search_form.html.twig | 15 +++++++++++++++ .../Resources/views/themes/baggy/layout.html.twig | 12 +++--------- .../views/themes/material/Entry/entries.html.twig | 2 +- .../views/themes/material/Entry/search_form.html.twig | 3 +-- 5 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/search_form.html.twig diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig index d1baa283..a13fe903 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig @@ -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 %} + {% if searchTerm is defined and searchTerm is not empty %} + {% set filter = searchTerm %} {% endif %} - {% include "@WallabagCore/themes/common/Entry/_title.html.twig" with {'currentTag': currentTag} %} + {% include "@WallabagCore/themes/common/Entry/_title.html.twig" with {'filter': filter} %} {% endblock %} {% block content %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/search_form.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/search_form.html.twig new file mode 100644 index 00000000..818513f3 --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/search_form.html.twig @@ -0,0 +1,15 @@ +
+

{{ 'menu.left.search'|trans }}

+ × + {% if form_errors(form) %} + {{ form_errors(form) }} + {% endif %} + + {% if form_errors(form.term) %} + {{ form_errors(form.term) }} + {% endif %} + + {{ form_widget(form.term, { 'attr': {'autocomplete': 'off', 'placeholder': 'entry.search.placeholder'} }) }} + + {{ form_rest(form) }} +
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig index cd4ed3fa..fc024aff 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig @@ -31,17 +31,11 @@ - + {% if is_granted('ROLE_SUPER_ADMIN') %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig index ff555055..00e8bf63 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig @@ -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} %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/search_form.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/search_form.html.twig index 9b8ac86d..bba6adb1 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/search_form.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/search_form.html.twig @@ -1,5 +1,4 @@ -
+ {% if form_errors(form) %} {{ form_errors(form) }} {% endif %} -- cgit v1.2.3