diff options
author | Nicolas Lœuillet <nicolas@loeuillet.org> | 2016-11-19 20:42:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-19 20:42:27 +0100 |
commit | 6f85bed294d6dd9f2dd9c945544074cbde38e191 (patch) | |
tree | 1ac2c526e54ddaf1678184f93d4e10a7a015349c /src/Wallabag | |
parent | 27dce581caba158a8ffffa5bc30648a21f47da12 (diff) | |
parent | 995c204428dd6be04d2bff1d5e17f3e95268f44d (diff) | |
download | wallabag-6f85bed294d6dd9f2dd9c945544074cbde38e191.tar.gz wallabag-6f85bed294d6dd9f2dd9c945544074cbde38e191.tar.zst wallabag-6f85bed294d6dd9f2dd9c945544074cbde38e191.zip |
Merge pull request #2543 from wallabag/search-engine
Added a simple search engine
Diffstat (limited to 'src/Wallabag')
23 files changed, 186 insertions, 28 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 3f4eb17d..8c13255e 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -15,10 +15,35 @@ use Wallabag\CoreBundle\Form\Type\NewEntryType; | |||
15 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; | 15 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; |
16 | use Wallabag\CoreBundle\Event\EntrySavedEvent; | 16 | use Wallabag\CoreBundle\Event\EntrySavedEvent; |
17 | use Wallabag\CoreBundle\Event\EntryDeletedEvent; | 17 | use Wallabag\CoreBundle\Event\EntryDeletedEvent; |
18 | use Wallabag\CoreBundle\Form\Type\SearchEntryType; | ||
18 | 19 | ||
19 | class EntryController extends Controller | 20 | class EntryController extends Controller |
20 | { | 21 | { |
21 | /** | 22 | /** |
23 | * @param Request $request | ||
24 | * @param int $page | ||
25 | * | ||
26 | * @Route("/search/{page}", name="search", defaults={"page" = "1"}) | ||
27 | * | ||
28 | * @return \Symfony\Component\HttpFoundation\Response | ||
29 | */ | ||
30 | public function searchFormAction(Request $request, $page, $currentRoute) | ||
31 | { | ||
32 | $form = $this->createForm(SearchEntryType::class); | ||
33 | |||
34 | $form->handleRequest($request); | ||
35 | |||
36 | if ($form->isValid()) { | ||
37 | return $this->showEntries('search', $request, $page); | ||
38 | } | ||
39 | |||
40 | return $this->render('WallabagCoreBundle:Entry:search_form.html.twig', [ | ||
41 | 'form' => $form->createView(), | ||
42 | 'currentRoute' => $currentRoute, | ||
43 | ]); | ||
44 | } | ||
45 | |||
46 | /** | ||
22 | * Fetch content and update entry. | 47 | * Fetch content and update entry. |
23 | * In case it fails, entry will return to avod loosing the data. | 48 | * In case it fails, entry will return to avod loosing the data. |
24 | * | 49 | * |
@@ -244,8 +269,14 @@ class EntryController extends Controller | |||
244 | private function showEntries($type, Request $request, $page) | 269 | private function showEntries($type, Request $request, $page) |
245 | { | 270 | { |
246 | $repository = $this->get('wallabag_core.entry_repository'); | 271 | $repository = $this->get('wallabag_core.entry_repository'); |
272 | $searchTerm = (isset($request->get('search_entry')['term']) ? $request->get('search_entry')['term'] : ''); | ||
273 | $currentRoute = (!is_null($request->get('currentRoute')) ? $request->get('currentRoute') : ''); | ||
247 | 274 | ||
248 | switch ($type) { | 275 | switch ($type) { |
276 | case 'search': | ||
277 | $qb = $repository->getBuilderForSearchByUser($this->getUser()->getId(), $searchTerm, $currentRoute); | ||
278 | |||
279 | break; | ||
249 | case 'untagged': | 280 | case 'untagged': |
250 | $qb = $repository->getBuilderForUntaggedByUser($this->getUser()->getId()); | 281 | $qb = $repository->getBuilderForUntaggedByUser($this->getUser()->getId()); |
251 | 282 | ||
@@ -294,11 +325,11 @@ class EntryController extends Controller | |||
294 | } | 325 | } |
295 | 326 | ||
296 | return $this->render( | 327 | return $this->render( |
297 | 'WallabagCoreBundle:Entry:entries.html.twig', | 328 | 'WallabagCoreBundle:Entry:entries.html.twig', [ |
298 | [ | ||
299 | 'form' => $form->createView(), | 329 | 'form' => $form->createView(), |
300 | 'entries' => $entries, | 330 | 'entries' => $entries, |
301 | 'currentPage' => $page, | 331 | 'currentPage' => $page, |
332 | 'searchTerm' => $searchTerm, | ||
302 | ] | 333 | ] |
303 | ); | 334 | ); |
304 | } | 335 | } |
diff --git a/src/Wallabag/CoreBundle/Controller/ExportController.php b/src/Wallabag/CoreBundle/Controller/ExportController.php index 79653cfe..abc3336a 100644 --- a/src/Wallabag/CoreBundle/Controller/ExportController.php +++ b/src/Wallabag/CoreBundle/Controller/ExportController.php | |||
@@ -48,7 +48,7 @@ class ExportController extends Controller | |||
48 | * | 48 | * |
49 | * @Route("/export/{category}.{format}", name="export_entries", requirements={ | 49 | * @Route("/export/{category}.{format}", name="export_entries", requirements={ |
50 | * "format": "epub|mobi|pdf|json|xml|txt|csv", | 50 | * "format": "epub|mobi|pdf|json|xml|txt|csv", |
51 | * "category": "all|unread|starred|archive|tag_entries|untagged" | 51 | * "category": "all|unread|starred|archive|tag_entries|untagged|search" |
52 | * }) | 52 | * }) |
53 | * | 53 | * |
54 | * @return \Symfony\Component\HttpFoundation\Response | 54 | * @return \Symfony\Component\HttpFoundation\Response |
diff --git a/src/Wallabag/CoreBundle/Form/Type/SearchEntryType.php b/src/Wallabag/CoreBundle/Form/Type/SearchEntryType.php new file mode 100644 index 00000000..b56cae8e --- /dev/null +++ b/src/Wallabag/CoreBundle/Form/Type/SearchEntryType.php | |||
@@ -0,0 +1,29 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Form\Type; | ||
4 | |||
5 | use Symfony\Component\Form\AbstractType; | ||
6 | use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
7 | use Symfony\Component\Form\FormBuilderInterface; | ||
8 | use Symfony\Component\OptionsResolver\OptionsResolver; | ||
9 | |||
10 | class SearchEntryType extends AbstractType | ||
11 | { | ||
12 | public function buildForm(FormBuilderInterface $builder, array $options) | ||
13 | { | ||
14 | $builder | ||
15 | ->setMethod('GET') | ||
16 | ->add('term', TextType::class, [ | ||
17 | 'required' => true, | ||
18 | 'label' => 'entry.new.form_search.term_label', | ||
19 | ]) | ||
20 | ; | ||
21 | } | ||
22 | |||
23 | public function configureOptions(OptionsResolver $resolver) | ||
24 | { | ||
25 | $resolver->setDefaults([ | ||
26 | 'csrf_protection' => false, | ||
27 | ]); | ||
28 | } | ||
29 | } | ||
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 61be5220..47e24d6b 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -86,6 +86,36 @@ class EntryRepository extends EntityRepository | |||
86 | } | 86 | } |
87 | 87 | ||
88 | /** | 88 | /** |
89 | * Retrieves entries filtered with a search term for a user. | ||
90 | * | ||
91 | * @param int $userId | ||
92 | * @param string $term | ||
93 | * @param strint $currentRoute | ||
94 | * | ||
95 | * @return QueryBuilder | ||
96 | */ | ||
97 | public function getBuilderForSearchByUser($userId, $term, $currentRoute) | ||
98 | { | ||
99 | $qb = $this | ||
100 | ->getBuilderByUser($userId); | ||
101 | |||
102 | if ('starred' === $currentRoute) { | ||
103 | $qb->andWhere('e.isStarred = true'); | ||
104 | } elseif ('unread' === $currentRoute) { | ||
105 | $qb->andWhere('e.isArchived = false'); | ||
106 | } elseif ('archive' === $currentRoute) { | ||
107 | $qb->andWhere('e.isArchived = true'); | ||
108 | } | ||
109 | |||
110 | $qb | ||
111 | ->andWhere('e.content LIKE :term OR e.title LIKE :term')->setParameter('term', '%'.$term.'%') | ||
112 | ->leftJoin('e.tags', 't') | ||
113 | ->groupBy('e.id'); | ||
114 | |||
115 | return $qb; | ||
116 | } | ||
117 | |||
118 | /** | ||
89 | * Retrieves untagged entries for a user. | 119 | * Retrieves untagged entries for a user. |
90 | * | 120 | * |
91 | * @param int $userId | 121 | * @param int $userId |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index b456fff0..d6c294a4 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml | |||
@@ -162,6 +162,7 @@ entry: | |||
162 | # archived: 'Archived entries' | 162 | # archived: 'Archived entries' |
163 | # filtered: 'Filtered entries' | 163 | # filtered: 'Filtered entries' |
164 | # filtered_tags: 'Filtered by tags:' | 164 | # filtered_tags: 'Filtered by tags:' |
165 | # filtered_search: 'Filtered by search:' | ||
165 | # untagged: 'Untagged entries' | 166 | # untagged: 'Untagged entries' |
166 | list: | 167 | list: |
167 | # number_on_the_page: '{0} There is no entry.|{1} There is one entry.|]1,Inf[ There are %count% entries.' | 168 | # number_on_the_page: '{0} There is no entry.|{1} There is one entry.|]1,Inf[ There are %count% entries.' |
@@ -227,6 +228,8 @@ entry: | |||
227 | placeholder: 'http://website.com' | 228 | placeholder: 'http://website.com' |
228 | form_new: | 229 | form_new: |
229 | url_label: Url | 230 | url_label: Url |
231 | search: | ||
232 | # placeholder: 'What are you looking for?' | ||
230 | edit: | 233 | edit: |
231 | # page_title: 'Edit an entry' | 234 | # page_title: 'Edit an entry' |
232 | # title_label: 'Title' | 235 | # title_label: 'Title' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index 08ed1a11..8a67e0df 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml | |||
@@ -162,6 +162,7 @@ entry: | |||
162 | archived: 'Archivierte Einträge' | 162 | archived: 'Archivierte Einträge' |
163 | filtered: 'Gefilterte Einträge' | 163 | filtered: 'Gefilterte Einträge' |
164 | filtered_tags: 'Gefiltert nach Tags:' | 164 | filtered_tags: 'Gefiltert nach Tags:' |
165 | # filtered_search: 'Filtered by search:' | ||
165 | untagged: 'Nicht getaggte Einträge' | 166 | untagged: 'Nicht getaggte Einträge' |
166 | list: | 167 | list: |
167 | number_on_the_page: '{0} Es gibt keine Einträge.|{1} Es gibt einen Eintrag.|]1,Inf[ Es gibt %count% Einträge.' | 168 | number_on_the_page: '{0} Es gibt keine Einträge.|{1} Es gibt einen Eintrag.|]1,Inf[ Es gibt %count% Einträge.' |
@@ -227,6 +228,8 @@ entry: | |||
227 | placeholder: 'https://website.de' | 228 | placeholder: 'https://website.de' |
228 | form_new: | 229 | form_new: |
229 | url_label: URL | 230 | url_label: URL |
231 | search: | ||
232 | # placeholder: 'What are you looking for?' | ||
230 | edit: | 233 | edit: |
231 | page_title: 'Eintrag bearbeiten' | 234 | page_title: 'Eintrag bearbeiten' |
232 | title_label: 'Titel' | 235 | title_label: 'Titel' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 20e83a07..63216a0f 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml | |||
@@ -162,6 +162,7 @@ entry: | |||
162 | archived: 'Archived entries' | 162 | archived: 'Archived entries' |
163 | filtered: 'Filtered entries' | 163 | filtered: 'Filtered entries' |
164 | filtered_tags: 'Filtered by tags:' | 164 | filtered_tags: 'Filtered by tags:' |
165 | filtered_search: 'Filtered by search:' | ||
165 | untagged: 'Untagged entries' | 166 | untagged: 'Untagged entries' |
166 | list: | 167 | list: |
167 | number_on_the_page: '{0} There are no entries.|{1} There is one entry.|]1,Inf[ There are %count% entries.' | 168 | number_on_the_page: '{0} There are no entries.|{1} There is one entry.|]1,Inf[ There are %count% entries.' |
@@ -227,6 +228,8 @@ entry: | |||
227 | placeholder: 'http://website.com' | 228 | placeholder: 'http://website.com' |
228 | form_new: | 229 | form_new: |
229 | url_label: Url | 230 | url_label: Url |
231 | search: | ||
232 | placeholder: 'What are you looking for?' | ||
230 | edit: | 233 | edit: |
231 | page_title: 'Edit an entry' | 234 | page_title: 'Edit an entry' |
232 | title_label: 'Title' | 235 | title_label: 'Title' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index 5507ccae..3876725e 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml | |||
@@ -162,6 +162,7 @@ entry: | |||
162 | archived: 'Artículos archivados' | 162 | archived: 'Artículos archivados' |
163 | filtered: 'Artículos filtrados' | 163 | filtered: 'Artículos filtrados' |
164 | # filtered_tags: 'Filtered by tags:' | 164 | # filtered_tags: 'Filtered by tags:' |
165 | # filtered_search: 'Filtered by search:' | ||
165 | # untagged: 'Untagged entries' | 166 | # untagged: 'Untagged entries' |
166 | list: | 167 | list: |
167 | number_on_the_page: '{0} No hay artículos.|{1} Hay un artículo.|]1,Inf[ Hay %count% artículos.' | 168 | number_on_the_page: '{0} No hay artículos.|{1} Hay un artículo.|]1,Inf[ Hay %count% artículos.' |
@@ -227,6 +228,8 @@ entry: | |||
227 | placeholder: 'http://website.com' | 228 | placeholder: 'http://website.com' |
228 | form_new: | 229 | form_new: |
229 | url_label: Url | 230 | url_label: Url |
231 | search: | ||
232 | # placeholder: 'What are you looking for?' | ||
230 | edit: | 233 | edit: |
231 | page_title: 'Editar un artículo' | 234 | page_title: 'Editar un artículo' |
232 | title_label: 'Título' | 235 | title_label: 'Título' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index ba8a9c35..301668e3 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml | |||
@@ -162,6 +162,7 @@ entry: | |||
162 | archived: 'مقالههای بایگانیشده' | 162 | archived: 'مقالههای بایگانیشده' |
163 | filtered: 'مقالههای فیلترشده' | 163 | filtered: 'مقالههای فیلترشده' |
164 | # filtered_tags: 'Filtered by tags:' | 164 | # filtered_tags: 'Filtered by tags:' |
165 | # filtered_search: 'Filtered by search:' | ||
165 | # untagged: 'Untagged entries' | 166 | # untagged: 'Untagged entries' |
166 | list: | 167 | list: |
167 | number_on_the_page: '{0} هیج مقالهای نیست.|{1} یک مقاله هست.|]1,Inf[ %count% مقاله هست.' | 168 | number_on_the_page: '{0} هیج مقالهای نیست.|{1} یک مقاله هست.|]1,Inf[ %count% مقاله هست.' |
@@ -227,6 +228,8 @@ entry: | |||
227 | placeholder: 'http://website.com' | 228 | placeholder: 'http://website.com' |
228 | form_new: | 229 | form_new: |
229 | url_label: نشانی | 230 | url_label: نشانی |
231 | search: | ||
232 | # placeholder: 'What are you looking for?' | ||
230 | edit: | 233 | edit: |
231 | page_title: 'ویرایش مقاله' | 234 | page_title: 'ویرایش مقاله' |
232 | title_label: 'عنوان' | 235 | title_label: 'عنوان' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 2932f2fd..d97eab26 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | |||
@@ -162,6 +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 recherche :' | ||
165 | untagged: "Article sans tag" | 166 | untagged: "Article sans tag" |
166 | list: | 167 | list: |
167 | 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." |
@@ -227,6 +228,8 @@ entry: | |||
227 | placeholder: "http://website.com" | 228 | placeholder: "http://website.com" |
228 | form_new: | 229 | form_new: |
229 | url_label: "Adresse" | 230 | url_label: "Adresse" |
231 | search: | ||
232 | placeholder: "Que recherchez-vous ?" | ||
230 | edit: | 233 | edit: |
231 | page_title: "Éditer un article" | 234 | page_title: "Éditer un article" |
232 | title_label: "Titre" | 235 | title_label: "Titre" |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index 538e25a6..4be99a27 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml | |||
@@ -162,6 +162,7 @@ entry: | |||
162 | archived: 'Contenuti archiviati' | 162 | archived: 'Contenuti archiviati' |
163 | filtered: 'Contenuti filtrati' | 163 | filtered: 'Contenuti filtrati' |
164 | # filtered_tags: 'Filtered by tags:' | 164 | # filtered_tags: 'Filtered by tags:' |
165 | # filtered_search: 'Filtered by search:' | ||
165 | # untagged: 'Untagged entries' | 166 | # untagged: 'Untagged entries' |
166 | list: | 167 | list: |
167 | number_on_the_page: "{0} Non ci sono contenuti.|{1} C'è un contenuto.|]1,Inf[ Ci sono %count% contenuti." | 168 | number_on_the_page: "{0} Non ci sono contenuti.|{1} C'è un contenuto.|]1,Inf[ Ci sono %count% contenuti." |
@@ -227,6 +228,8 @@ entry: | |||
227 | placeholder: 'http://website.com' | 228 | placeholder: 'http://website.com' |
228 | form_new: | 229 | form_new: |
229 | url_label: Url | 230 | url_label: Url |
231 | search: | ||
232 | # placeholder: 'What are you looking for?' | ||
230 | edit: | 233 | edit: |
231 | page_title: 'Modifica voce' | 234 | page_title: 'Modifica voce' |
232 | title_label: 'Titolo' | 235 | title_label: 'Titolo' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index 6f415c3b..5ded91f9 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml | |||
@@ -162,6 +162,7 @@ entry: | |||
162 | archived: 'Articles legits' | 162 | archived: 'Articles legits' |
163 | filtered: 'Articles filtrats' | 163 | filtered: 'Articles filtrats' |
164 | filtered_tags: 'Filtats per etiquetas:' | 164 | filtered_tags: 'Filtats per etiquetas:' |
165 | # filtered_search: 'Filtered by search:' | ||
165 | untagged: 'Articles sens etiqueta' | 166 | untagged: 'Articles sens etiqueta' |
166 | list: | 167 | list: |
167 | number_on_the_page: "{0} I a pas cap d'article.|{1} I a un article.|]1,Inf[ I a %count% articles." | 168 | number_on_the_page: "{0} I a pas cap d'article.|{1} I a un article.|]1,Inf[ I a %count% articles." |
@@ -227,6 +228,8 @@ entry: | |||
227 | placeholder: 'http://website.com' | 228 | placeholder: 'http://website.com' |
228 | form_new: | 229 | form_new: |
229 | url_label: Url | 230 | url_label: Url |
231 | search: | ||
232 | # placeholder: 'What are you looking for?' | ||
230 | edit: | 233 | edit: |
231 | page_title: 'Modificar un article' | 234 | page_title: 'Modificar un article' |
232 | title_label: 'Títol' | 235 | title_label: 'Títol' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index df5ab7e5..38fc4ceb 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml | |||
@@ -162,6 +162,7 @@ entry: | |||
162 | archived: 'Zarchiwizowane wpisy' | 162 | archived: 'Zarchiwizowane wpisy' |
163 | filtered: 'Odfiltrowane wpisy' | 163 | filtered: 'Odfiltrowane wpisy' |
164 | filtered_tags: 'Filtrowane po tagach:' | 164 | filtered_tags: 'Filtrowane po tagach:' |
165 | # filtered_search: 'Filtered by search:' | ||
165 | untagged: 'Odtaguj wpisy' | 166 | untagged: 'Odtaguj wpisy' |
166 | list: | 167 | list: |
167 | number_on_the_page: '{0} Nie ma wpisów.|{1} Jest jeden wpis.|]1,Inf[ Są %count% wpisy.' | 168 | number_on_the_page: '{0} Nie ma wpisów.|{1} Jest jeden wpis.|]1,Inf[ Są %count% wpisy.' |
@@ -227,6 +228,8 @@ entry: | |||
227 | placeholder: 'http://website.com' | 228 | placeholder: 'http://website.com' |
228 | form_new: | 229 | form_new: |
229 | url_label: Url | 230 | url_label: Url |
231 | search: | ||
232 | # placeholder: 'What are you looking for?' | ||
230 | edit: | 233 | edit: |
231 | page_title: 'Edytuj wpis' | 234 | page_title: 'Edytuj wpis' |
232 | title_label: 'Tytuł' | 235 | title_label: 'Tytuł' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml index 1c1c9a78..4084469c 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml | |||
@@ -162,6 +162,7 @@ entry: | |||
162 | archived: 'Entradas arquivadas' | 162 | archived: 'Entradas arquivadas' |
163 | filtered: 'Entradas filtradas' | 163 | filtered: 'Entradas filtradas' |
164 | filtered_tags: 'Filtrar por tags:' | 164 | filtered_tags: 'Filtrar por tags:' |
165 | # filtered_search: 'Filtered by search:' | ||
165 | untagged: 'Entradas sem tags' | 166 | untagged: 'Entradas sem tags' |
166 | list: | 167 | list: |
167 | number_on_the_page: '{0} Não existem entradas.|{1} Existe uma entrada.|]1,Inf[ Existem %count% entradas.' | 168 | number_on_the_page: '{0} Não existem entradas.|{1} Existe uma entrada.|]1,Inf[ Existem %count% entradas.' |
@@ -227,6 +228,8 @@ entry: | |||
227 | placeholder: 'http://website.com' | 228 | placeholder: 'http://website.com' |
228 | form_new: | 229 | form_new: |
229 | url_label: Url | 230 | url_label: Url |
231 | search: | ||
232 | # placeholder: 'What are you looking for?' | ||
230 | edit: | 233 | edit: |
231 | page_title: 'Editar uma entrada' | 234 | page_title: 'Editar uma entrada' |
232 | title_label: 'Título' | 235 | title_label: 'Título' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index 8da04d95..a6a7e146 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml | |||
@@ -162,6 +162,7 @@ entry: | |||
162 | # archived: 'Archived entries' | 162 | # archived: 'Archived entries' |
163 | # filtered: 'Filtered entries' | 163 | # filtered: 'Filtered entries' |
164 | # filtered_tags: 'Filtered by tags:' | 164 | # filtered_tags: 'Filtered by tags:' |
165 | # filtered_search: 'Filtered by search:' | ||
165 | # untagged: 'Untagged entries' | 166 | # untagged: 'Untagged entries' |
166 | list: | 167 | list: |
167 | # number_on_the_page: '{0} There is no entry.|{1} There is one entry.|]1,Inf[ There are %count% entries.' | 168 | # number_on_the_page: '{0} There is no entry.|{1} There is one entry.|]1,Inf[ There are %count% entries.' |
@@ -227,6 +228,8 @@ entry: | |||
227 | placeholder: 'http://website.com' | 228 | placeholder: 'http://website.com' |
228 | form_new: | 229 | form_new: |
229 | url_label: Url | 230 | url_label: Url |
231 | search: | ||
232 | # placeholder: 'What are you looking for?' | ||
230 | edit: | 233 | edit: |
231 | # page_title: 'Edit an entry' | 234 | # page_title: 'Edit an entry' |
232 | # title_label: 'Title' | 235 | # title_label: 'Title' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index 8d94044c..630ad0ca 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml | |||
@@ -162,6 +162,7 @@ entry: | |||
162 | # archived: 'Archived entries' | 162 | # archived: 'Archived entries' |
163 | # filtered: 'Filtered entries' | 163 | # filtered: 'Filtered entries' |
164 | # filtered_tags: 'Filtered by tags:' | 164 | # filtered_tags: 'Filtered by tags:' |
165 | # filtered_search: 'Filtered by search:' | ||
165 | # untagged: 'Untagged entries' | 166 | # untagged: 'Untagged entries' |
166 | list: | 167 | list: |
167 | number_on_the_page: '{0} Herhangi bir makale yok.|{1} Burada bir adet makale var.|]1,Inf[ Burada %count% adet makale var.' | 168 | number_on_the_page: '{0} Herhangi bir makale yok.|{1} Burada bir adet makale var.|]1,Inf[ Burada %count% adet makale var.' |
@@ -227,6 +228,8 @@ entry: | |||
227 | placeholder: 'http://website.com' | 228 | placeholder: 'http://website.com' |
228 | form_new: | 229 | form_new: |
229 | url_label: Url | 230 | url_label: Url |
231 | search: | ||
232 | # placeholder: 'What are you looking for?' | ||
230 | edit: | 233 | edit: |
231 | page_title: 'Makaleyi düzenle' | 234 | page_title: 'Makaleyi düzenle' |
232 | title_label: 'Başlık' | 235 | title_label: 'Başlık' |
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 d1baa283..a13fe903 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 | |||
@@ -1,11 +1,14 @@ | |||
1 | {% extends "WallabagCoreBundle::layout.html.twig" %} | 1 | {% extends "WallabagCoreBundle::layout.html.twig" %} |
2 | 2 | ||
3 | {% block title %} | 3 | {% block title %} |
4 | {% set currentTag = '' %} | 4 | {% set filter = '' %} |
5 | {% if tag is defined %} | 5 | {% if tag is defined %} |
6 | {% set currentTag = tag %} | 6 | {% set filter = tag %} |
7 | {% endif %} | ||
8 | {% if searchTerm is defined and searchTerm is not empty %} | ||
9 | {% set filter = searchTerm %} | ||
7 | {% endif %} | 10 | {% endif %} |
8 | {% include "@WallabagCore/themes/common/Entry/_title.html.twig" with {'currentTag': currentTag} %} | 11 | {% include "@WallabagCore/themes/common/Entry/_title.html.twig" with {'filter': filter} %} |
9 | {% endblock %} | 12 | {% endblock %} |
10 | 13 | ||
11 | {% block content %} | 14 | {% block content %} |
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 new file mode 100644 index 00000000..20821b6d --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/search_form.html.twig | |||
@@ -0,0 +1,17 @@ | |||
1 | <form name="search" method="GET" action="{{ path('search')}}"> | ||
2 | <h2>{{ 'menu.left.search'|trans }}</h2> | ||
3 | <a href="javascript: void(null);" id="search-form-close" class="close-button--popup close-button">×</a> | ||
4 | {% if form_errors(form) %} | ||
5 | <span class="black-text">{{ form_errors(form) }}</span> | ||
6 | {% endif %} | ||
7 | |||
8 | {% if form_errors(form.term) %} | ||
9 | <span class="black-text">{{ form_errors(form.term) }}</span> | ||
10 | {% endif %} | ||
11 | |||
12 | <input type="hidden" name="currentRoute" value="{{ currentRoute }}" /> | ||
13 | |||
14 | {{ form_widget(form.term, { 'attr': {'autocomplete': 'off', 'placeholder': 'entry.search.placeholder'} }) }} | ||
15 | |||
16 | {{ form_rest(form) }} | ||
17 | </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 cd4ed3fa..07ff8e14 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig | |||
@@ -31,17 +31,11 @@ | |||
31 | <li class="menu all"><a href="{{ path('all') }}">{{ 'menu.left.all_articles'|trans }}</a></li> | 31 | <li class="menu all"><a href="{{ path('all') }}">{{ 'menu.left.all_articles'|trans }}</a></li> |
32 | <li class="menu tag"><a href="{{ path('tag') }}">{{ 'menu.left.tags'|trans }}</a></li> | 32 | <li class="menu tag"><a href="{{ path('tag') }}">{{ 'menu.left.tags'|trans }}</a></li> |
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 | <form method="get" action="index.php"> | 36 | {{ render(controller("WallabagCoreBundle:Entry:searchForm", {'currentRoute': app.request.attributes.get('_route')})) }} |
37 | <h2>{{ 'menu.left.search'|trans }}</h2> | ||
38 | <a href="javascript: void(null);" id="search-form-close" class="close-button--popup close-button">×</a> | ||
39 | <input type="hidden" name="view" value="search"> | ||
40 | <input required placeholder="{{ 'menu.search_form.input_label'|trans }}" type="text" name="search" id="searchfield"><br> | ||
41 | <input id="submit-search" type="submit" value="{{ 'menu.left.search'|trans }}"> | ||
42 | </form> | ||
43 | </div> | 37 | </div> |
44 | </li>--> | 38 | </li> |
45 | <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> |
46 | {% if is_granted('ROLE_SUPER_ADMIN') %} | 40 | {% if is_granted('ROLE_SUPER_ADMIN') %} |
47 | <li class="menu users"><a href="{{ path('user_index') }}">{{ 'menu.left.users_management'|trans }}</a></li> | 41 | <li class="menu users"><a href="{{ path('user_index') }}">{{ 'menu.left.users_management'|trans }}</a></li> |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/_title.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/_title.html.twig index 92cabdd9..654c1d2d 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/_title.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/_title.html.twig | |||
@@ -6,8 +6,10 @@ | |||
6 | {{ 'entry.page_titles.archived'|trans }} | 6 | {{ 'entry.page_titles.archived'|trans }} |
7 | {% elseif currentRoute == 'all' %} | 7 | {% elseif currentRoute == 'all' %} |
8 | {{ 'entry.page_titles.filtered'|trans }} | 8 | {{ 'entry.page_titles.filtered'|trans }} |
9 | {% elseif currentRoute == 'search' %} | ||
10 | {{ 'entry.page_titles.filtered_search'|trans }} {{ filter }} | ||
9 | {% elseif currentRoute == 'tag_entries' %} | 11 | {% elseif currentRoute == 'tag_entries' %} |
10 | {{ 'entry.page_titles.filtered_tags'|trans }} {{ currentTag }} | 12 | {{ 'entry.page_titles.filtered_tags'|trans }} {{ filter }} |
11 | {% elseif currentRoute == 'untagged' %} | 13 | {% elseif currentRoute == 'untagged' %} |
12 | {{ 'entry.page_titles.untagged'|trans }} | 14 | {{ 'entry.page_titles.untagged'|trans }} |
13 | {% else %} | 15 | {% else %} |
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 160dbf3d..00e8bf63 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 | |||
@@ -1,11 +1,14 @@ | |||
1 | {% extends "WallabagCoreBundle::layout.html.twig" %} | 1 | {% extends "WallabagCoreBundle::layout.html.twig" %} |
2 | 2 | ||
3 | {% block title %} | 3 | {% block title %} |
4 | {% set currentTag = '' %} | 4 | {% set filter = '' %} |
5 | {% if tag is defined %} | 5 | {% if tag is defined %} |
6 | {% set currentTag = tag %} | 6 | {% set filter = tag %} |
7 | {% endif %} | ||
8 | {% if searchTerm is defined and searchTerm is not empty %} | ||
9 | {% set filter = searchTerm %} | ||
7 | {% endif %} | 10 | {% endif %} |
8 | {% include "@WallabagCore/themes/common/Entry/_title.html.twig" with {'currentTag': currentTag} %} | 11 | {% include "@WallabagCore/themes/common/Entry/_title.html.twig" with {'filter': filter} %} |
9 | {% endblock %} | 12 | {% endblock %} |
10 | 13 | ||
11 | {% block content %} | 14 | {% block content %} |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/search_form.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/search_form.html.twig new file mode 100644 index 00000000..f25de94d --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/search_form.html.twig | |||
@@ -0,0 +1,15 @@ | |||
1 | <form name="search" method="GET" action="{{ path('search')}}"> | ||
2 | {% if form_errors(form) %} | ||
3 | <span class="black-text">{{ form_errors(form) }}</span> | ||
4 | {% endif %} | ||
5 | |||
6 | {% if form_errors(form.term) %} | ||
7 | <span class="black-text">{{ form_errors(form.term) }}</span> | ||
8 | {% endif %} | ||
9 | |||
10 | <input type="hidden" name="currentRoute" value="{{ currentRoute }}" /> | ||
11 | |||
12 | {{ form_widget(form.term, { 'attr': {'autocomplete': 'off', 'placeholder': 'entry.search.placeholder'} }) }} | ||
13 | |||
14 | {{ form_rest(form) }} | ||
15 | </form> | ||
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 f1ef01df..551486e0 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig | |||
@@ -89,11 +89,11 @@ | |||
89 | <i class="material-icons">add</i> | 89 | <i class="material-icons">add</i> |
90 | </a> | 90 | </a> |
91 | </li> | 91 | </li> |
92 | <!--<li> | 92 | <li> |
93 | <a title="{{ 'menu.top.search'|trans }}" class="waves-effect" href="javascript: void(null);" id="nav-btn-search"> | 93 | <a title="{{ 'menu.top.search'|trans }}" class="waves-effect" href="javascript: void(null);" id="nav-btn-search"> |
94 | <i class="material-icons">search</i> | 94 | <i class="material-icons">search</i> |
95 | </a> | 95 | </a> |
96 | </li>--> | 96 | </li> |
97 | <li id="button_filters"> | 97 | <li id="button_filters"> |
98 | <a class="nav-panel-menu button-collapse-right tooltipped" data-position="bottom" data-delay="50" data-tooltip="{{ 'menu.top.filter_entries'|trans }}" href="#" data-activates="filters"> | 98 | <a class="nav-panel-menu button-collapse-right tooltipped" data-position="bottom" data-delay="50" data-tooltip="{{ 'menu.top.filter_entries'|trans }}" href="#" data-activates="filters"> |
99 | <i class="material-icons">filter_list</i> | 99 | <i class="material-icons">filter_list</i> |
@@ -106,13 +106,11 @@ | |||
106 | </li> | 106 | </li> |
107 | </ul> | 107 | </ul> |
108 | </div> | 108 | </div> |
109 | <form method="get" action="index.php"> | 109 | <div class="input-field nav-panel-search" style="display: none"> |
110 | <div class="input-field nav-panel-search" style="display: none"> | 110 | {{ render(controller("WallabagCoreBundle:Entry:searchForm", {'currentRoute': app.request.attributes.get('_route')})) }} |
111 | <input name="search" id="searchfield" type="search" required placeholder="{{ 'menu.search_form.input_label'|trans }}"> | 111 | <label for="search" class="active"><i class="material-icons search">search</i></label> |
112 | <label for="search"><i class="material-icons search">search</i></label> | 112 | <i class="material-icons close">clear</i> |
113 | <i class="material-icons close">clear</i> | 113 | </div> |
114 | </div> | ||
115 | </form> | ||
116 | <div class="input-field nav-panel-add" style="display: none"> | 114 | <div class="input-field nav-panel-add" style="display: none"> |
117 | {{ render(controller("WallabagCoreBundle:Entry:addEntryForm")) }} | 115 | {{ render(controller("WallabagCoreBundle:Entry:addEntryForm")) }} |
118 | <label for="add" class="active"><i class="material-icons add">add</i></label> | 116 | <label for="add" class="active"><i class="material-icons add">add</i></label> |