diff options
Diffstat (limited to 'src')
9 files changed, 88 insertions, 6 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index b6a68963..b73e9eec 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -102,6 +102,21 @@ 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 | return $this->showEntries('all', $request, $page); | ||
117 | } | ||
118 | |||
119 | /** | ||
105 | * Shows unread entries for current user. | 120 | * Shows unread entries for current user. |
106 | * | 121 | * |
107 | * @param Request $request | 122 | * @param Request $request |
@@ -173,6 +188,10 @@ class EntryController extends Controller | |||
173 | $qb = $repository->getBuilderForUnreadByUser($this->getUser()->getId()); | 188 | $qb = $repository->getBuilderForUnreadByUser($this->getUser()->getId()); |
174 | break; | 189 | break; |
175 | 190 | ||
191 | case 'all': | ||
192 | $qb = $repository->getBuilderForAllByUser($this->getUser()->getId()); | ||
193 | break; | ||
194 | |||
176 | default: | 195 | default: |
177 | throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); | 196 | throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); |
178 | } | 197 | } |
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/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 5538ae82..e764e8f7 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -25,6 +25,20 @@ class EntryRepository extends EntityRepository | |||
25 | } | 25 | } |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * Retrieves all entries for a user. | ||
29 | * | ||
30 | * @param int $userId | ||
31 | * | ||
32 | * @return QueryBuilder | ||
33 | */ | ||
34 | public function getBuilderForAllByUser($userId) | ||
35 | { | ||
36 | return $this | ||
37 | ->getBuilderByUser($userId) | ||
38 | ; | ||
39 | } | ||
40 | |||
41 | /** | ||
28 | * Retrieves unread entries for a user. | 42 | * Retrieves unread entries for a user. |
29 | * | 43 | * |
30 | * @param int $userId | 44 | * @param int $userId |
diff --git a/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig index a794df0e..118a2f4b 100644 --- a/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig | |||
@@ -21,7 +21,7 @@ | |||
21 | {% if entries is empty %} | 21 | {% if entries is empty %} |
22 | <div class="messages warning"><p>{% trans %}No articles found.{% endtrans %}</p></div> | 22 | <div class="messages warning"><p>{% trans %}No articles found.{% endtrans %}</p></div> |
23 | {% else %} | 23 | {% else %} |
24 | <div><form>{{ form_rest(form) }}<button class="btn waves-effect waves-light" type="submit" id="submit-filter" value="filter">Filter</button></form></div> | 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 %} | 25 | {% for entry in entries %} |
26 | <div id="entry-{{ entry.id|e }}" class="entry"> | 26 | <div id="entry-{{ entry.id|e }}" class="entry"> |
27 | <h2><a href="{{ path('view', { 'id': entry.id }) }}">{{ entry.title|raw }}</a></h2> | 27 | <h2><a href="{{ path('view', { 'id': entry.id }) }}">{{ entry.title|raw }}</a></h2> |
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 | } |
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php index 86a19f61..5f0a6076 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php | |||
@@ -276,7 +276,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
276 | 276 | ||
277 | $crawler = $client->submit($form, $data); | 277 | $crawler = $client->submit($form, $data); |
278 | 278 | ||
279 | $this->assertCount(4, $crawler->filter('div[class=entry]')); | 279 | $this->assertCount(5, $crawler->filter('div[class=entry]')); |
280 | 280 | ||
281 | $data = array( | 281 | $data = array( |
282 | 'entry_filter[createdAt][left_date]' => '01/01/1970', | 282 | 'entry_filter[createdAt][left_date]' => '01/01/1970', |
@@ -307,6 +307,14 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
307 | $crawler = $client->request('GET', 'unread/list'.$parameters); | 307 | $crawler = $client->request('GET', 'unread/list'.$parameters); |
308 | 308 | ||
309 | $this->assertContains($parameters, $client->getResponse()->getContent()); | 309 | $this->assertContains($parameters, $client->getResponse()->getContent()); |
310 | |||
311 | // reset pagination | ||
312 | $crawler = $client->request('GET', '/config'); | ||
313 | $form = $crawler->filter('button[id=config_save]')->form(); | ||
314 | $data = array( | ||
315 | 'config[items_per_page]' => '12', | ||
316 | ); | ||
317 | $client->submit($form, $data); | ||
310 | } | 318 | } |
311 | 319 | ||
312 | public function testFilterOnDomainName() | 320 | public function testFilterOnDomainName() |
@@ -331,4 +339,25 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
331 | $crawler = $client->submit($form, $data); | 339 | $crawler = $client->submit($form, $data); |
332 | $this->assertCount(0, $crawler->filter('div[class=entry]')); | 340 | $this->assertCount(0, $crawler->filter('div[class=entry]')); |
333 | } | 341 | } |
342 | |||
343 | public function testFilterOnStatus() | ||
344 | { | ||
345 | $this->logInAs('admin'); | ||
346 | $client = $this->getClient(); | ||
347 | |||
348 | $crawler = $client->request('GET', '/unread/list'); | ||
349 | $form = $crawler->filter('button[id=submit-filter]')->form(); | ||
350 | $form['entry_filter[isArchived]']->tick(); | ||
351 | $form['entry_filter[isStarred]']->untick(); | ||
352 | |||
353 | $crawler = $client->submit($form); | ||
354 | $this->assertCount(1, $crawler->filter('div[class=entry]')); | ||
355 | |||
356 | $form = $crawler->filter('button[id=submit-filter]')->form(); | ||
357 | $form['entry_filter[isArchived]']->untick(); | ||
358 | $form['entry_filter[isStarred]']->tick(); | ||
359 | |||
360 | $crawler = $client->submit($form); | ||
361 | $this->assertCount(1, $crawler->filter('div[class=entry]')); | ||
362 | } | ||
334 | } | 363 | } |