aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2015-08-24 20:43:29 +0200
committerNicolas Lœuillet <nicolas@loeuillet.org>2015-09-13 13:35:12 +0200
commitd2fcbf5d846eabb89714f4c59ff6729e2666a948 (patch)
treed6a9267da308f76c2e6377f50744f7a5216cf53d
parent19c283140ef7f489c67d7debe4dd431e7cfefd4b (diff)
downloadwallabag-d2fcbf5d846eabb89714f4c59ff6729e2666a948.tar.gz
wallabag-d2fcbf5d846eabb89714f4c59ff6729e2666a948.tar.zst
wallabag-d2fcbf5d846eabb89714f4c59ff6729e2666a948.zip
Handle filter form using some JS
Instead of displaying an ugly form
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig28
-rwxr-xr-xsrc/Wallabag/CoreBundle/Resources/views/themes/baggy/public/css/main.css13
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/public/js/popupForm.js23
3 files changed, 49 insertions, 15 deletions
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 0d295431..28bf0ab9 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
@@ -4,24 +4,34 @@
4 4
5{% block content %} 5{% block content %}
6 {% block pager %} 6 {% block pager %}
7 {% if entries is not empty %}
8 <div class="results"> 7 <div class="results">
9 <div class="nb-results">{{ entries.count }} {% trans %}entries{% endtrans %}</div> 8 <div class="nb-results">{{ entries.count }} {% trans %}entries{% endtrans %}</div>
10 <div class="pagination"> 9 <div class="pagination">
11 {% for p in range(1, entries.nbPages) if entries.nbPages > 1 %} 10 <a href="#" id="filter">{% trans %}Filter{% endtrans %}</a>
12 <li> 11 {% if entries is not empty %}
13 <a href="{{ path(app.request.attributes.get('_route'), app.request.query.all|merge({'page': p})) }}" class="{{ currentPage == p ? 'current':''}}" >{{ p }}</a> 12
14 </li> 13 {% for p in range(1, entries.nbPages) if entries.nbPages > 1 %}
15 {% endfor %} 14 <li>
15 <a href="{{ path(app.request.attributes.get('_route'), app.request.query.all|merge({'page': p})) }}" class="{{ currentPage == p ? 'current':''}}" >{{ p }}</a>
16 </li>
17 {% endfor %}
18 {% endif %}
16 </div> 19 </div>
17 </div> 20 </div>
18 {% endif %}
19 {% endblock %} 21 {% endblock %}
20 22
23 <div id="filter-form" class="messages info popup-form">
24 <form method="get" action="{{ path('all') }}">
25 <h2>{% trans %}Filter{% endtrans %}</h2>
26 <a href="javascript: void(null);" id="filter-form-close" class="close-button--popup close-button">&times;</a>
27 {{ form_rest(form) }}
28 <button class="btn waves-effect waves-light" type="submit" id="submit-filter" value="filter">{% trans %}Filter{% endtrans %}</button>
29 </form>
30 </div>
31
21 {% if entries is empty %} 32 {% if entries is empty %}
22 <div class="messages warning"><p>{% trans %}No articles found.{% endtrans %}</p></div> 33 <div class="messages warning"><p>{% trans %}No articles found.{% endtrans %}</p></div>
23 {% else %} 34 {% else %}
24 <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>
25 {% for entry in entries %} 35 {% for entry in entries %}
26 <div id="entry-{{ entry.id|e }}" class="entry"> 36 <div id="entry-{{ entry.id|e }}" class="entry">
27 <h2><a href="{{ path('view', { 'id': entry.id }) }}">{{ entry.title|raw }}</a></h2> 37 <h2><a href="{{ path('view', { 'id': entry.id }) }}">{{ entry.title|raw }}</a></h2>
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/public/css/main.css b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/public/css/main.css
index 72a7b205..dee307f3 100755
--- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/public/css/main.css
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/public/css/main.css
@@ -939,6 +939,19 @@ pre code {
939 font-size: 0.96em; 939 font-size: 0.96em;
940} 940}
941 941
942#filter-form {
943 margin-top: 30px !important;
944 width: 500px;
945 height: 370px;
946 right: 5em;
947 left: inherit;
948}
949
950#filter-form form {
951 width: 500px;
952 height: 370px;
953}
954
942 955
943/* ========================================================================== 956/* ==========================================================================
944 6 = Media Queries 957 6 = Media Queries
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/public/js/popupForm.js b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/public/js/popupForm.js
index d233e600..b933acd1 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/public/js/popupForm.js
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/public/js/popupForm.js
@@ -2,6 +2,7 @@ $(document).ready(function() {
2 2
3 $("#search-form").hide(); 3 $("#search-form").hide();
4 $("#bagit-form").hide(); 4 $("#bagit-form").hide();
5 $("#filter-form").hide();
5 6
6 //--------------------------------------------------------------------------- 7 //---------------------------------------------------------------------------
7 // Toggle the "Search" popup in the sidebar 8 // Toggle the "Search" popup in the sidebar
@@ -19,6 +20,13 @@ $(document).ready(function() {
19 } 20 }
20 21
21 //--------------------------------------------------------------------------- 22 //---------------------------------------------------------------------------
23 // Toggle the "Filter" popup on entries list
24 //---------------------------------------------------------------------------
25 function toggleFilter() {
26 $("#filter-form").toggle();
27 }
28
29 //---------------------------------------------------------------------------
22 // Toggle the "Save a Link" popup in the sidebar 30 // Toggle the "Save a Link" popup in the sidebar
23 //--------------------------------------------------------------------------- 31 //---------------------------------------------------------------------------
24 function toggleBagit() { 32 function toggleBagit() {
@@ -50,6 +58,11 @@ $(document).ready(function() {
50 $("#searchfield").focus(); 58 $("#searchfield").focus();
51 }); 59 });
52 60
61 $("#filter").click(function(){
62 closePopups();
63 toggleFilter();
64 });
65
53 $("#bagit").click(function(){ 66 $("#bagit").click(function(){
54 closePopups(); 67 closePopups();
55 toggleBagit(); 68 toggleBagit();
@@ -60,13 +73,11 @@ $(document).ready(function() {
60 toggleSearch(); 73 toggleSearch();
61 }); 74 });
62 75
76 $("#filter-form-close").click(function(){
77 toggleFilter();
78 });
79
63 $("#bagit-form-close").click(function(){ 80 $("#bagit-form-close").click(function(){
64 toggleBagit(); 81 toggleBagit();
65 }); 82 });
66
67 // $("#").click(function(){
68 // toggleSearch();
69 // });
70
71
72}); 83});