]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Handle filter form using some JS
authorJeremy Benoist <jeremy.benoist@gmail.com>
Mon, 24 Aug 2015 18:43:29 +0000 (20:43 +0200)
committerNicolas Lœuillet <nicolas@loeuillet.org>
Sun, 13 Sep 2015 11:35:12 +0000 (13:35 +0200)
Instead of displaying an ugly form

src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/baggy/public/css/main.css
src/Wallabag/CoreBundle/Resources/views/themes/baggy/public/js/popupForm.js

index 0d295431ec2c2268a7436b9042cf6be51fbe4f1c..28bf0ab951fc6356e186d366dbcdbf256ddacbad 100644 (file)
@@ -4,24 +4,34 @@
 
 {% block content %}
     {% block pager %}
-    {% if entries is not empty %}
         <div class="results">
             <div class="nb-results">{{ entries.count }} {% trans %}entries{% endtrans %}</div>
-            <div class="pagination">
-                {% for p in range(1, entries.nbPages) if entries.nbPages > 1 %}
-                    <li>
-                        <a href="{{ path(app.request.attributes.get('_route'), app.request.query.all|merge({'page': p})) }}" class="{{ currentPage == p ? 'current':''}}" >{{ p }}</a>
-                    </li>
-                {% endfor %}
+                <div class="pagination">
+                <a href="#" id="filter">{% trans %}Filter{% endtrans %}</a>
+                {% if entries is not empty %}
+                    –
+                    {% for p in range(1, entries.nbPages) if entries.nbPages > 1 %}
+                        <li>
+                            <a href="{{ path(app.request.attributes.get('_route'), app.request.query.all|merge({'page': p})) }}" class="{{ currentPage == p ? 'current':''}}" >{{ p }}</a>
+                        </li>
+                    {% endfor %}
+                {% endif %}
             </div>
         </div>
-    {% endif %}
     {% endblock %}
 
+    <div id="filter-form" class="messages info popup-form">
+        <form method="get" action="{{ path('all') }}">
+            <h2>{% trans %}Filter{% endtrans %}</h2>
+            <a href="javascript: void(null);" id="filter-form-close" class="close-button--popup close-button">&times;</a>
+            {{ form_rest(form) }}
+            <button class="btn waves-effect waves-light" type="submit" id="submit-filter" value="filter">{% trans %}Filter{% endtrans %}</button>
+        </form>
+    </div>
+
     {% if entries is empty %}
         <div class="messages warning"><p>{% trans %}No articles found.{% endtrans %}</p></div>
     {% else %}
-        <div><form action="{{ path('all') }}">{{ form_rest(form) }}<button class="btn waves-effect waves-light" type="submit" id="submit-filter" value="filter">Filter</button></form></div>
         {% for entry in entries %}
             <div id="entry-{{ entry.id|e }}" class="entry">
                 <h2><a href="{{ path('view', { 'id': entry.id }) }}">{{ entry.title|raw }}</a></h2>
index 72a7b20542ecb207f38afc7128071a771dc7deff..dee307f396342f24355b35943f9d0269a43bcdca 100755 (executable)
@@ -939,6 +939,19 @@ pre code {
                font-size: 0.96em;
 }
 
+#filter-form {
+    margin-top: 30px !important;
+    width: 500px;
+    height: 370px;
+    right: 5em;
+    left: inherit;
+}
+
+#filter-form form {
+    width: 500px;
+    height: 370px;
+}
+
 
 /* ==========================================================================
    6 = Media Queries
index d233e600f3d837d0bac1bf7c2bae5aa1c7bbcd3c..b933acd1103005375dc1ab62340bc04a4d740641 100644 (file)
@@ -2,6 +2,7 @@ $(document).ready(function() {
 
     $("#search-form").hide();
     $("#bagit-form").hide();
+    $("#filter-form").hide();
 
     //---------------------------------------------------------------------------
     // Toggle the "Search" popup in the sidebar
@@ -18,6 +19,13 @@ $(document).ready(function() {
         }
     }
 
+    //---------------------------------------------------------------------------
+    // Toggle the "Filter" popup on entries list
+    //---------------------------------------------------------------------------
+    function toggleFilter() {
+        $("#filter-form").toggle();
+    }
+
     //---------------------------------------------------------------------------
     // Toggle the "Save a Link" popup in the sidebar
     //---------------------------------------------------------------------------
@@ -50,6 +58,11 @@ $(document).ready(function() {
         $("#searchfield").focus();
     });
 
+    $("#filter").click(function(){
+        closePopups();
+        toggleFilter();
+    });
+
     $("#bagit").click(function(){
         closePopups();
         toggleBagit();
@@ -60,13 +73,11 @@ $(document).ready(function() {
         toggleSearch();
     });
 
+    $("#filter-form-close").click(function(){
+        toggleFilter();
+    });
+
     $("#bagit-form-close").click(function(){
         toggleBagit();
     });
-
-    // $("#").click(function(){
-    //     toggleSearch();
-    // });
-
-
 });