diff --git a/app/DoctrineMigrations/Version20161128084725.php b/app/DoctrineMigrations/Version20161128084725.php new file mode 100644 index 000000000..347a4256b --- /dev/null +++ b/app/DoctrineMigrations/Version20161128084725.php @@ -0,0 +1,49 @@ +container = $container; + } + + private function getTable($tableName) + { + return $this->container->getParameter('database_table_prefix').$tableName; + } + + /** + * @param Schema $schema + */ + public function up(Schema $schema) + { + $configTable = $schema->getTable($this->getTable('config')); + $this->skipIf($configTable->hasColumn('view_mode'), 'It seems that you already played this migration.'); + + $configTable->addColumn('view_mode', 'integer'); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + $configTable = $schema->getTable($this->getTable('config')); + $configTable->dropColumn('view_mode'); + } +} diff --git a/app/Resources/static/themes/_global/img/list.png b/app/Resources/static/themes/_global/img/list.png new file mode 100755 index 000000000..bd5aff5ae Binary files /dev/null and b/app/Resources/static/themes/_global/img/list.png differ diff --git a/app/Resources/static/themes/_global/img/table.png b/app/Resources/static/themes/_global/img/table.png new file mode 100755 index 000000000..859c4cd8f Binary files /dev/null and b/app/Resources/static/themes/_global/img/table.png differ diff --git a/app/Resources/static/themes/baggy/css/main.css b/app/Resources/static/themes/baggy/css/main.css index 4f48f8cae..126c451bb 100755 --- a/app/Resources/static/themes/baggy/css/main.css +++ b/app/Resources/static/themes/baggy/css/main.css @@ -297,18 +297,14 @@ h2::after { text-decoration: none; } -#listmode a:hover { - opacity: 1; -} - #listmode.tablemode { - background-image: url("../img/baggy/table.png"); + background-image: url("../../_global/img/table.png"); background-repeat: no-repeat; background-position: bottom; } #listmode.listmode { - background-image: url("../img/baggy/list.png"); + background-image: url("../../_global/img/list.png"); background-repeat: no-repeat; background-position: bottom; } @@ -352,9 +348,9 @@ footer a { letter-spacing: -5px; } -.listmode .entry { - width: 100% !important; - margin-left: 0 !important; +.listmode.entry { + width: 100%; + height: inherit; } .card-entry-labels { @@ -588,6 +584,7 @@ div.pagination ul { text-align: left; font-style: italic; color: #999; + display: inline-flex; } div.pagination ul > * { diff --git a/app/Resources/static/themes/material/css/main.css b/app/Resources/static/themes/material/css/main.css index 82a74c23b..76423409e 100755 --- a/app/Resources/static/themes/material/css/main.css +++ b/app/Resources/static/themes/material/css/main.css @@ -194,7 +194,6 @@ main, .results { height: 1em; - line-height: 30px; } .results .nb-results, @@ -203,6 +202,14 @@ main, margin-bottom: 0; } +.results .nb-results { + display: inline-flex; +} + +.results a { + color: #444; +} + .pagination { float: right; } @@ -593,6 +600,7 @@ a.original { background-position: 50%; } + /* ========================================================================== 5 = Article ========================================================================== */ diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 52a030701..ea7cd883d 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -363,4 +363,25 @@ class ConfigController extends Controller return $this->redirect($this->generateUrl('fos_user_security_login')); } + + /** + * Switch view mode for current user. + * + * @Route("/config/view-mode", name="switch_view_mode") + * + * @param Request $request + * + * @return \Symfony\Component\HttpFoundation\RedirectResponse + */ + public function changeViewModeAction(Request $request) + { + $user = $this->getUser(); + $user->getConfig()->setViewMode(!$user->getConfig()->getViewMode()); + + $em = $this->getDoctrine()->getManager(); + $em->persist($user); + $em->flush(); + + return $this->redirect($request->headers->get('referer')); + } } diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php index e04f0a7b5..70364ab68 100644 --- a/src/Wallabag/CoreBundle/Entity/Config.php +++ b/src/Wallabag/CoreBundle/Entity/Config.php @@ -97,6 +97,13 @@ class Config */ private $actionMarkAsRead; + /** + * @var int + * + * @ORM\Column(name="view_mode", type="integer", nullable=true) + */ + private $viewMode; + /** * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config") */ @@ -339,6 +346,26 @@ class Config return $this; } + /** + * @return int + */ + public function getViewMode() + { + return $this->viewMode; + } + + /** + * @param int $viewMode + * + * @return Config + */ + public function setViewMode($viewMode) + { + $this->viewMode = $viewMode; + + return $this; + } + /** * @param TaggingRule $rule * 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 a13fe903b..3df990a32 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 @@ -13,9 +13,11 @@ {% block content %} + {% set viewMode = app.user.config.viewMode %}
{{ 'entry.list.number_on_the_page'|transchoice(entries.count) }}
{% for entry in entries %} -
+

{{ entry.title|raw }}

{% set readingTime = entry.readingTime / app.user.config.readingSpeed %} @@ -50,7 +52,7 @@
  • {{ 'entry.list.delete'|trans }}
  • {{ entry.domainName|removeWww }}
  • - {% if entry.previewPicture is null %} + {% if (entry.previewPicture is null or viewMode == 1) %}