aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xapp/Resources/static/themes/material/css/main.css2
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php3
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml2
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/search_form.html.twig2
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig2
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php67
6 files changed, 73 insertions, 5 deletions
diff --git a/app/Resources/static/themes/material/css/main.css b/app/Resources/static/themes/material/css/main.css
index 21f948b1..8e33cfbc 100755
--- a/app/Resources/static/themes/material/css/main.css
+++ b/app/Resources/static/themes/material/css/main.css
@@ -349,7 +349,7 @@ nav input {
349.input-field.nav-panel-add, 349.input-field.nav-panel-add,
350.input-field.nav-panel-add form, 350.input-field.nav-panel-add form,
351.input-field.nav-panel-search, 351.input-field.nav-panel-search,
352.input-field.nav-panel-search form{ 352.input-field.nav-panel-search form {
353 height: 100%; 353 height: 100%;
354} 354}
355 355
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index 51cfe4d1..47e24d6b 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -110,8 +110,7 @@ class EntryRepository extends EntityRepository
110 $qb 110 $qb
111 ->andWhere('e.content LIKE :term OR e.title LIKE :term')->setParameter('term', '%'.$term.'%') 111 ->andWhere('e.content LIKE :term OR e.title LIKE :term')->setParameter('term', '%'.$term.'%')
112 ->leftJoin('e.tags', 't') 112 ->leftJoin('e.tags', 't')
113 ->groupBy('e.id') 113 ->groupBy('e.id');
114 ->having('count(t.id) = 0');
115 114
116 return $qb; 115 return $qb;
117 } 116 }
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
index d5c00e52..d97eab26 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
@@ -162,7 +162,7 @@ entry:
162 archived: "Articles lus" 162 archived: "Articles lus"
163 filtered: "Articles filtrés" 163 filtered: "Articles filtrés"
164 filtered_tags: "Articles filtrés par tags :" 164 filtered_tags: "Articles filtrés par tags :"
165 filtered_search: 'Articles filtrés par une recherche :' 165 filtered_search: 'Articles filtrés par recherche :'
166 untagged: "Article sans tag" 166 untagged: "Article sans tag"
167 list: 167 list:
168 number_on_the_page: "{0} Il n’y a pas d’articles.|{1} Il y a un article.|]1,Inf[ Il y a %count% articles." 168 number_on_the_page: "{0} Il n’y a pas d’articles.|{1} Il y a un article.|]1,Inf[ Il y a %count% articles."
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
index 818513f3..20821b6d 100644
--- 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
@@ -9,6 +9,8 @@
9 <span class="black-text">{{ form_errors(form.term) }}</span> 9 <span class="black-text">{{ form_errors(form.term) }}</span>
10 {% endif %} 10 {% endif %}
11 11
12 <input type="hidden" name="currentRoute" value="{{ currentRoute }}" />
13
12 {{ form_widget(form.term, { 'attr': {'autocomplete': 'off', 'placeholder': 'entry.search.placeholder'} }) }} 14 {{ form_widget(form.term, { 'attr': {'autocomplete': 'off', 'placeholder': 'entry.search.placeholder'} }) }}
13 15
14 {{ form_rest(form) }} 16 {{ form_rest(form) }}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig
index fc024aff..07ff8e14 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig
@@ -33,7 +33,7 @@
33 <li class="menu new"><a href="{{ path('new') }}">{{ 'menu.left.save_link'|trans }}</a></li> 33 <li class="menu new"><a href="{{ path('new') }}">{{ 'menu.left.save_link'|trans }}</a></li>
34 <li style="position: relative;"><a href="javascript: void(null);" id="search">{{ 'menu.left.search'|trans }}</a> 34 <li style="position: relative;"><a href="javascript: void(null);" id="search">{{ 'menu.left.search'|trans }}</a>
35 <div id="search-form" class="messages info popup-form"> 35 <div id="search-form" class="messages info popup-form">
36 {{ render(controller("WallabagCoreBundle:Entry:searchForm")) }} 36 {{ render(controller("WallabagCoreBundle:Entry:searchForm", {'currentRoute': app.request.attributes.get('_route')})) }}
37 </div> 37 </div>
38 </li> 38 </li>
39 <li class="menu config"><a href="{{ path('config') }}">{{ 'menu.left.config'|trans }}</a></li> 39 <li class="menu config"><a href="{{ path('config') }}">{{ 'menu.left.config'|trans }}</a></li>
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index 09cf01b8..b248b178 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -1018,4 +1018,71 @@ class EntryControllerTest extends WallabagCoreTestCase
1018 1018
1019 $this->assertCount(7, $crawler->filter('div[class=entry]')); 1019 $this->assertCount(7, $crawler->filter('div[class=entry]'));
1020 } 1020 }
1021
1022 public function testSearch()
1023 {
1024 $this->logInAs('admin');
1025 $client = $this->getClient();
1026
1027 // Search on unread list
1028 $crawler = $client->request('GET', '/unread/list');
1029
1030 $form = $crawler->filter('form[name=search]')->form();
1031 $data = [
1032 'search_entry[term]' => 'title',
1033 ];
1034
1035 $crawler = $client->submit($form, $data);
1036
1037 $this->assertCount(4, $crawler->filter('div[class=entry]'));
1038
1039 // Search on starred list
1040 $crawler = $client->request('GET', '/starred/list');
1041
1042 $form = $crawler->filter('form[name=search]')->form();
1043 $data = [
1044 'search_entry[term]' => 'title',
1045 ];
1046
1047 $crawler = $client->submit($form, $data);
1048
1049 $this->assertCount(1, $crawler->filter('div[class=entry]'));
1050
1051 // Added new article to test on archive list
1052 $crawler = $client->request('GET', '/new');
1053 $form = $crawler->filter('form[name=entry]')->form();
1054 $data = [
1055 'entry[url]' => $this->url,
1056 ];
1057 $client->submit($form, $data);
1058 $content = $client->getContainer()
1059 ->get('doctrine.orm.entity_manager')
1060 ->getRepository('WallabagCoreBundle:Entry')
1061 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId());
1062 $client->request('GET', '/archive/'.$content->getId());
1063
1064 $crawler = $client->request('GET', '/archive/list');
1065
1066 $form = $crawler->filter('form[name=search]')->form();
1067 $data = [
1068 'search_entry[term]' => 'manège',
1069 ];
1070
1071 $crawler = $client->submit($form, $data);
1072
1073 $this->assertCount(1, $crawler->filter('div[class=entry]'));
1074 $client->request('GET', '/delete/'.$content->getId());
1075
1076 // test on list of all articles
1077 $crawler = $client->request('GET', '/all/list');
1078
1079 $form = $crawler->filter('form[name=search]')->form();
1080 $data = [
1081 'search_entry[term]' => 'pocket',
1082 ];
1083
1084 $crawler = $client->submit($form, $data);
1085
1086 $this->assertCount(0, $crawler->filter('div[class=entry]'));
1087 }
1021} 1088}