diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-08-20 15:59:47 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-08-21 07:30:48 +0200 |
commit | 89659c9eae338cd29e5919b5ffde6924189a59ca (patch) | |
tree | 281d37681fb2ca8413f7c619cacdc356fe90c0a4 /src/Wallabag | |
parent | 109d67dbb16478f927c3d6a46ab61ea9994aafae (diff) | |
download | wallabag-89659c9eae338cd29e5919b5ffde6924189a59ca.tar.gz wallabag-89659c9eae338cd29e5919b5ffde6924189a59ca.tar.zst wallabag-89659c9eae338cd29e5919b5ffde6924189a59ca.zip |
filters: implement status filter and a new view (to display all entries)
Diffstat (limited to 'src/Wallabag')
6 files changed, 66 insertions, 4 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index dc399b8a..4070a603 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -102,6 +102,48 @@ class EntryController extends Controller | |||
102 | } | 102 | } |
103 | 103 | ||
104 | /** | 104 | /** |
105 | * Shows all entries for current user. | ||
106 | * | ||
107 | * @param Request $request | ||
108 | * @param int $page | ||
109 | * | ||
110 | * @Route("/all/list/{page}", name="all", defaults={"page" = "1"}) | ||
111 | * | ||
112 | * @return \Symfony\Component\HttpFoundation\Response | ||
113 | */ | ||
114 | public function showAllAction(Request $request, $page) | ||
115 | { | ||
116 | $form = $this->get('form.factory')->create(new EntryFilterType()); | ||
117 | |||
118 | $filterBuilder = $this->getDoctrine() | ||
119 | ->getRepository('WallabagCoreBundle:Entry') | ||
120 | ->findAllByUser($this->getUser()->getId()); | ||
121 | |||
122 | if ($request->query->has($form->getName())) { | ||
123 | // manually bind values from the request | ||
124 | $form->submit($request->query->get($form->getName())); | ||
125 | |||
126 | // build the query from the given form object | ||
127 | $this->get('lexik_form_filter.query_builder_updater')->addFilterConditions($form, $filterBuilder); | ||
128 | } | ||
129 | |||
130 | $pagerAdapter = new DoctrineORMAdapter($filterBuilder->getQuery()); | ||
131 | $entries = new Pagerfanta($pagerAdapter); | ||
132 | |||
133 | $entries->setMaxPerPage($this->getUser()->getConfig()->getItemsPerPage()); | ||
134 | $entries->setCurrentPage($page); | ||
135 | |||
136 | return $this->render( | ||
137 | 'WallabagCoreBundle:Entry:entries.html.twig', | ||
138 | array( | ||
139 | 'form' => $form->createView(), | ||
140 | 'entries' => $entries, | ||
141 | 'currentPage' => $page, | ||
142 | ) | ||
143 | ); | ||
144 | } | ||
145 | |||
146 | /** | ||
105 | * Shows unread entries for current user. | 147 | * Shows unread entries for current user. |
106 | * | 148 | * |
107 | * @param Request $request | 149 | * @param Request $request |
diff --git a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php b/src/Wallabag/CoreBundle/Filter/EntryFilterType.php index 771daef1..ff51785b 100644 --- a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Filter/EntryFilterType.php | |||
@@ -39,7 +39,9 @@ class EntryFilterType extends AbstractType | |||
39 | 39 | ||
40 | return $filterQuery->createCondition($expression); | 40 | return $filterQuery->createCondition($expression); |
41 | }, | 41 | }, |
42 | )); | 42 | )) |
43 | ->add('isArchived', 'filter_checkbox') | ||
44 | ->add('isStarred', 'filter_checkbox'); | ||
43 | } | 45 | } |
44 | 46 | ||
45 | public function getName() | 47 | public function getName() |
diff --git a/src/Wallabag/CoreBundle/Resources/views/base.html.twig b/src/Wallabag/CoreBundle/Resources/views/base.html.twig index ac5d2bf9..3ad776b9 100644 --- a/src/Wallabag/CoreBundle/Resources/views/base.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/base.html.twig | |||
@@ -71,7 +71,8 @@ | |||
71 | <li><a href="{{ path('unread') }}">{% trans %}unread{% endtrans %}</a></li> | 71 | <li><a href="{{ path('unread') }}">{% trans %}unread{% endtrans %}</a></li> |
72 | <li><a href="{{ path('starred') }}">{% trans %}favorites{% endtrans %}</a></li> | 72 | <li><a href="{{ path('starred') }}">{% trans %}favorites{% endtrans %}</a></li> |
73 | <li><a href="{{ path('archive') }}"}>{% trans %}archive{% endtrans %}</a></li> | 73 | <li><a href="{{ path('archive') }}"}>{% trans %}archive{% endtrans %}</a></li> |
74 | <li><a href="{{ path('tag') }}">{% trans %}tags{% endtrans %}</a></li> | 74 | <li><a href="{{ path('all') }}"}>{% trans %}all{% endtrans %}</a></li> |
75 | <li><a href="{{ path ('tag') }}">{% trans %}tags{% endtrans %}</a></li> | ||
75 | <li><a href="{{ path('new') }}">{% trans %}save a link{% endtrans %}</a></li> | 76 | <li><a href="{{ path('new') }}">{% trans %}save a link{% endtrans %}</a></li> |
76 | <li style="position: relative;"><a href="javascript: void(null);" id="search">{% trans %}search{% endtrans %}</a> | 77 | <li style="position: relative;"><a href="javascript: void(null);" id="search">{% trans %}search{% endtrans %}</a> |
77 | <div id="search-form" class="messages info popup-form"> | 78 | <div id="search-form" class="messages info popup-form"> |
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 bd64067c..b45552f2 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 | |||
@@ -7,6 +7,8 @@ | |||
7 | {% trans %}Starred{% endtrans %} | 7 | {% trans %}Starred{% endtrans %} |
8 | {% elseif currentRoute == 'archive' %} | 8 | {% elseif currentRoute == 'archive' %} |
9 | {% trans %}Archive{% endtrans %} | 9 | {% trans %}Archive{% endtrans %} |
10 | {% elseif currentRoute == 'all' %} | ||
11 | {% trans %}Filtered{% endtrans %} | ||
10 | {% else %} | 12 | {% else %} |
11 | {% trans %}Unread{% endtrans %} | 13 | {% trans %}Unread{% endtrans %} |
12 | {% endif %} | 14 | {% endif %} |
@@ -59,12 +61,26 @@ | |||
59 | 61 | ||
60 | <!-- Filters --> | 62 | <!-- Filters --> |
61 | <div id="filters" class="side-nav fixed right-aligned"> | 63 | <div id="filters" class="side-nav fixed right-aligned"> |
62 | <form> | 64 | <form action="{{ path('all') }}"> |
63 | 65 | ||
64 | <h4 class="center">{% trans %}Filters{% endtrans %}</h1> | 66 | <h4 class="center">{% trans %}Filters{% endtrans %}</h1> |
65 | 67 | ||
66 | <div class="row"> | 68 | <div class="row"> |
67 | 69 | ||
70 | |||
71 | <div class="col s12"> | ||
72 | <label>{% trans %}Status{% endtrans %}</label> | ||
73 | </div> | ||
74 | <div class="input-field col s6"> | ||
75 | {{ form_widget(form.isArchived) }} | ||
76 | <label for="entry_filter_isArchived">{% trans %}Archived{% endtrans %}</label> | ||
77 | </div> | ||
78 | |||
79 | <div class="input-field col s6"> | ||
80 | {{ form_widget(form.isStarred) }} | ||
81 | <label for="entry_filter_isStarred">{% trans %}Starred{% endtrans %}</label> | ||
82 | </div> | ||
83 | |||
68 | <div class="col s12"> | 84 | <div class="col s12"> |
69 | <label>{% trans %}Reading time in minutes{% endtrans %}</label> | 85 | <label>{% trans %}Reading time in minutes{% endtrans %}</label> |
70 | </div> | 86 | </div> |
@@ -77,7 +93,6 @@ | |||
77 | <label for="entry_filter_readingTime_right_number">{% trans %}to{% endtrans %}</label> | 93 | <label for="entry_filter_readingTime_right_number">{% trans %}to{% endtrans %}</label> |
78 | </div> | 94 | </div> |
79 | 95 | ||
80 | |||
81 | <div class="input-field col s6"> | 96 | <div class="input-field col s6"> |
82 | {{ form_widget(form.domainName, {'type': 'text', 'attr' : {'placeholder': 'website.com'} }) }} | 97 | {{ form_widget(form.domainName, {'type': 'text', 'attr' : {'placeholder': 'website.com'} }) }} |
83 | <label for="entry_filter_domainName">{% trans %}Domain name{% endtrans %}</label> | 98 | <label for="entry_filter_domainName">{% trans %}Domain name{% endtrans %}</label> |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig index 1456d5dd..0ec2e082 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig | |||
@@ -42,6 +42,7 @@ | |||
42 | <li class="bold {% if currentRoute == 'unread' or currentRoute == 'homepage' %}active{% endif %}"><a class="waves-effect" href="{{ path('unread') }}">{% trans %}unread{% endtrans %}</a></li> | 42 | <li class="bold {% if currentRoute == 'unread' or currentRoute == 'homepage' %}active{% endif %}"><a class="waves-effect" href="{{ path('unread') }}">{% trans %}unread{% endtrans %}</a></li> |
43 | <li class="bold {% if currentRoute == 'starred' %}active{% endif %}"><a class="waves-effect" href="{{ path('starred') }}">{% trans %}starred{% endtrans %}</a></li> | 43 | <li class="bold {% if currentRoute == 'starred' %}active{% endif %}"><a class="waves-effect" href="{{ path('starred') }}">{% trans %}starred{% endtrans %}</a></li> |
44 | <li class="bold {% if currentRoute == 'archive' %}active{% endif %}"><a class="waves-effect" href="{{ path('archive') }}">{% trans %}archive{% endtrans %}</a></li> | 44 | <li class="bold {% if currentRoute == 'archive' %}active{% endif %}"><a class="waves-effect" href="{{ path('archive') }}">{% trans %}archive{% endtrans %}</a></li> |
45 | <li class="bold {% if currentRoute == 'all' %}active{% endif %}"><a class="waves-effect" href="{{ path('all') }}">{% trans %}all{% endtrans %}</a></li> | ||
45 | <li class="bold border-bottom {% if currentRoute == 'tags' %}active{% endif %}"><a class="waves-effect" href="{{ path('tag') }}">{% trans %}tags{% endtrans %}</a></li> | 46 | <li class="bold border-bottom {% if currentRoute == 'tags' %}active{% endif %}"><a class="waves-effect" href="{{ path('tag') }}">{% trans %}tags{% endtrans %}</a></li> |
46 | <li class="bold {% if currentRoute == 'config' %}active{% endif %}"><a class="waves-effect" href="{{ path('config') }}">{% trans %}config{% endtrans %}</a></li> | 47 | <li class="bold {% if currentRoute == 'config' %}active{% endif %}"><a class="waves-effect" href="{{ path('config') }}">{% trans %}config{% endtrans %}</a></li> |
47 | <li class="bold {% if currentRoute == 'howto' %}active{% endif %}"><a class="waves-effect" href="{{ path('howto') }}">{% trans %}howto{% endtrans %}</a></li> | 48 | <li class="bold {% if currentRoute == 'howto' %}active{% endif %}"><a class="waves-effect" href="{{ path('howto') }}">{% trans %}howto{% endtrans %}</a></li> |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/public/js/init.js b/src/Wallabag/CoreBundle/Resources/views/themes/material/public/js/init.js index c0700c2c..d397f8e5 100755 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/public/js/init.js +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/public/js/init.js | |||
@@ -5,6 +5,7 @@ function init_filters() { | |||
5 | $('.button-collapse-right').sideNav({ edge: 'right' }); | 5 | $('.button-collapse-right').sideNav({ edge: 'right' }); |
6 | $('#clear_form_filters').on('click', function(){ | 6 | $('#clear_form_filters').on('click', function(){ |
7 | $('#filters input').val(''); | 7 | $('#filters input').val(''); |
8 | $('#filters :checked').removeAttr('checked'); | ||
8 | return false; | 9 | return false; |
9 | }); | 10 | }); |
10 | } | 11 | } |