mirror of
https://github.com/wallabag/wallabag.git
synced 2025-09-15 18:57:05 +00:00
Added new setting to show / hide articles thumbnails
This commit is contained in:
parent
2aa18b7b90
commit
a94d7503c2
14 changed files with 100 additions and 2 deletions
|
@ -23,6 +23,7 @@ class ConfigFixtures extends Fixture implements DependentFixtureInterface
|
|||
$adminConfig->setPocketConsumerKey('xxxxx');
|
||||
$adminConfig->setActionMarkAsRead(0);
|
||||
$adminConfig->setListMode(0);
|
||||
$adminConfig->setDisplayThumbnails(0);
|
||||
|
||||
$manager->persist($adminConfig);
|
||||
|
||||
|
@ -35,6 +36,7 @@ class ConfigFixtures extends Fixture implements DependentFixtureInterface
|
|||
$bobConfig->setPocketConsumerKey(null);
|
||||
$bobConfig->setActionMarkAsRead(1);
|
||||
$bobConfig->setListMode(1);
|
||||
$bobConfig->setDisplayThumbnails(1);
|
||||
|
||||
$manager->persist($bobConfig);
|
||||
|
||||
|
@ -47,6 +49,7 @@ class ConfigFixtures extends Fixture implements DependentFixtureInterface
|
|||
$emptyConfig->setPocketConsumerKey(null);
|
||||
$emptyConfig->setActionMarkAsRead(0);
|
||||
$emptyConfig->setListMode(0);
|
||||
$emptyConfig->setDisplayThumbnails(0);
|
||||
|
||||
$manager->persist($emptyConfig);
|
||||
|
||||
|
|
|
@ -46,6 +46,9 @@ class Configuration implements ConfigurationInterface
|
|||
->scalarNode('list_mode')
|
||||
->defaultValue(1)
|
||||
->end()
|
||||
->scalarNode('display_thumbnails')
|
||||
->defaultValue(1)
|
||||
->end()
|
||||
->scalarNode('api_limit_mass_actions')
|
||||
->defaultValue(10)
|
||||
->end()
|
||||
|
|
|
@ -22,6 +22,7 @@ class WallabagCoreExtension extends Extension
|
|||
$container->setParameter('wallabag_core.cache_lifetime', $config['cache_lifetime']);
|
||||
$container->setParameter('wallabag_core.action_mark_as_read', $config['action_mark_as_read']);
|
||||
$container->setParameter('wallabag_core.list_mode', $config['list_mode']);
|
||||
$container->setParameter('wallabag_core.display_thumbnails', $config['display_thumbnails']);
|
||||
$container->setParameter('wallabag_core.fetching_error_message', $config['fetching_error_message']);
|
||||
$container->setParameter('wallabag_core.fetching_error_message_title', $config['fetching_error_message_title']);
|
||||
$container->setParameter('wallabag_core.api_limit_mass_actions', $config['api_limit_mass_actions']);
|
||||
|
|
|
@ -117,6 +117,15 @@ class Config
|
|||
*/
|
||||
private $listMode;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(name="display_thumbnails", type="integer", nullable=true)
|
||||
*
|
||||
* @Groups({"config_api"})
|
||||
*/
|
||||
private $displayThumbnails;
|
||||
|
||||
/**
|
||||
* @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
|
||||
*/
|
||||
|
@ -362,6 +371,26 @@ class Config
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getDisplayThumbnails(): ?bool
|
||||
{
|
||||
return $this->displayThumbnails;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $displayThumbnails
|
||||
*
|
||||
* @return Config
|
||||
*/
|
||||
public function setDisplayThumbnails(bool $displayThumbnails)
|
||||
{
|
||||
$this->displayThumbnails = $displayThumbnails;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Config
|
||||
*/
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Wallabag\CoreBundle\Form\Type;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
|
@ -29,6 +30,11 @@ class ConfigType extends AbstractType
|
|||
'label' => 'config.form_settings.items_per_page_label',
|
||||
'property_path' => 'itemsPerPage',
|
||||
])
|
||||
->add('display_thumbnails', CheckboxType::class, [
|
||||
'label' => 'config.form_settings.display_thumbnails_label',
|
||||
'property_path' => 'displayThumbnails',
|
||||
'required' => false,
|
||||
])
|
||||
->add('reading_speed', IntegerType::class, [
|
||||
'label' => 'config.form_settings.reading_speed.label',
|
||||
'property_path' => 'readingSpeed',
|
||||
|
|
|
@ -38,6 +38,19 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="input-field col s11">
|
||||
{{ form_errors(form.config.display_thumbnails) }}
|
||||
{{ form_widget(form.config.display_thumbnails) }}
|
||||
{{ form_label(form.config.display_thumbnails) }}
|
||||
</div>
|
||||
<div class="input-field col s1">
|
||||
<a href="#" class="tooltipped" data-position="left" data-delay="50" data-tooltip="{{ 'config.form_settings.help_display_thumbnails'|trans }}">
|
||||
<i class="material-icons">live_help</i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="input-field col s11">
|
||||
{{ form_errors(form.config.reading_speed) }}
|
||||
|
|
|
@ -6,9 +6,11 @@
|
|||
<li title="{{ tag.label }}"><a href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{ tag.label }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% if app.user.config.displayThumbnails %}
|
||||
<a href="{{ path('view', {'id': entry.id}) }}">
|
||||
<span class="preview" style="background-image: url({{ entry.previewPicture }})"></span>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% include "@WallabagCore/Entry/Card/_content.html.twig" with {'entry': entry} only %}
|
||||
</div>
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
<div class="card-stacked{% if currentRoute in routes and entry.isArchived %} archived{% endif %}">
|
||||
{% include "@WallabagCore/Entry/Card/_mass_checkbox.html.twig" with {'entry': entry} only %}
|
||||
{% if app.user.config.displayThumbnails %}
|
||||
<div class="card-preview">
|
||||
<a href="{{ path('view', {'id': entry.id}) }}">
|
||||
{% set preview_class_modifier = entry.previewPicture ? '' : ' preview--default' %}
|
||||
<span class="preview{{ preview_class_modifier }}" style="background-image: url({{ entry.previewPicture|default(asset('img/logo-square.svg')) }})"></span>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% include "@WallabagCore/Entry/Card/_content.html.twig" with {'entry': entry, 'withMetadata': true, 'subClass': 'metadata'} only %}
|
||||
<ul class="tools-list hide-on-small-only">
|
||||
<li>
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
<div class="card entry-card{% if currentRoute in routes and entry.isArchived %} archived{% endif %}">
|
||||
<div class="card-body">
|
||||
<div class="card-image waves-effect waves-block waves-light">
|
||||
<div class="{% if app.user.config.displayThumbnails %}card-image{% endif %} waves-effect waves-block waves-light">
|
||||
{% include "@WallabagCore/Entry/Card/_mass_checkbox.html.twig" with {'entry': entry} only %}
|
||||
<ul class="card-entry-labels">
|
||||
{% for tag in entry.tags|slice(0, 3) %}
|
||||
<li title="{{ tag.label }}"><a href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{ tag.label }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% if app.user.config.displayThumbnails %}
|
||||
<a href="{{ path('view', {'id': entry.id}) }}">
|
||||
{% set preview_class_modifier = entry.previewPicture ? '' : ' preview--default' %}
|
||||
<span class="preview{{ preview_class_modifier }}" style="background-image: url({{ entry.previewPicture|default(asset('img/logo-square.svg')) }})"></span>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% include "@WallabagCore/Entry/Card/_content.html.twig" with {'entry': entry, 'withPreview': true} only %}
|
||||
</div>
|
||||
|
|
|
@ -23,8 +23,9 @@ class CreateConfigListener implements EventSubscriberInterface
|
|||
private $actionMarkAsRead;
|
||||
private $listMode;
|
||||
private $session;
|
||||
private $displayThumbnails;
|
||||
|
||||
public function __construct(EntityManagerInterface $em, $itemsOnPage, $feedLimit, $language, $readingSpeed, $actionMarkAsRead, $listMode, SessionInterface $session)
|
||||
public function __construct(EntityManagerInterface $em, $itemsOnPage, $feedLimit, $language, $readingSpeed, $actionMarkAsRead, $listMode, SessionInterface $session, $displayThumbnails)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->itemsOnPage = $itemsOnPage;
|
||||
|
@ -34,6 +35,7 @@ class CreateConfigListener implements EventSubscriberInterface
|
|||
$this->actionMarkAsRead = $actionMarkAsRead;
|
||||
$this->listMode = $listMode;
|
||||
$this->session = $session;
|
||||
$this->displayThumbnails = $displayThumbnails;
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
|
@ -56,6 +58,7 @@ class CreateConfigListener implements EventSubscriberInterface
|
|||
$config->setReadingSpeed($this->readingSpeed);
|
||||
$config->setActionMarkAsRead($this->actionMarkAsRead);
|
||||
$config->setListMode($this->listMode);
|
||||
$config->setDisplayThumbnails($this->displayThumbnails);
|
||||
|
||||
$this->em->persist($config);
|
||||
$this->em->flush();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue