mirror of
https://github.com/wallabag/wallabag.git
synced 2025-07-17 17:08:37 +00:00
Merge pull request #1767 from wallabag/v2-setting-for-reading-time
Setting for reading time
This commit is contained in:
commit
f39e94ace3
15 changed files with 103 additions and 7 deletions
|
@ -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);
|
||||
|
|
|
@ -25,6 +25,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
|
|||
|
||||
$adminConfig->setTheme('material');
|
||||
$adminConfig->setItemsPerPage(30);
|
||||
$adminConfig->setReadingSpeed(1);
|
||||
$adminConfig->setLanguage('en');
|
||||
|
||||
$manager->persist($adminConfig);
|
||||
|
@ -34,6 +35,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
|
|||
$bobConfig = new Config($this->getReference('bob-user'));
|
||||
$bobConfig->setTheme('default');
|
||||
$bobConfig->setItemsPerPage(10);
|
||||
$bobConfig->setReadingSpeed(1);
|
||||
$bobConfig->setLanguage('fr');
|
||||
|
||||
$manager->persist($bobConfig);
|
||||
|
@ -43,6 +45,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
|
|||
$emptyConfig = new Config($this->getReference('empty-user'));
|
||||
$emptyConfig->setTheme('material');
|
||||
$emptyConfig->setItemsPerPage(10);
|
||||
$emptyConfig->setReadingSpeed(1);
|
||||
$emptyConfig->setLanguage('en');
|
||||
|
||||
$manager->persist($emptyConfig);
|
||||
|
|
|
@ -29,6 +29,9 @@ class Configuration implements ConfigurationInterface
|
|||
->integerNode('rss_limit')
|
||||
->defaultValue(50)
|
||||
->end()
|
||||
->integerNode('reading_speed')
|
||||
->defaultValue(1)
|
||||
->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 float $readingSpeed
|
||||
*
|
||||
* @return Config
|
||||
*/
|
||||
public function setReadingSpeed($readingSpeed)
|
||||
{
|
||||
$this->readingSpeed = $readingSpeed;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get readingSpeed.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getReadingSpeed()
|
||||
{
|
||||
return $this->readingSpeed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TaggingRule $rule
|
||||
*
|
||||
|
|
|
@ -35,6 +35,14 @@ class ConfigType extends AbstractType
|
|||
'choices_as_values' => true,
|
||||
))
|
||||
->add('items_per_page')
|
||||
->add('reading_speed', ChoiceType::class, array(
|
||||
'choices' => array(
|
||||
'I read ~100 words per minute' => '0.5',
|
||||
'I read ~200 words per minute' => '1',
|
||||
'I read ~300 words per minute' => '1.5',
|
||||
'I read ~400 words per minute' => '2',
|
||||
),
|
||||
))
|
||||
->add('language', ChoiceType::class, array(
|
||||
'choices' => array_flip($this->languages),
|
||||
'choices_as_values' => true,
|
||||
|
|
|
@ -38,6 +38,7 @@ RSS: 'RSS'
|
|||
Add a user: 'Créer un compte'
|
||||
Theme: 'Thème'
|
||||
Items per page: "Nombre d'articles par page"
|
||||
Reading speed: "Vitesse de lecture"
|
||||
Language: 'Langue'
|
||||
Save: 'Enregistrer'
|
||||
RSS token: 'Jeton RSS'
|
||||
|
@ -56,6 +57,12 @@ Repeat new password: 'Confirmez votre nouveau mot de passe'
|
|||
Username: "Nom d'utilisateur"
|
||||
Two factor authentication: "Double authentification"
|
||||
"Enabling two factor authentication means you'll receive an email with a code on every new untrusted connexion": "Activer l'authentification double-facteur veut dire que vous allez recevoir un code par email à chaque nouvelle connexion non approuvée."
|
||||
"I read ~100 words per minute": "Je lis environ 100 mots par minute"
|
||||
"I read ~200 words per minute": "Je lis environ 200 mots par minute"
|
||||
"I read ~300 words per minute": "Je lis environ 300 mots par minute"
|
||||
"I read ~400 words per minute": "Je lis environ 400 mots par minute"
|
||||
"You can use online tools to estimate your reading speed": "Vous pouvez utiliser un outil en ligne pour estimer votre vitesse de lecture"
|
||||
"like this one": "comme celui-ci"
|
||||
|
||||
# Tagging rules
|
||||
Tagging rules: "Règles de tag automatiques"
|
||||
|
|
|
@ -24,6 +24,15 @@
|
|||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="w500p inline">
|
||||
<div class="row">
|
||||
{{ form_label(form.config.reading_speed) }}
|
||||
{{ form_errors(form.config.reading_speed) }}
|
||||
{{ form_widget(form.config.reading_speed) }}
|
||||
<p>{% trans %}You can use online tools to estimate your reading speed{% endtrans %} (<a href="http://www.myreadspeed.com/calculate/">{% trans %}like this one{%endtrans%}</a>).</p>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="w500p inline">
|
||||
<div class="row">
|
||||
{{ form_label(form.config.language) }}
|
||||
|
|
|
@ -42,6 +42,15 @@
|
|||
</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) }}
|
||||
<p>{% trans %}You can use online tools to estimate your reading speed{% endtrans %} (<a href="http://www.myreadspeed.com/calculate/">{% trans %}like this one{%endtrans%}</a>).</p>
|
||||
</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 %}
|
||||
|
|
|
@ -46,6 +46,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$data = array(
|
||||
'config[theme]' => 'baggy',
|
||||
'config[items_per_page]' => '30',
|
||||
'config[reading_speed]' => '0.5',
|
||||
'config[language]' => 'en',
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue