]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Added search engine in baggy theme
authorNicolas Lœuillet <nicolas@loeuillet.org>
Sat, 5 Nov 2016 14:24:42 +0000 (15:24 +0100)
committerNicolas Lœuillet <nicolas@loeuillet.org>
Sat, 19 Nov 2016 18:17:30 +0000 (19:17 +0100)
src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/search_form.html.twig [new file with mode: 0644]
src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/search_form.html.twig

index d1baa28359e37c31f36b8fb429fbb8904dfaffbb..a13fe903b83588afb014456c68d19681c63f59ce 100644 (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 %}
+    {% 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 (file)
index 0000000..818513f
--- /dev/null
@@ -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>
index cd4ed3fae396709b56b8101246c32ce42052baeb..fc024aff506751553cb87fa1cf78440df1192850 100644 (file)
         <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>
index ff555055c2e3af0acda4f74753e947707b98cdff..00e8bf63835790693d42fce9e75533afeb659e0e 100644 (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} %}
index 9b8ac86d951f76421b0ca954cbff7480154aa00a..bba6adb1e0a388008f4d9f173c0cee968882cf58 100644 (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 %}