From db96045a0ae96cfe67bc98d49596fde31c9124fc Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sun, 20 Sep 2015 22:36:51 +0200 Subject: Adjust preview picture --- .../views/themes/material/Entry/entries.html.twig | 16 ++++++++++++++-- .../Resources/views/themes/material/public/css/main.css | 5 +++++ 2 files changed, 19 insertions(+), 2 deletions(-) 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..c2157db5 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,13 +98,25 @@

{% trans %}Filters{% endtrans %}

+
+ +
+ +
+ {{ form_widget(form.isArchived) }} + +
+
+ {{ form_widget(form.isStarred) }} + +
- +
-
+
{{ form_widget(form.previewPicture) }}
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 { overflow-y: visible; } +#filters div.with-checkbox { + height: 3rem; + margin-top: 0px; +} + /* ========================================================================== 4 = Cards ========================================================================== */ -- cgit v1.2.3 From 98f0929f168a336079456f65b6ca41e84b22efff Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sun, 20 Sep 2015 22:37:27 +0200 Subject: Handle entry in language Fix #1333 --- src/Wallabag/CoreBundle/Entity/Entry.php | 31 ++++++++++++++++++++++ src/Wallabag/CoreBundle/Entity/User.php | 5 ++-- src/Wallabag/CoreBundle/Helper/ContentProxy.php | 1 + .../CoreBundle/Tests/Helper/ContentProxyTest.php | 24 +++++++++++++++-- 4 files changed, 56 insertions(+), 5 deletions(-) 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 @@ -94,6 +94,13 @@ class Entry */ private $mimetype; + /** + * @var string + * + * @ORM\Column(name="language", type="text", nullable=true) + */ + private $language; + /** * @var int * @@ -450,4 +457,28 @@ class Entry { return $this->previewPicture; } + + /** + * Set language. + * + * @param string $language + * + * @return Entry + */ + public function setLanguage($language) + { + $this->language = $language; + + return $this; + } + + /** + * Get language. + * + * @return string + */ + public function getLanguage() + { + return $this->language; + } } 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; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\AdvancedUserInterface; -use Symfony\Component\Validator\Constraints as Assert; use JMS\Serializer\Annotation\ExclusionPolicy; use JMS\Serializer\Annotation\Expose; use FOS\UserBundle\Model\User as BaseUser; @@ -74,8 +73,8 @@ class User extends BaseUser implements AdvancedUserInterface, \Serializable public function __construct() { parent::__construct(); - $this->entries = new ArrayCollection(); - $this->tags = new ArrayCollection(); + $this->entries = new ArrayCollection(); + $this->tags = new ArrayCollection(); } /** 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 $entry->setUrl($content['url'] ?: $url); $entry->setTitle($title); $entry->setContent($html); + $entry->setLanguage($content['language']); $entry->setMimetype($content['content_type']); if (isset($content['open_graph']['og_image'])) { 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 $graby->expects($this->any()) ->method('fetchContent') - ->willReturn(array('html' => false, 'title' => '', 'url' => '', 'content_type' => '')); + ->willReturn(array( + 'html' => false, + 'title' => '', + 'url' => '', + 'content_type' => '', + 'language' => '', + )); $proxy = new ContentProxy($graby); $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); @@ -28,6 +34,7 @@ class ContentProxyTest extends KernelTestCase $this->assertEquals('

Unable to retrieve readable content.

', $entry->getContent()); $this->assertEmpty($entry->getPreviewPicture()); $this->assertEmpty($entry->getMimetype()); + $this->assertEmpty($entry->getLanguage()); } public function testWithEmptyContentButOG() @@ -39,7 +46,17 @@ class ContentProxyTest extends KernelTestCase $graby->expects($this->any()) ->method('fetchContent') - ->willReturn(array('html' => false, 'title' => '', 'url' => '', 'content_type' => '', 'open_graph' => array('og_title' => 'my title', 'og_description' => 'desc'))); + ->willReturn(array( + 'html' => false, + 'title' => '', + 'url' => '', + 'content_type' => '', + 'language' => '', + 'open_graph' => array( + 'og_title' => 'my title', + 'og_description' => 'desc', + ), + )); $proxy = new ContentProxy($graby); $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); @@ -48,6 +65,7 @@ class ContentProxyTest extends KernelTestCase $this->assertEquals('my title', $entry->getTitle()); $this->assertEquals('

Unable to retrieve readable content.

But we found a short description:

desc', $entry->getContent()); $this->assertEmpty($entry->getPreviewPicture()); + $this->assertEmpty($entry->getLanguage()); $this->assertEmpty($entry->getMimetype()); } @@ -65,6 +83,7 @@ class ContentProxyTest extends KernelTestCase 'title' => 'this is my title', 'url' => 'http://1.1.1.1', 'content_type' => 'text/html', + 'language' => 'fr', 'open_graph' => array( 'og_title' => 'my OG title', 'og_description' => 'OG desc', @@ -80,5 +99,6 @@ class ContentProxyTest extends KernelTestCase $this->assertEquals('this is my content', $entry->getContent()); $this->assertEquals('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture()); $this->assertEquals('text/html', $entry->getMimetype()); + $this->assertEquals('fr', $entry->getLanguage()); } } -- cgit v1.2.3 From 0d3bafdfdfe4fa1e4aa62f6056d8028ebd7d920d Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 23 Sep 2015 07:51:17 +0200 Subject: Remove tab from baggy css And add a border left on the filter slider --- .../views/themes/baggy/public/css/main.css | 102 ++++++++++----------- 1 file changed, 51 insertions(+), 51 deletions(-) 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 { overflow: hidden; padding: 1.5em 1.5em 3em 1.5em; - /* Removing CSS transitions because they make the switch from list view to - * table view jerky - */ + /* Removing CSS transitions because they make the switch from list view to + * table view jerky + */ /* -webkit-transition: all 0.5s ease; */ /* -moz-transition: all 0.5s ease; */ /* -ms-transition: all 0.5s ease; */ @@ -570,47 +570,47 @@ img.preview { border-left: 1px #EEE solid; } - .popup-form form { - background-color: #FFF; - position: absolute; - top: 0; - left: 0; - z-index: 20; - border: 10px solid #000; - width: 400px; - height: 200px; - padding: 2em; - } + .popup-form form { + background-color: #FFF; + position: absolute; + top: 0; + left: 0; + z-index: 20; + border: 10px solid #000; + width: 400px; + height: 200px; + padding: 2em; + } #bagit-form-form .addurl { - margin-left: 0; + margin-left: 0; } .closeMessage, .close-button { background-color: #000; color: #FFF; - font-size: 1.2em; - line-height: 1.6; - width: 1.6em; - height: 1.6em; - text-align: center; + font-size: 1.2em; + line-height: 1.6; + width: 1.6em; + height: 1.6em; + text-align: center; text-decoration: none; } - .closeMessage:hover, - .closeMessage:focus, - .close-button:hover, - .close-button:focus { - background-color: #999; - color: #000; - } + .closeMessage:hover, + .closeMessage:focus, + .close-button:hover, + .close-button:focus { + background-color: #999; + color: #000; + } .close-button--popup { - display: inline-block; - position: absolute; - top: 0; - right: 0; - font-size: 1.4em; + display: inline-block; + position: absolute; + top: 0; + right: 0; + font-size: 1.4em; } .active-current { @@ -753,24 +753,24 @@ a.add-to-wallabag-link-after:after { /* .icon-image class, for image-based icons - ========================================================================== */ + ========================================================================== */ .icon-image { - background-size: 16px 16px; - background-repeat: no-repeat; - background-position: center; - padding-right: 1em !important; - padding-left: 1em !important; + background-size: 16px 16px; + background-repeat: no-repeat; + background-position: center; + padding-right: 1em !important; + padding-left: 1em !important; } /* Carrot (http://carrot.org) */ .icon-image--carrot { - background-image: url('../../_global/img/icons/carrot-icon--white.png'); + background-image: url('../../_global/img/icons/carrot-icon--white.png'); } /* Diaspora */ .icon-image--diaspora { - background-image: url('../../_global/img/icons/diaspora-icon--black.png'); + background-image: url('../../_global/img/icons/diaspora-icon--black.png'); }} /* ========================================================================== @@ -813,14 +813,14 @@ a.add-to-wallabag-link-after:after { } .more-info { - font-size: 0.85em; + font-size: 0.85em; line-height: 1.5; - color: #aaa; + color: #aaa; } - .more-info a { - color: #aaa; - } + .more-info a { + color: #aaa; + } /* ========================================================================== 5 = Article @@ -934,9 +934,9 @@ blockquote { } pre code { - font-family: "Courier New", Courier, monospace; - border: 1px solid #ccc; - font-size: 0.96em; + font-family: "Courier New", Courier, monospace; + border: 1px solid #ccc; + font-size: 0.96em; } #filter-form { @@ -949,18 +949,18 @@ pre code { padding: 15px; padding-right: 30px; padding-top: 30px; - + border-left: 1px #333 solid; z-index: 12; /*transition-property: transform; transition-duration: 0.3s; transition-delay: 0.3s; - + transform: translate3d(100%, 0, 0);*/ } #filter-form form { - + } #filter-form form .filter-group { -- cgit v1.2.3 From d4ebe5c5dcf581416ab76136908cafbde78f63bf Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 23 Sep 2015 07:55:55 +0200 Subject: Entries filter on language + updated deps --- composer.lock | 221 +++++++++++++++------ .../CoreBundle/Controller/EntryController.php | 2 +- .../CoreBundle/DataFixtures/ORM/LoadEntryData.php | 6 + src/Wallabag/CoreBundle/Filter/EntryFilterType.php | 23 ++- .../CoreBundle/Repository/EntryRepository.php | 27 +++ .../views/themes/baggy/Entry/entries.html.twig | 8 + .../views/themes/material/Entry/entries.html.twig | 10 +- .../Tests/Controller/EntryControllerTest.php | 23 +++ 8 files changed, 255 insertions(+), 65 deletions(-) diff --git a/composer.lock b/composer.lock index d8c55fda..ef060b5e 100644 --- a/composer.lock +++ b/composer.lock @@ -285,16 +285,16 @@ }, { "name": "doctrine/dbal", - "version": "v2.5.1", + "version": "v2.5.2", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "628c2256b646ae2417d44e063bce8aec5199d48d" + "reference": "01dbcbc5cd0a913d751418e635434a18a2f2a75c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/628c2256b646ae2417d44e063bce8aec5199d48d", - "reference": "628c2256b646ae2417d44e063bce8aec5199d48d", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/01dbcbc5cd0a913d751418e635434a18a2f2a75c", + "reference": "01dbcbc5cd0a913d751418e635434a18a2f2a75c", "shasum": "" }, "require": { @@ -352,20 +352,20 @@ "persistence", "queryobject" ], - "time": "2015-01-12 21:52:47" + "time": "2015-09-16 16:29:33" }, { "name": "doctrine/doctrine-bundle", - "version": "v1.5.1", + "version": "v1.5.2", "source": { "type": "git", "url": "https://github.com/doctrine/DoctrineBundle.git", - "reference": "8c5cedb4f2f7ebb66a963ae46ad9daa1e31cee01" + "reference": "d63be7eb9a95d46720f7d6badac4e5bc2bcff2e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/8c5cedb4f2f7ebb66a963ae46ad9daa1e31cee01", - "reference": "8c5cedb4f2f7ebb66a963ae46ad9daa1e31cee01", + "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/d63be7eb9a95d46720f7d6badac4e5bc2bcff2e3", + "reference": "d63be7eb9a95d46720f7d6badac4e5bc2bcff2e3", "shasum": "" }, "require": { @@ -392,7 +392,7 @@ "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "1.5.x-dev" + "dev-master": "1.6.x-dev" } }, "autoload": { @@ -430,7 +430,7 @@ "orm", "persistence" ], - "time": "2015-08-12 15:52:00" + "time": "2015-08-31 14:47:06" }, { "name": "doctrine/doctrine-cache-bundle", @@ -948,12 +948,12 @@ "source": { "type": "git", "url": "https://github.com/FriendsOfSymfony/FOSUserBundle.git", - "reference": "6b7bb04c6d507bb5356bf70b2d1bc30ce64ffc60" + "reference": "d5b28c367d393f9d9fbc48c4138b2a74d51c0c83" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/zipball/6b7bb04c6d507bb5356bf70b2d1bc30ce64ffc60", - "reference": "6b7bb04c6d507bb5356bf70b2d1bc30ce64ffc60", + "url": "https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/zipball/d5b28c367d393f9d9fbc48c4138b2a74d51c0c83", + "reference": "d5b28c367d393f9d9fbc48c4138b2a74d51c0c83", "shasum": "" }, "require": { @@ -1007,7 +1007,7 @@ "keywords": [ "User management" ], - "time": "2015-09-07 08:53:52" + "time": "2015-09-15 13:15:07" }, { "name": "guzzlehttp/guzzle", @@ -1267,16 +1267,16 @@ }, { "name": "j0k3r/graby", - "version": "1.0.0-alpha.1", + "version": "1.0.0-alpha.2", "source": { "type": "git", "url": "https://github.com/j0k3r/graby.git", - "reference": "9d4f62aa83a7cd563fe3ca9fcc4b176d7e1d264c" + "reference": "9cc399bbe70f12b302ea65e604a80ea738042599" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/j0k3r/graby/zipball/9d4f62aa83a7cd563fe3ca9fcc4b176d7e1d264c", - "reference": "9d4f62aa83a7cd563fe3ca9fcc4b176d7e1d264c", + "url": "https://api.github.com/repos/j0k3r/graby/zipball/9cc399bbe70f12b302ea65e604a80ea738042599", + "reference": "9cc399bbe70f12b302ea65e604a80ea738042599", "shasum": "" }, "require": { @@ -1289,6 +1289,7 @@ "neitanod/forceutf8": "^1.4", "php": ">=5.4", "simplepie/simplepie": "^1.3.1", + "smalot/pdfparser": "~0.9.24", "symfony/options-resolver": "^2.6.6" }, "type": "library", @@ -1314,20 +1315,20 @@ } ], "description": "Graby helps you extract article content from web pages", - "time": "2015-09-13 10:07:45" + "time": "2015-09-17 11:43:10" }, { "name": "j0k3r/graby-site-config", - "version": "1.0.2", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/j0k3r/graby-site-config.git", - "reference": "9ad65e69bb21397dfededd420e1d4ab22006993c" + "reference": "1b0ac25687aa33785c5d9d8ede92b26f757354f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/j0k3r/graby-site-config/zipball/9ad65e69bb21397dfededd420e1d4ab22006993c", - "reference": "9ad65e69bb21397dfededd420e1d4ab22006993c", + "url": "https://api.github.com/repos/j0k3r/graby-site-config/zipball/1b0ac25687aa33785c5d9d8ede92b26f757354f5", + "reference": "1b0ac25687aa33785c5d9d8ede92b26f757354f5", "shasum": "" }, "require": { @@ -1350,20 +1351,20 @@ } ], "description": "Graby site config files", - "time": "2015-09-13 10:26:25" + "time": "2015-09-17 17:32:42" }, { "name": "j0k3r/php-readability", - "version": "v1.0.4", + "version": "v1.0.7", "source": { "type": "git", "url": "https://github.com/j0k3r/php-readability.git", - "reference": "c5a4a490e155fa20809c9bbcf3e318defbb7a261" + "reference": "1830dc45d4fccfe09d2d107ab59890f07adc35c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/j0k3r/php-readability/zipball/c5a4a490e155fa20809c9bbcf3e318defbb7a261", - "reference": "c5a4a490e155fa20809c9bbcf3e318defbb7a261", + "url": "https://api.github.com/repos/j0k3r/php-readability/zipball/1830dc45d4fccfe09d2d107ab59890f07adc35c4", + "reference": "1830dc45d4fccfe09d2d107ab59890f07adc35c4", "shasum": "" }, "require": { @@ -1413,7 +1414,7 @@ "extraction", "html" ], - "time": "2015-08-24 09:10:54" + "time": "2015-09-20 19:05:55" }, { "name": "jdorn/sql-formatter", @@ -2058,20 +2059,20 @@ }, { "name": "neitanod/forceutf8", - "version": "v1.4", + "version": "v1.5", "source": { "type": "git", "url": "https://github.com/neitanod/forceutf8.git", - "reference": "28d50d579179abac1f6a55b03c6d9d3f6573867c" + "reference": "1b577b9430cb7bd20d8dd7435f36120b85880ace" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/neitanod/forceutf8/zipball/28d50d579179abac1f6a55b03c6d9d3f6573867c", - "reference": "28d50d579179abac1f6a55b03c6d9d3f6573867c", + "url": "https://api.github.com/repos/neitanod/forceutf8/zipball/1b577b9430cb7bd20d8dd7435f36120b85880ace", + "reference": "1b577b9430cb7bd20d8dd7435f36120b85880ace", "shasum": "" }, "require": { - "php": ">=5.2.0" + "php": ">=5.3.0" }, "type": "library", "autoload": { @@ -2088,7 +2089,7 @@ ], "description": "PHP Class Encoding featuring popular Encoding::toUTF8() function --formerly known as forceUTF8()-- that fixes mixed encoded strings.", "homepage": "https://github.com/neitanod/forceutf8", - "time": "2014-09-24 14:59:43" + "time": "2015-01-02 13:36:36" }, { "name": "nelmio/api-doc-bundle", @@ -2685,6 +2686,49 @@ ], "time": "2012-10-30 17:54:03" }, + { + "name": "smalot/pdfparser", + "version": "v0.9.25", + "source": { + "type": "git", + "url": "https://github.com/smalot/pdfparser.git", + "reference": "31590f7938a22f1c7fc4fb292611e3742a62ebaa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/smalot/pdfparser/zipball/31590f7938a22f1c7fc4fb292611e3742a62ebaa", + "reference": "31590f7938a22f1c7fc4fb292611e3742a62ebaa", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "tecnickcom/tcpdf": ">=6.0.050" + }, + "require-dev": { + "atoum/atoum": "dev-master" + }, + "type": "library", + "autoload": { + "psr-0": { + "Smalot\\PdfParser\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-3.0" + ], + "authors": [ + { + "name": "Sebastien MALOT", + "email": "sebastien@malot.fr", + "homepage": "http://www.malot.fr", + "role": "Developer" + } + ], + "description": "Pdf parser library. Can read and extract information from pdf file.", + "homepage": "http://www.pdfparser.org", + "time": "2015-09-18 08:29:33" + }, { "name": "swiftmailer/swiftmailer", "version": "v5.4.1", @@ -3109,6 +3153,69 @@ ], "time": "2015-08-02 12:30:27" }, + { + "name": "tecnickcom/tcpdf", + "version": "6.2.12", + "source": { + "type": "git", + "url": "https://github.com/tecnickcom/TCPDF.git", + "reference": "2f732eaa91b5665274689b1d40b285a7bacdc37f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/2f732eaa91b5665274689b1d40b285a7bacdc37f", + "reference": "2f732eaa91b5665274689b1d40b285a7bacdc37f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "fonts", + "config", + "include", + "tcpdf.php", + "tcpdf_parser.php", + "tcpdf_import.php", + "tcpdf_barcodes_1d.php", + "tcpdf_barcodes_2d.php", + "include/tcpdf_colors.php", + "include/tcpdf_filters.php", + "include/tcpdf_font_data.php", + "include/tcpdf_fonts.php", + "include/tcpdf_images.php", + "include/tcpdf_static.php", + "include/barcodes/datamatrix.php", + "include/barcodes/pdf417.php", + "include/barcodes/qrcode.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPLv3" + ], + "authors": [ + { + "name": "Nicola Asuni", + "email": "info@tecnick.com", + "homepage": "http://nicolaasuni.tecnick.com" + } + ], + "description": "TCPDF is a PHP class for generating PDF documents and barcodes.", + "homepage": "http://www.tcpdf.org/", + "keywords": [ + "PDFD32000-2008", + "TCPDF", + "barcodes", + "datamatrix", + "pdf", + "pdf417", + "qrcode" + ], + "time": "2015-09-12 10:08:34" + }, { "name": "twig/extensions", "version": "v1.3.0", @@ -3163,16 +3270,16 @@ }, { "name": "twig/twig", - "version": "v1.21.2", + "version": "v1.22.2", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "ddce1136beb8db29b9cd7dffa8ab518b978c9db3" + "reference": "79249fc8c9ff62e41e217e0c630e2e00bcadda6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/ddce1136beb8db29b9cd7dffa8ab518b978c9db3", - "reference": "ddce1136beb8db29b9cd7dffa8ab518b978c9db3", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/79249fc8c9ff62e41e217e0c630e2e00bcadda6a", + "reference": "79249fc8c9ff62e41e217e0c630e2e00bcadda6a", "shasum": "" }, "require": { @@ -3185,7 +3292,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.21-dev" + "dev-master": "1.22-dev" } }, "autoload": { @@ -3220,7 +3327,7 @@ "keywords": [ "templating" ], - "time": "2015-09-09 05:28:51" + "time": "2015-09-22 13:59:32" }, { "name": "willdurand/hateoas", @@ -3655,16 +3762,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "2.2.2", + "version": "2.2.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c" + "reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2d7c03c0e4e080901b8f33b2897b0577be18a13c", - "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef1ca6835468857944d5c3b48fa503d5554cff2f", + "reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f", "shasum": "" }, "require": { @@ -3713,7 +3820,7 @@ "testing", "xunit" ], - "time": "2015-08-04 03:42:39" + "time": "2015-09-14 06:51:16" }, { "name": "phpunit/php-file-iterator", @@ -3846,16 +3953,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "1.4.6", + "version": "1.4.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b" + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3ab72c62e550370a6cd5dc873e1a04ab57562f5b", - "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", "shasum": "" }, "require": { @@ -3891,20 +3998,20 @@ "keywords": [ "tokenizer" ], - "time": "2015-08-16 08:51:00" + "time": "2015-09-15 10:49:45" }, { "name": "phpunit/phpunit", - "version": "4.8.6", + "version": "4.8.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "2246830f4a1a551c67933e4171bf2126dc29d357" + "reference": "73fad41adb5b7bc3a494bb930d90648df1d5e74b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2246830f4a1a551c67933e4171bf2126dc29d357", - "reference": "2246830f4a1a551c67933e4171bf2126dc29d357", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/73fad41adb5b7bc3a494bb930d90648df1d5e74b", + "reference": "73fad41adb5b7bc3a494bb930d90648df1d5e74b", "shasum": "" }, "require": { @@ -3963,7 +4070,7 @@ "testing", "xunit" ], - "time": "2015-08-24 04:09:38" + "time": "2015-09-20 12:56:44" }, { "name": "phpunit/phpunit-mock-objects", 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 throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); } - $form = $this->get('form.factory')->create(new EntryFilterType()); + $form = $this->get('form.factory')->create(new EntryFilterType($repository, $this->getUser())); if ($request->query->has($form->getName())) { // 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 $entry1->setUrl('http://0.0.0.0'); $entry1->setTitle('test title entry1'); $entry1->setContent('This is my content /o/'); + $entry1->setLanguage('en'); $manager->persist($entry1); @@ -28,6 +29,7 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface $entry2->setUrl('http://0.0.0.0'); $entry2->setTitle('test title entry2'); $entry2->setContent('This is my content /o/'); + $entry2->setLanguage('fr'); $manager->persist($entry2); @@ -37,6 +39,7 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface $entry3->setUrl('http://0.0.0.0'); $entry3->setTitle('test title entry3'); $entry3->setContent('This is my content /o/'); + $entry3->setLanguage('en'); $tag1 = new Tag($this->getReference('bob-user')); $tag1->setLabel('foo'); @@ -54,6 +57,7 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface $entry4->setUrl('http://0.0.0.0'); $entry4->setTitle('test title entry4'); $entry4->setContent('This is my content /o/'); + $entry4->setLanguage('en'); $tag1 = new Tag($this->getReference('admin-user')); $tag1->setLabel('foo'); @@ -72,6 +76,7 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface $entry5->setTitle('test title entry5'); $entry5->setContent('This is my content /o/'); $entry5->setStarred(true); + $entry5->setLanguage('fr'); $manager->persist($entry5); @@ -82,6 +87,7 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface $entry6->setTitle('test title entry6'); $entry6->setContent('This is my content /o/'); $entry6->setArchived(true); + $entry6->setLanguage('de'); $manager->persist($entry6); 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; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface; +use Doctrine\ORM\EntityRepository; +use Wallabag\CoreBundle\Entity\User; class EntryFilterType extends AbstractType { + private $user; + private $repository; + + /** + * Repository & user are used to get a list of language entries for this user + * + * @param EntityRepository $entryRepository + * @param User $user + */ + public function __construct(EntityRepository $entryRepository, User $user) + { + $this->repository = $entryRepository; + $this->user = $user; + } + public function buildForm(FormBuilderInterface $builder, array $options) { $builder @@ -53,7 +70,11 @@ class EntryFilterType extends AbstractType return $filterQuery->createCondition($expression); }, - )); + )) + ->add('language', 'filter_choice', array( + 'choices' => $this->repository->findDistinctLanguageByUser($this->user->getId()), + )) + ; } public function getName() 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 return $qb->getQuery()->getResult(); } + + /** + * Find distinct language for a given user. + * Used to build the filter language list. + * + * @param int $userId User id + * + * @return array + */ + public function findDistinctLanguageByUser($userId) + { + $results = $this->createQueryBuilder('e') + ->select('e.language') + ->where('e.user = :userId')->setParameter('userId', $userId) + ->andWhere('e.language IS NOT NULL') + ->groupBy('e.language') + ->orderBy('e.language', ' ASC') + ->getQuery() + ->getResult(); + + $languages = array(); + foreach ($results as $result) { + $languages[$result['language']] = $result['language']; + } + + return $languages; + } } 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 @@
+ +
+ +
+ {{ form_widget(form.language) }} +
+
+
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 c2157db5..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 @@ -121,14 +121,12 @@
-
- {{ form_widget(form.isArchived) }} - +
+
-
- {{ form_widget(form.isStarred) }} - +
+ {{ form_widget(form.language) }}
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 $crawler = $client->submit($form); $this->assertCount(1, $crawler->filter('div[class=entry]')); } + + public function testFilterOnLanguage() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/unread/list'); + $form = $crawler->filter('button[id=submit-filter]')->form(); + $data = array( + 'entry_filter[language]' => 'de', + ); + + $crawler = $client->submit($form, $data); + $this->assertCount(1, $crawler->filter('div[class=entry]')); + + $form = $crawler->filter('button[id=submit-filter]')->form(); + $data = array( + 'entry_filter[language]' => 'en', + ); + + $crawler = $client->submit($form, $data); + $this->assertCount(2, $crawler->filter('div[class=entry]')); + } } -- cgit v1.2.3