mirror of
https://github.com/wallabag/wallabag.git
synced 2025-01-08 16:05:25 +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
|
theme: material
|
||||||
language: en
|
language: en
|
||||||
rss_limit: 50
|
rss_limit: 50
|
||||||
|
reading_speed: 1
|
||||||
|
|
||||||
wallabag_import:
|
wallabag_import:
|
||||||
allow_mimetypes: ['application/octet-stream', 'application/json', 'text/plain']
|
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->setTheme($this->getContainer()->getParameter('wallabag_core.theme'));
|
||||||
$config->setItemsPerPage($this->getContainer()->getParameter('wallabag_core.items_on_page'));
|
$config->setItemsPerPage($this->getContainer()->getParameter('wallabag_core.items_on_page'));
|
||||||
$config->setRssLimit($this->getContainer()->getParameter('wallabag_core.rss_limit'));
|
$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'));
|
$config->setLanguage($this->getContainer()->getParameter('wallabag_core.language'));
|
||||||
|
|
||||||
$em->persist($config);
|
$em->persist($config);
|
||||||
|
|
|
@ -29,6 +29,9 @@ class Configuration implements ConfigurationInterface
|
||||||
->integerNode('rss_limit')
|
->integerNode('rss_limit')
|
||||||
->defaultValue(50)
|
->defaultValue(50)
|
||||||
->end()
|
->end()
|
||||||
|
->integerNode('reading_speed')
|
||||||
|
->defaultValue(200)
|
||||||
|
->end()
|
||||||
->scalarNode('version')
|
->scalarNode('version')
|
||||||
->end()
|
->end()
|
||||||
->scalarNode('paypal_url')
|
->scalarNode('paypal_url')
|
||||||
|
|
|
@ -19,6 +19,7 @@ class WallabagCoreExtension extends Extension
|
||||||
$container->setParameter('wallabag_core.theme', $config['theme']);
|
$container->setParameter('wallabag_core.theme', $config['theme']);
|
||||||
$container->setParameter('wallabag_core.language', $config['language']);
|
$container->setParameter('wallabag_core.language', $config['language']);
|
||||||
$container->setParameter('wallabag_core.rss_limit', $config['rss_limit']);
|
$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.version', $config['version']);
|
||||||
$container->setParameter('wallabag_core.paypal_url', $config['paypal_url']);
|
$container->setParameter('wallabag_core.paypal_url', $config['paypal_url']);
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,13 @@ class Config
|
||||||
*/
|
*/
|
||||||
private $rssLimit;
|
private $rssLimit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var float
|
||||||
|
*
|
||||||
|
* @ORM\Column(name="reading_speed", type="float", nullable=true)
|
||||||
|
*/
|
||||||
|
private $readingSpeed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
|
* @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
|
||||||
*/
|
*/
|
||||||
|
@ -247,6 +254,30 @@ class Config
|
||||||
return $this->rssLimit;
|
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
|
* @param TaggingRule $rule
|
||||||
*
|
*
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace Wallabag\CoreBundle\Form\Type;
|
||||||
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
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\Extension\Core\Type\SubmitType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
@ -35,6 +36,13 @@ class ConfigType extends AbstractType
|
||||||
'choices_as_values' => true,
|
'choices_as_values' => true,
|
||||||
))
|
))
|
||||||
->add('items_per_page')
|
->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(
|
->add('language', ChoiceType::class, array(
|
||||||
'choices' => array_flip($this->languages),
|
'choices' => array_flip($this->languages),
|
||||||
'choices_as_values' => true,
|
'choices_as_values' => true,
|
||||||
|
|
|
@ -42,6 +42,14 @@
|
||||||
</div>
|
</div>
|
||||||
</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="row">
|
||||||
<div class="input-field col s12">
|
<div class="input-field col s12">
|
||||||
{{ form_label(form.config.language) }}
|
{{ form_label(form.config.language) }}
|
||||||
|
|
|
@ -50,8 +50,9 @@
|
||||||
|
|
||||||
<div class="estimatedTime grey-text">
|
<div class="estimatedTime grey-text">
|
||||||
<span class="tool reading-time">
|
<span class="tool reading-time">
|
||||||
{% if entry.readingTime > 0 %}
|
{% set readingTime = entry.readingTime / app.user.config.readingSpeed %}
|
||||||
{% trans with {'%readingTime%': entry.readingTime } %}estimated reading time: %readingTime% min{% endtrans %}
|
{% if readingTime > 0 %}
|
||||||
|
{% trans with {'%readingTime%': readingTime } %}estimated reading time: %readingTime% min{% endtrans %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% trans with {'%inferior%': '<small class="inferieur"><</small>'} %}estimated reading time: %inferior% 1 min{% endtrans %}
|
{% trans with {'%inferior%': '<small class="inferieur"><</small>'} %}estimated reading time: %inferior% 1 min{% endtrans %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in a new issue