aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNicolas Lœuillet <nicolas@loeuillet.org>2015-09-23 09:13:34 +0200
committerNicolas Lœuillet <nicolas@loeuillet.org>2015-09-23 09:13:34 +0200
commit57162494557c5eac938a7d6800ac1b112f73efc9 (patch)
tree0e0638166e8b734e17b9eb9a4c86d9008ed7be3d /src
parent1db9d411c5b1fe592788866dc206e2fd6dc87a71 (diff)
parentd4ebe5c5dcf581416ab76136908cafbde78f63bf (diff)
downloadwallabag-57162494557c5eac938a7d6800ac1b112f73efc9.tar.gz
wallabag-57162494557c5eac938a7d6800ac1b112f73efc9.tar.zst
wallabag-57162494557c5eac938a7d6800ac1b112f73efc9.zip
Merge pull request #1429 from wallabag/v2-language
V2 – Handle language in entry
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Controller/EntryController.php2
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php6
-rw-r--r--src/Wallabag/CoreBundle/Entity/Entry.php31
-rw-r--r--src/Wallabag/CoreBundle/Entity/User.php5
-rw-r--r--src/Wallabag/CoreBundle/Filter/EntryFilterType.php23
-rw-r--r--src/Wallabag/CoreBundle/Helper/ContentProxy.php1
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php27
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig8
-rwxr-xr-xsrc/Wallabag/CoreBundle/Resources/views/themes/baggy/public/css/main.css102
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig26
-rwxr-xr-xsrc/Wallabag/CoreBundle/Resources/views/themes/material/public/css/main.css5
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php23
-rw-r--r--src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php24
13 files changed, 217 insertions, 66 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php
index b9e4e67e..a9f35c36 100644
--- a/src/Wallabag/CoreBundle/Controller/EntryController.php
+++ b/src/Wallabag/CoreBundle/Controller/EntryController.php
@@ -192,7 +192,7 @@ class EntryController extends Controller
192 throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); 192 throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type));
193 } 193 }
194 194
195 $form = $this->get('form.factory')->create(new EntryFilterType()); 195 $form = $this->get('form.factory')->create(new EntryFilterType($repository, $this->getUser()));
196 196
197 if ($request->query->has($form->getName())) { 197 if ($request->query->has($form->getName())) {
198 // manually bind values from the request 198 // manually bind values from the request
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php
index 6cd24d44..dd316194 100644
--- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php
+++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php
@@ -19,6 +19,7 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface
19 $entry1->setUrl('http://0.0.0.0'); 19 $entry1->setUrl('http://0.0.0.0');
20 $entry1->setTitle('test title entry1'); 20 $entry1->setTitle('test title entry1');
21 $entry1->setContent('This is my content /o/'); 21 $entry1->setContent('This is my content /o/');
22 $entry1->setLanguage('en');
22 23
23 $manager->persist($entry1); 24 $manager->persist($entry1);
24 25
@@ -28,6 +29,7 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface
28 $entry2->setUrl('http://0.0.0.0'); 29 $entry2->setUrl('http://0.0.0.0');
29 $entry2->setTitle('test title entry2'); 30 $entry2->setTitle('test title entry2');
30 $entry2->setContent('This is my content /o/'); 31 $entry2->setContent('This is my content /o/');
32 $entry2->setLanguage('fr');
31 33
32 $manager->persist($entry2); 34 $manager->persist($entry2);
33 35
@@ -37,6 +39,7 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface
37 $entry3->setUrl('http://0.0.0.0'); 39 $entry3->setUrl('http://0.0.0.0');
38 $entry3->setTitle('test title entry3'); 40 $entry3->setTitle('test title entry3');
39 $entry3->setContent('This is my content /o/'); 41 $entry3->setContent('This is my content /o/');
42 $entry3->setLanguage('en');
40 43
41 $tag1 = new Tag($this->getReference('bob-user')); 44 $tag1 = new Tag($this->getReference('bob-user'));
42 $tag1->setLabel('foo'); 45 $tag1->setLabel('foo');
@@ -54,6 +57,7 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface
54 $entry4->setUrl('http://0.0.0.0'); 57 $entry4->setUrl('http://0.0.0.0');
55 $entry4->setTitle('test title entry4'); 58 $entry4->setTitle('test title entry4');
56 $entry4->setContent('This is my content /o/'); 59 $entry4->setContent('This is my content /o/');
60 $entry4->setLanguage('en');
57 61
58 $tag1 = new Tag($this->getReference('admin-user')); 62 $tag1 = new Tag($this->getReference('admin-user'));
59 $tag1->setLabel('foo'); 63 $tag1->setLabel('foo');
@@ -72,6 +76,7 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface
72 $entry5->setTitle('test title entry5'); 76 $entry5->setTitle('test title entry5');
73 $entry5->setContent('This is my content /o/'); 77 $entry5->setContent('This is my content /o/');
74 $entry5->setStarred(true); 78 $entry5->setStarred(true);
79 $entry5->setLanguage('fr');
75 80
76 $manager->persist($entry5); 81 $manager->persist($entry5);
77 82
@@ -82,6 +87,7 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface
82 $entry6->setTitle('test title entry6'); 87 $entry6->setTitle('test title entry6');
83 $entry6->setContent('This is my content /o/'); 88 $entry6->setContent('This is my content /o/');
84 $entry6->setArchived(true); 89 $entry6->setArchived(true);
90 $entry6->setLanguage('de');
85 91
86 $manager->persist($entry6); 92 $manager->persist($entry6);
87 93
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php
index e684c9b1..7108889e 100644
--- a/src/Wallabag/CoreBundle/Entity/Entry.php
+++ b/src/Wallabag/CoreBundle/Entity/Entry.php
@@ -95,6 +95,13 @@ class Entry
95 private $mimetype; 95 private $mimetype;
96 96
97 /** 97 /**
98 * @var string
99 *
100 * @ORM\Column(name="language", type="text", nullable=true)
101 */
102 private $language;
103
104 /**
98 * @var int 105 * @var int
99 * 106 *
100 * @ORM\Column(name="reading_time", type="integer", nullable=true) 107 * @ORM\Column(name="reading_time", type="integer", nullable=true)
@@ -450,4 +457,28 @@ class Entry
450 { 457 {
451 return $this->previewPicture; 458 return $this->previewPicture;
452 } 459 }
460
461 /**
462 * Set language.
463 *
464 * @param string $language
465 *
466 * @return Entry
467 */
468 public function setLanguage($language)
469 {
470 $this->language = $language;
471
472 return $this;
473 }
474
475 /**
476 * Get language.
477 *
478 * @return string
479 */
480 public function getLanguage()
481 {
482 return $this->language;
483 }
453} 484}
diff --git a/src/Wallabag/CoreBundle/Entity/User.php b/src/Wallabag/CoreBundle/Entity/User.php
index eeae331e..a6002352 100644
--- a/src/Wallabag/CoreBundle/Entity/User.php
+++ b/src/Wallabag/CoreBundle/Entity/User.php
@@ -7,7 +7,6 @@ use Doctrine\ORM\Mapping as ORM;
7use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; 7use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
8use Symfony\Component\Security\Core\User\UserInterface; 8use Symfony\Component\Security\Core\User\UserInterface;
9use Symfony\Component\Security\Core\User\AdvancedUserInterface; 9use Symfony\Component\Security\Core\User\AdvancedUserInterface;
10use Symfony\Component\Validator\Constraints as Assert;
11use JMS\Serializer\Annotation\ExclusionPolicy; 10use JMS\Serializer\Annotation\ExclusionPolicy;
12use JMS\Serializer\Annotation\Expose; 11use JMS\Serializer\Annotation\Expose;
13use FOS\UserBundle\Model\User as BaseUser; 12use FOS\UserBundle\Model\User as BaseUser;
@@ -74,8 +73,8 @@ class User extends BaseUser implements AdvancedUserInterface, \Serializable
74 public function __construct() 73 public function __construct()
75 { 74 {
76 parent::__construct(); 75 parent::__construct();
77 $this->entries = new ArrayCollection(); 76 $this->entries = new ArrayCollection();
78 $this->tags = new ArrayCollection(); 77 $this->tags = new ArrayCollection();
79 } 78 }
80 79
81 /** 80 /**
diff --git a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php b/src/Wallabag/CoreBundle/Filter/EntryFilterType.php
index 024486e6..f40c1c2d 100644
--- a/src/Wallabag/CoreBundle/Filter/EntryFilterType.php
+++ b/src/Wallabag/CoreBundle/Filter/EntryFilterType.php
@@ -6,9 +6,26 @@ use Symfony\Component\Form\AbstractType;
6use Symfony\Component\Form\FormBuilderInterface; 6use Symfony\Component\Form\FormBuilderInterface;
7use Symfony\Component\OptionsResolver\OptionsResolver; 7use Symfony\Component\OptionsResolver\OptionsResolver;
8use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface; 8use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface;
9use Doctrine\ORM\EntityRepository;
10use Wallabag\CoreBundle\Entity\User;
9 11
10class EntryFilterType extends AbstractType 12class EntryFilterType extends AbstractType
11{ 13{
14 private $user;
15 private $repository;
16
17 /**
18 * Repository & user are used to get a list of language entries for this user
19 *
20 * @param EntityRepository $entryRepository
21 * @param User $user
22 */
23 public function __construct(EntityRepository $entryRepository, User $user)
24 {
25 $this->repository = $entryRepository;
26 $this->user = $user;
27 }
28
12 public function buildForm(FormBuilderInterface $builder, array $options) 29 public function buildForm(FormBuilderInterface $builder, array $options)
13 { 30 {
14 $builder 31 $builder
@@ -53,7 +70,11 @@ class EntryFilterType extends AbstractType
53 70
54 return $filterQuery->createCondition($expression); 71 return $filterQuery->createCondition($expression);
55 }, 72 },
56 )); 73 ))
74 ->add('language', 'filter_choice', array(
75 'choices' => $this->repository->findDistinctLanguageByUser($this->user->getId()),
76 ))
77 ;
57 } 78 }
58 79
59 public function getName() 80 public function getName()
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php
index 4565d8e7..3de8828f 100644
--- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php
+++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php
@@ -49,6 +49,7 @@ class ContentProxy
49 $entry->setUrl($content['url'] ?: $url); 49 $entry->setUrl($content['url'] ?: $url);
50 $entry->setTitle($title); 50 $entry->setTitle($title);
51 $entry->setContent($html); 51 $entry->setContent($html);
52 $entry->setLanguage($content['language']);
52 $entry->setMimetype($content['content_type']); 53 $entry->setMimetype($content['content_type']);
53 54
54 if (isset($content['open_graph']['og_image'])) { 55 if (isset($content['open_graph']['og_image'])) {
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index e764e8f7..87b9befe 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -134,4 +134,31 @@ class EntryRepository extends EntityRepository
134 134
135 return $qb->getQuery()->getResult(); 135 return $qb->getQuery()->getResult();
136 } 136 }
137
138 /**
139 * Find distinct language for a given user.
140 * Used to build the filter language list.
141 *
142 * @param int $userId User id
143 *
144 * @return array
145 */
146 public function findDistinctLanguageByUser($userId)
147 {
148 $results = $this->createQueryBuilder('e')
149 ->select('e.language')
150 ->where('e.user = :userId')->setParameter('userId', $userId)
151 ->andWhere('e.language IS NOT NULL')
152 ->groupBy('e.language')
153 ->orderBy('e.language', ' ASC')
154 ->getQuery()
155 ->getResult();
156
157 $languages = array();
158 foreach ($results as $result) {
159 $languages[$result['language']] = $result['language'];
160 }
161
162 return $languages;
163 }
137} 164}
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 176290e4..08f3fe60 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
@@ -71,6 +71,14 @@
71 <label for="entry_filter_previewPicture">{% trans %}Has a preview picture{% endtrans %}</label> 71 <label for="entry_filter_previewPicture">{% trans %}Has a preview picture{% endtrans %}</label>
72 </div> 72 </div>
73 </div> 73 </div>
74
75 <div id="filter-language" class="filter-group">
76 <label for="entry_filter_language">{% trans %}Language{% endtrans %}</label>
77 <div class="input-field ">
78 {{ form_widget(form.language) }}
79 </div>
80 </div>
81
74 <div id="filter-reading-time" class="filter-group"> 82 <div id="filter-reading-time" class="filter-group">
75 <div class=""> 83 <div class="">
76 <label>{% trans %}Reading time in minutes{% endtrans %}</label> 84 <label>{% trans %}Reading time in minutes{% endtrans %}</label>
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 950d8b0e..4aeadb4f 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
@@ -356,9 +356,9 @@ footer a {
356 overflow: hidden; 356 overflow: hidden;
357 padding: 1.5em 1.5em 3em 1.5em; 357 padding: 1.5em 1.5em 3em 1.5em;
358 358
359 /* Removing CSS transitions because they make the switch from list view to 359 /* Removing CSS transitions because they make the switch from list view to
360 * table view jerky 360 * table view jerky
361 */ 361 */
362 /* -webkit-transition: all 0.5s ease; */ 362 /* -webkit-transition: all 0.5s ease; */
363 /* -moz-transition: all 0.5s ease; */ 363 /* -moz-transition: all 0.5s ease; */
364 /* -ms-transition: all 0.5s ease; */ 364 /* -ms-transition: all 0.5s ease; */
@@ -570,47 +570,47 @@ img.preview {
570 border-left: 1px #EEE solid; 570 border-left: 1px #EEE solid;
571} 571}
572 572
573 .popup-form form { 573 .popup-form form {
574 background-color: #FFF; 574 background-color: #FFF;
575 position: absolute; 575 position: absolute;
576 top: 0; 576 top: 0;
577 left: 0; 577 left: 0;
578 z-index: 20; 578 z-index: 20;
579 border: 10px solid #000; 579 border: 10px solid #000;
580 width: 400px; 580 width: 400px;
581 height: 200px; 581 height: 200px;
582 padding: 2em; 582 padding: 2em;
583 } 583 }
584 584
585#bagit-form-form .addurl { 585#bagit-form-form .addurl {
586 margin-left: 0; 586 margin-left: 0;
587} 587}
588 588
589.closeMessage, 589.closeMessage,
590.close-button { 590.close-button {
591 background-color: #000; 591 background-color: #000;
592 color: #FFF; 592 color: #FFF;
593 font-size: 1.2em; 593 font-size: 1.2em;
594 line-height: 1.6; 594 line-height: 1.6;
595 width: 1.6em; 595 width: 1.6em;
596 height: 1.6em; 596 height: 1.6em;
597 text-align: center; 597 text-align: center;
598 text-decoration: none; 598 text-decoration: none;
599} 599}
600 .closeMessage:hover, 600 .closeMessage:hover,
601 .closeMessage:focus, 601 .closeMessage:focus,
602 .close-button:hover, 602 .close-button:hover,
603 .close-button:focus { 603 .close-button:focus {
604 background-color: #999; 604 background-color: #999;
605 color: #000; 605 color: #000;
606 } 606 }
607 607
608.close-button--popup { 608.close-button--popup {
609 display: inline-block; 609 display: inline-block;
610 position: absolute; 610 position: absolute;
611 top: 0; 611 top: 0;
612 right: 0; 612 right: 0;
613 font-size: 1.4em; 613 font-size: 1.4em;
614} 614}
615 615
616.active-current { 616.active-current {
@@ -753,24 +753,24 @@ a.add-to-wallabag-link-after:after {
753 753
754 754
755/* .icon-image class, for image-based icons 755/* .icon-image class, for image-based icons
756 ========================================================================== */ 756 ========================================================================== */
757 757
758.icon-image { 758.icon-image {
759 background-size: 16px 16px; 759 background-size: 16px 16px;
760 background-repeat: no-repeat; 760 background-repeat: no-repeat;
761 background-position: center; 761 background-position: center;
762 padding-right: 1em !important; 762 padding-right: 1em !important;
763 padding-left: 1em !important; 763 padding-left: 1em !important;
764} 764}
765 765
766/* Carrot (http://carrot.org) */ 766/* Carrot (http://carrot.org) */
767.icon-image--carrot { 767.icon-image--carrot {
768 background-image: url('../../_global/img/icons/carrot-icon--white.png'); 768 background-image: url('../../_global/img/icons/carrot-icon--white.png');
769} 769}
770 770
771/* Diaspora */ 771/* Diaspora */
772.icon-image--diaspora { 772.icon-image--diaspora {
773 background-image: url('../../_global/img/icons/diaspora-icon--black.png'); 773 background-image: url('../../_global/img/icons/diaspora-icon--black.png');
774}} 774}}
775 775
776/* ========================================================================== 776/* ==========================================================================
@@ -813,14 +813,14 @@ a.add-to-wallabag-link-after:after {
813} 813}
814 814
815.more-info { 815.more-info {
816 font-size: 0.85em; 816 font-size: 0.85em;
817 line-height: 1.5; 817 line-height: 1.5;
818 color: #aaa; 818 color: #aaa;
819} 819}
820 820
821 .more-info a { 821 .more-info a {
822 color: #aaa; 822 color: #aaa;
823 } 823 }
824 824
825/* ========================================================================== 825/* ==========================================================================
826 5 = Article 826 5 = Article
@@ -934,9 +934,9 @@ blockquote {
934} 934}
935 935
936pre code { 936pre code {
937 font-family: "Courier New", Courier, monospace; 937 font-family: "Courier New", Courier, monospace;
938 border: 1px solid #ccc; 938 border: 1px solid #ccc;
939 font-size: 0.96em; 939 font-size: 0.96em;
940} 940}
941 941
942#filter-form { 942#filter-form {
@@ -949,18 +949,18 @@ pre code {
949 padding: 15px; 949 padding: 15px;
950 padding-right: 30px; 950 padding-right: 30px;
951 padding-top: 30px; 951 padding-top: 30px;
952 952 border-left: 1px #333 solid;
953 z-index: 12; 953 z-index: 12;
954 954
955 /*transition-property: transform; 955 /*transition-property: transform;
956 transition-duration: 0.3s; 956 transition-duration: 0.3s;
957 transition-delay: 0.3s; 957 transition-delay: 0.3s;
958 958
959 transform: translate3d(100%, 0, 0);*/ 959 transform: translate3d(100%, 0, 0);*/
960} 960}
961 961
962#filter-form form { 962#filter-form form {
963 963
964} 964}
965 965
966#filter-form form .filter-group { 966#filter-form form .filter-group {
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 77483a09..dcdf7c09 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
@@ -98,25 +98,35 @@
98 <h4 class="center">{% trans %}Filters{% endtrans %}</h1> 98 <h4 class="center">{% trans %}Filters{% endtrans %}</h1>
99 99
100 <div class="row"> 100 <div class="row">
101 <div class="col s12">
102 <label>{% trans %}Status{% endtrans %}</label>
103 </div>
104
105 <div class="input-field col s6 with-checkbox">
106 {{ form_widget(form.isArchived) }}
107 <label for="entry_filter_isArchived">{% trans %}Archived{% endtrans %}</label>
108 </div>
101 109
110 <div class="input-field col s6 with-checkbox">
111 {{ form_widget(form.isStarred) }}
112 <label for="entry_filter_isStarred">{% trans %}Starred{% endtrans %}</label>
113 </div>
102 114
103 <div class="col s12"> 115 <div class="col s12">
104 <label>{% trans %}Status{% endtrans %}</label> 116 <label>{% trans %}Preview picture{% endtrans %}</label>
105 </div> 117 </div>
106 118
107 <div class="input-field col s6"> 119 <div class="input-field col s12 with-checkbox">
108 {{ form_widget(form.previewPicture) }} 120 {{ form_widget(form.previewPicture) }}
109 <label for="entry_filter_previewPicture">{% trans %}Has a preview picture{% endtrans %}</label> 121 <label for="entry_filter_previewPicture">{% trans %}Has a preview picture{% endtrans %}</label>
110 </div> 122 </div>
111 123
112 <div class="input-field col s6"> 124 <div class="col s12">
113 {{ form_widget(form.isArchived) }} 125 <label>{% trans %}Language{% endtrans %}</label>
114 <label for="entry_filter_isArchived">{% trans %}Archived{% endtrans %}</label>
115 </div> 126 </div>
116 127
117 <div class="input-field col s6"> 128 <div class="input-field col s12">
118 {{ form_widget(form.isStarred) }} 129 {{ form_widget(form.language) }}
119 <label for="entry_filter_isStarred">{% trans %}Starred{% endtrans %}</label>
120 </div> 130 </div>
121 131
122 <div class="col s12"> 132 <div class="col s12">
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/public/css/main.css b/src/Wallabag/CoreBundle/Resources/views/themes/material/public/css/main.css
index 144e259f..7a4e7df2 100755
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/public/css/main.css
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/public/css/main.css
@@ -209,6 +209,11 @@ nav input {
209 overflow-y: visible; 209 overflow-y: visible;
210} 210}
211 211
212#filters div.with-checkbox {
213 height: 3rem;
214 margin-top: 0px;
215}
216
212/* ========================================================================== 217/* ==========================================================================
213 4 = Cards 218 4 = Cards
214 ========================================================================== */ 219 ========================================================================== */
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
index 77b57884..cbd84a97 100644
--- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
@@ -382,4 +382,27 @@ class EntryControllerTest extends WallabagCoreTestCase
382 $crawler = $client->submit($form); 382 $crawler = $client->submit($form);
383 $this->assertCount(1, $crawler->filter('div[class=entry]')); 383 $this->assertCount(1, $crawler->filter('div[class=entry]'));
384 } 384 }
385
386 public function testFilterOnLanguage()
387 {
388 $this->logInAs('admin');
389 $client = $this->getClient();
390
391 $crawler = $client->request('GET', '/unread/list');
392 $form = $crawler->filter('button[id=submit-filter]')->form();
393 $data = array(
394 'entry_filter[language]' => 'de',
395 );
396
397 $crawler = $client->submit($form, $data);
398 $this->assertCount(1, $crawler->filter('div[class=entry]'));
399
400 $form = $crawler->filter('button[id=submit-filter]')->form();
401 $data = array(
402 'entry_filter[language]' => 'en',
403 );
404
405 $crawler = $client->submit($form, $data);
406 $this->assertCount(2, $crawler->filter('div[class=entry]'));
407 }
385} 408}
diff --git a/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php b/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php
index 71a004ff..30065d6b 100644
--- a/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php
@@ -18,7 +18,13 @@ class ContentProxyTest extends KernelTestCase
18 18
19 $graby->expects($this->any()) 19 $graby->expects($this->any())
20 ->method('fetchContent') 20 ->method('fetchContent')
21 ->willReturn(array('html' => false, 'title' => '', 'url' => '', 'content_type' => '')); 21 ->willReturn(array(
22 'html' => false,
23 'title' => '',
24 'url' => '',
25 'content_type' => '',
26 'language' => '',
27 ));
22 28
23 $proxy = new ContentProxy($graby); 29 $proxy = new ContentProxy($graby);
24 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); 30 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0');
@@ -28,6 +34,7 @@ class ContentProxyTest extends KernelTestCase
28 $this->assertEquals('<p>Unable to retrieve readable content.</p>', $entry->getContent()); 34 $this->assertEquals('<p>Unable to retrieve readable content.</p>', $entry->getContent());
29 $this->assertEmpty($entry->getPreviewPicture()); 35 $this->assertEmpty($entry->getPreviewPicture());
30 $this->assertEmpty($entry->getMimetype()); 36 $this->assertEmpty($entry->getMimetype());
37 $this->assertEmpty($entry->getLanguage());
31 } 38 }
32 39
33 public function testWithEmptyContentButOG() 40 public function testWithEmptyContentButOG()
@@ -39,7 +46,17 @@ class ContentProxyTest extends KernelTestCase
39 46
40 $graby->expects($this->any()) 47 $graby->expects($this->any())
41 ->method('fetchContent') 48 ->method('fetchContent')
42 ->willReturn(array('html' => false, 'title' => '', 'url' => '', 'content_type' => '', 'open_graph' => array('og_title' => 'my title', 'og_description' => 'desc'))); 49 ->willReturn(array(
50 'html' => false,
51 'title' => '',
52 'url' => '',
53 'content_type' => '',
54 'language' => '',
55 'open_graph' => array(
56 'og_title' => 'my title',
57 'og_description' => 'desc',
58 ),
59 ));
43 60
44 $proxy = new ContentProxy($graby); 61 $proxy = new ContentProxy($graby);
45 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); 62 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0');
@@ -48,6 +65,7 @@ class ContentProxyTest extends KernelTestCase
48 $this->assertEquals('my title', $entry->getTitle()); 65 $this->assertEquals('my title', $entry->getTitle());
49 $this->assertEquals('<p>Unable to retrieve readable content.</p><p><i>But we found a short description: </i></p>desc', $entry->getContent()); 66 $this->assertEquals('<p>Unable to retrieve readable content.</p><p><i>But we found a short description: </i></p>desc', $entry->getContent());
50 $this->assertEmpty($entry->getPreviewPicture()); 67 $this->assertEmpty($entry->getPreviewPicture());
68 $this->assertEmpty($entry->getLanguage());
51 $this->assertEmpty($entry->getMimetype()); 69 $this->assertEmpty($entry->getMimetype());
52 } 70 }
53 71
@@ -65,6 +83,7 @@ class ContentProxyTest extends KernelTestCase
65 'title' => 'this is my title', 83 'title' => 'this is my title',
66 'url' => 'http://1.1.1.1', 84 'url' => 'http://1.1.1.1',
67 'content_type' => 'text/html', 85 'content_type' => 'text/html',
86 'language' => 'fr',
68 'open_graph' => array( 87 'open_graph' => array(
69 'og_title' => 'my OG title', 88 'og_title' => 'my OG title',
70 'og_description' => 'OG desc', 89 'og_description' => 'OG desc',
@@ -80,5 +99,6 @@ class ContentProxyTest extends KernelTestCase
80 $this->assertEquals('this is my content', $entry->getContent()); 99 $this->assertEquals('this is my content', $entry->getContent());
81 $this->assertEquals('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture()); 100 $this->assertEquals('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture());
82 $this->assertEquals('text/html', $entry->getMimetype()); 101 $this->assertEquals('text/html', $entry->getMimetype());
102 $this->assertEquals('fr', $entry->getLanguage());
83 } 103 }
84} 104}