mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-22 15:46:30 +00:00
Added setting to have a personal reading time
This commit is contained in:
parent
17b3d026fd
commit
bca5485946
9 changed files with 56 additions and 2 deletions
|
@ -44,6 +44,7 @@ wallabag_core:
|
|||
theme: material
|
||||
language: en
|
||||
rss_limit: 50
|
||||
reading_speed: 1
|
||||
|
||||
wallabag_import:
|
||||
allow_mimetypes: ['application/octet-stream', 'application/json', 'text/plain']
|
||||
|
|
BIN
data/db/wallabag_test.sqlite-journal
Normal file
BIN
data/db/wallabag_test.sqlite-journal
Normal file
Binary file not shown.
|
@ -222,6 +222,7 @@ class InstallCommand extends ContainerAwareCommand
|
|||
$config->setTheme($this->getContainer()->getParameter('wallabag_core.theme'));
|
||||
$config->setItemsPerPage($this->getContainer()->getParameter('wallabag_core.items_on_page'));
|
||||
$config->setRssLimit($this->getContainer()->getParameter('wallabag_core.rss_limit'));
|
||||
$config->setReadingSpeed($this->getContainer()->getParameter('wallabag_core.reading_speed'));
|
||||
$config->setLanguage($this->getContainer()->getParameter('wallabag_core.language'));
|
||||
|
||||
$em->persist($config);
|
||||
|
|
|
@ -29,6 +29,9 @@ class Configuration implements ConfigurationInterface
|
|||
->integerNode('rss_limit')
|
||||
->defaultValue(50)
|
||||
->end()
|
||||
->integerNode('reading_speed')
|
||||
->defaultValue(200)
|
||||
->end()
|
||||
->scalarNode('version')
|
||||
->end()
|
||||
->scalarNode('paypal_url')
|
||||
|
|
|
@ -19,6 +19,7 @@ class WallabagCoreExtension extends Extension
|
|||
$container->setParameter('wallabag_core.theme', $config['theme']);
|
||||
$container->setParameter('wallabag_core.language', $config['language']);
|
||||
$container->setParameter('wallabag_core.rss_limit', $config['rss_limit']);
|
||||
$container->setParameter('wallabag_core.reading_speed', $config['reading_speed']);
|
||||
$container->setParameter('wallabag_core.version', $config['version']);
|
||||
$container->setParameter('wallabag_core.paypal_url', $config['paypal_url']);
|
||||
|
||||
|
|
|
@ -73,6 +73,13 @@ class Config
|
|||
*/
|
||||
private $rssLimit;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="reading_speed", type="float", nullable=true)
|
||||
*/
|
||||
private $readingSpeed;
|
||||
|
||||
/**
|
||||
* @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
|
||||
*/
|
||||
|
@ -247,6 +254,30 @@ class Config
|
|||
return $this->rssLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set readingSpeed.
|
||||
*
|
||||
* @param int $readingSpeed
|
||||
*
|
||||
* @return Config
|
||||
*/
|
||||
public function setReadingSpeed($readingSpeed)
|
||||
{
|
||||
$this->readingSpeed = $readingSpeed;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get readingSpeed.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getReadingSpeed()
|
||||
{
|
||||
return $this->readingSpeed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TaggingRule $rule
|
||||
*
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Wallabag\CoreBundle\Form\Type;
|
|||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\RangeType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
@ -35,6 +36,13 @@ class ConfigType extends AbstractType
|
|||
'choices_as_values' => true,
|
||||
))
|
||||
->add('items_per_page')
|
||||
->add('reading_speed', RangeType::class, array(
|
||||
'attr' => array(
|
||||
'min' => 0.5,
|
||||
'max' => 2,
|
||||
'step' => 0.5,
|
||||
),
|
||||
))
|
||||
->add('language', ChoiceType::class, array(
|
||||
'choices' => array_flip($this->languages),
|
||||
'choices_as_values' => true,
|
||||
|
|
|
@ -42,6 +42,14 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="input-field col s12">
|
||||
{{ form_label(form.config.reading_speed) }}
|
||||
{{ form_errors(form.config.reading_speed) }}
|
||||
{{ form_widget(form.config.reading_speed) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="input-field col s12">
|
||||
{{ form_label(form.config.language) }}
|
||||
|
|
|
@ -50,8 +50,9 @@
|
|||
|
||||
<div class="estimatedTime grey-text">
|
||||
<span class="tool reading-time">
|
||||
{% if entry.readingTime > 0 %}
|
||||
{% trans with {'%readingTime%': entry.readingTime } %}estimated reading time: %readingTime% min{% endtrans %}
|
||||
{% set readingTime = entry.readingTime / app.user.config.readingSpeed %}
|
||||
{% if readingTime > 0 %}
|
||||
{% trans with {'%readingTime%': readingTime } %}estimated reading time: %readingTime% min{% endtrans %}
|
||||
{% else %}
|
||||
{% trans with {'%inferior%': '<small class="inferieur"><</small>'} %}estimated reading time: %inferior% 1 min{% endtrans %}
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in a new issue