mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-27 01:50:29 +00:00
Merge pull request #4053 from wallabag/feature/manual-input-reading-speed
Add ability to manually define the reading speed
This commit is contained in:
commit
4f46330087
22 changed files with 50 additions and 89 deletions
22
app/DoctrineMigrations/Version20190708122957.php
Normal file
22
app/DoctrineMigrations/Version20190708122957.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Application\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
|
||||
|
||||
/**
|
||||
* Change reading speed value.
|
||||
*/
|
||||
final class Version20190708122957 extends WallabagMigration
|
||||
{
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('UPDATE ' . $this->getTable('config', true) . ' SET reading_speed = reading_speed*200');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('UPDATE ' . $this->getTable('config', true) . ' SET reading_speed = reading_speed/200');
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ class ConfigFixtures extends Fixture implements DependentFixtureInterface
|
|||
|
||||
$adminConfig->setTheme('material');
|
||||
$adminConfig->setItemsPerPage(30);
|
||||
$adminConfig->setReadingSpeed(1);
|
||||
$adminConfig->setReadingSpeed(200);
|
||||
$adminConfig->setLanguage('en');
|
||||
$adminConfig->setPocketConsumerKey('xxxxx');
|
||||
$adminConfig->setActionMarkAsRead(0);
|
||||
|
@ -32,7 +32,7 @@ class ConfigFixtures extends Fixture implements DependentFixtureInterface
|
|||
$bobConfig = new Config($this->getReference('bob-user'));
|
||||
$bobConfig->setTheme('default');
|
||||
$bobConfig->setItemsPerPage(10);
|
||||
$bobConfig->setReadingSpeed(1);
|
||||
$bobConfig->setReadingSpeed(200);
|
||||
$bobConfig->setLanguage('fr');
|
||||
$bobConfig->setPocketConsumerKey(null);
|
||||
$bobConfig->setActionMarkAsRead(1);
|
||||
|
@ -45,7 +45,7 @@ class ConfigFixtures extends Fixture implements DependentFixtureInterface
|
|||
$emptyConfig = new Config($this->getReference('empty-user'));
|
||||
$emptyConfig->setTheme('material');
|
||||
$emptyConfig->setItemsPerPage(10);
|
||||
$emptyConfig->setReadingSpeed(1);
|
||||
$emptyConfig->setReadingSpeed(200);
|
||||
$emptyConfig->setLanguage('en');
|
||||
$emptyConfig->setPocketConsumerKey(null);
|
||||
$emptyConfig->setActionMarkAsRead(0);
|
||||
|
|
|
@ -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\IntegerType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
@ -37,19 +38,13 @@ class ConfigType extends AbstractType
|
|||
'choices' => array_flip($this->themes),
|
||||
'label' => 'config.form_settings.theme_label',
|
||||
])
|
||||
->add('items_per_page', null, [
|
||||
->add('items_per_page', IntegerType::class, [
|
||||
'label' => 'config.form_settings.items_per_page_label',
|
||||
'property_path' => 'itemsPerPage',
|
||||
])
|
||||
->add('reading_speed', ChoiceType::class, [
|
||||
->add('reading_speed', IntegerType::class, [
|
||||
'label' => 'config.form_settings.reading_speed.label',
|
||||
'property_path' => 'readingSpeed',
|
||||
'choices' => [
|
||||
'config.form_settings.reading_speed.100_word' => '0.5',
|
||||
'config.form_settings.reading_speed.200_word' => '1',
|
||||
'config.form_settings.reading_speed.300_word' => '1.5',
|
||||
'config.form_settings.reading_speed.400_word' => '2',
|
||||
],
|
||||
])
|
||||
->add('action_mark_as_read', ChoiceType::class, [
|
||||
'label' => 'config.form_settings.action_mark_as_read.label',
|
||||
|
|
|
@ -54,8 +54,8 @@ class EntryFilterType extends AbstractType
|
|||
$lower = $values['value']['left_number'][0];
|
||||
$upper = $values['value']['right_number'][0];
|
||||
|
||||
$min = (int) ($lower * $this->user->getConfig()->getReadingSpeed());
|
||||
$max = (int) ($upper * $this->user->getConfig()->getReadingSpeed());
|
||||
$min = (int) ($lower * $this->user->getConfig()->getReadingSpeed() / 200);
|
||||
$max = (int) ($upper * $this->user->getConfig()->getReadingSpeed() / 200);
|
||||
|
||||
if (null === $lower && null === $upper) {
|
||||
// no value? no filter
|
||||
|
|
|
@ -68,12 +68,8 @@ config:
|
|||
items_per_page_label: 'Poster pr. side'
|
||||
language_label: 'Sprog'
|
||||
reading_speed:
|
||||
# label: 'Reading speed'
|
||||
# label: 'Reading speed (words per minute)'
|
||||
# help_message: 'You can use online tools to estimate your reading speed:'
|
||||
# 100_word: 'I read ~100 words per minute'
|
||||
# 200_word: 'I read ~200 words per minute'
|
||||
# 300_word: 'I read ~300 words per minute'
|
||||
# 400_word: 'I read ~400 words per minute'
|
||||
action_mark_as_read:
|
||||
# label: 'Where do you want to be redirected to after marking an article as read?'
|
||||
# redirect_homepage: 'To the homepage'
|
||||
|
|
|
@ -68,12 +68,8 @@ config:
|
|||
items_per_page_label: 'Einträge pro Seite'
|
||||
language_label: 'Sprache'
|
||||
reading_speed:
|
||||
label: 'Lesegeschwindigkeit'
|
||||
label: 'Lesegeschwindigkeit (Wörter pro Minute)'
|
||||
help_message: 'Du kannst Online-Tools nutzen, um deine Lesegeschwindigkeit herauszufinden.'
|
||||
100_word: 'Ich lese ~100 Wörter pro Minute'
|
||||
200_word: 'Ich lese ~200 Wörter pro Minute'
|
||||
300_word: 'Ich lese ~300 Wörter pro Minute'
|
||||
400_word: 'Ich lese ~400 Wörter pro Minute'
|
||||
action_mark_as_read:
|
||||
label: 'Wohin soll nach dem Gelesenmarkieren eines Artikels weitergeleitet werden?'
|
||||
redirect_homepage: 'Zur Homepage'
|
||||
|
|
|
@ -68,12 +68,8 @@ config:
|
|||
items_per_page_label: 'Items per page'
|
||||
language_label: 'Language'
|
||||
reading_speed:
|
||||
label: 'Reading speed'
|
||||
label: 'Reading speed (words per minute)'
|
||||
help_message: 'You can use online tools to estimate your reading speed:'
|
||||
100_word: 'I read ~100 words per minute'
|
||||
200_word: 'I read ~200 words per minute'
|
||||
300_word: 'I read ~300 words per minute'
|
||||
400_word: 'I read ~400 words per minute'
|
||||
action_mark_as_read:
|
||||
label: 'What to do after removing, starring or marking as read an article?'
|
||||
redirect_homepage: 'Go to the homepage'
|
||||
|
|
|
@ -68,12 +68,8 @@ config:
|
|||
items_per_page_label: 'Número de artículos por página'
|
||||
language_label: 'Idioma'
|
||||
reading_speed:
|
||||
label: 'Velocidad de lectura'
|
||||
label: 'Velocidad de lectura (palabras por minuto)'
|
||||
help_message: 'Puede utilizar herramientas en línea para calcular su velocidad de lectura:'
|
||||
100_word: 'Leo ~100 palabras por minuto'
|
||||
200_word: 'Leo ~200 palabras por minuto'
|
||||
300_word: 'Leo ~300 palabras por minuto'
|
||||
400_word: 'Leo ~400 palabras por minuto'
|
||||
action_mark_as_read:
|
||||
label: '¿Dónde quieres ser redirigido después de marcar un artículo como leído?'
|
||||
redirect_homepage: 'A la página de inicio'
|
||||
|
|
|
@ -68,12 +68,8 @@ config:
|
|||
items_per_page_label: 'تعداد مقاله در هر صفحه'
|
||||
language_label: 'زبان'
|
||||
reading_speed:
|
||||
label: 'سرعت خواندن'
|
||||
# label: 'Reading speed (words per minute)'
|
||||
help_message: 'سرعت خواندنتان را با ابزارهای آنلاین تخمین بزنید:'
|
||||
100_word: 'من تقریباً ۱۰۰ واژه را در دقیقه میخوانم'
|
||||
200_word: 'من تقریباً ۲۰۰ واژه را در دقیقه میخوانم'
|
||||
300_word: 'من تقریباً ۳۰۰ واژه را در دقیقه میخوانم'
|
||||
400_word: 'من تقریباً ۴۰۰ واژه را در دقیقه میخوانم'
|
||||
action_mark_as_read:
|
||||
# label: 'Where do you want to be redirected to after marking an article as read?'
|
||||
# redirect_homepage: 'To the homepage'
|
||||
|
|
|
@ -68,12 +68,8 @@ config:
|
|||
items_per_page_label: "Nombre d’articles par page"
|
||||
language_label: "Langue"
|
||||
reading_speed:
|
||||
label: "Vitesse de lecture"
|
||||
label: "Vitesse de lecture (mots par minute)"
|
||||
help_message: "Vous pouvez utiliser un outil en ligne pour estimer votre vitesse de lecture :"
|
||||
100_word: "Je lis environ 100 mots par minute"
|
||||
200_word: "Je lis environ 200 mots par minute"
|
||||
300_word: "Je lis environ 300 mots par minute"
|
||||
400_word: "Je lis environ 400 mots par minute"
|
||||
action_mark_as_read:
|
||||
label: "Que faire lorsqu'un article est supprimé, marqué comme lu ou marqué comme favoris ?"
|
||||
redirect_homepage: "Retourner à la page d’accueil"
|
||||
|
|
|
@ -68,12 +68,8 @@ config:
|
|||
items_per_page_label: 'Elementi per pagina'
|
||||
language_label: 'Lingua'
|
||||
reading_speed:
|
||||
label: 'Velocità di lettura'
|
||||
label: 'Velocità di lettura (parole al minuto)'
|
||||
help_message: 'Puoi utilizzare degli strumenti online per valutare la tua velocità di lettura:'
|
||||
100_word: 'Leggo ~100 parole al minuto'
|
||||
200_word: 'Leggo ~200 parole al minuto'
|
||||
300_word: 'Leggo ~300 parole al minuto'
|
||||
400_word: 'Leggo ~400 parole al minuto'
|
||||
action_mark_as_read:
|
||||
label: "Dove vuoi essere reindirizzato dopo aver segnato l'articolo come già letto?"
|
||||
redirect_homepage: 'Alla homepage'
|
||||
|
|
|
@ -68,12 +68,8 @@ config:
|
|||
items_per_page_label: "Nombre d'articles per pagina"
|
||||
language_label: 'Lenga'
|
||||
reading_speed:
|
||||
label: 'Velocitat de lectura'
|
||||
label: 'Velocitat de lectura (mots per minuta)'
|
||||
help_message: 'Podètz utilizar una aisina en linha per estimar vòstra velocitat de lectura :'
|
||||
100_word: "Legissi a l'entorn de 100 mots per minuta"
|
||||
200_word: "Legissi a l'entorn de 200 mots per minuta"
|
||||
300_word: "Legissi a l'entorn de 300 mots per minuta"
|
||||
400_word: "Legissi a l'entorn de 400 mots per minuta"
|
||||
action_mark_as_read:
|
||||
label: 'Ont volètz èsser menat aprèp aver marcat un article coma legit ?'
|
||||
redirect_homepage: "A la pagina d’acuèlh"
|
||||
|
|
|
@ -68,12 +68,8 @@ config:
|
|||
items_per_page_label: 'Ilość elementów na stronie'
|
||||
language_label: 'Język'
|
||||
reading_speed:
|
||||
label: 'Prędkość czytania'
|
||||
label: 'Prędkość czytania (słów na minutę)'
|
||||
help_message: 'Możesz skorzystać z narzędzi online do określenia twojej prędkości czytania:'
|
||||
100_word: 'Czytam ~100 słów na minutę'
|
||||
200_word: 'Czytam ~200 słów na minutę'
|
||||
300_word: 'Czytam ~300 słów na minutę'
|
||||
400_word: 'Czytam ~400 słów na minutę'
|
||||
action_mark_as_read:
|
||||
label: 'Gdzie zostaniesz przekierowany po oznaczeniu artukuły jako przeczytanego'
|
||||
redirect_homepage: 'do strony głównej'
|
||||
|
|
|
@ -68,12 +68,8 @@ config:
|
|||
items_per_page_label: 'Itens por página'
|
||||
language_label: 'Idioma'
|
||||
reading_speed:
|
||||
label: 'Velocidade de leitura'
|
||||
label: 'Velocidade de leitura (palavras por minuto)'
|
||||
help_message: 'Você pode usar ferramentas online para estimar sua velocidade de leitura:'
|
||||
100_word: 'Posso ler ~100 palavras por minuto'
|
||||
200_word: 'Posso ler ~200 palavras por minuto'
|
||||
300_word: 'Posso ler ~300 palavras por minuto'
|
||||
400_word: 'Posso ler ~400 palavras por minuto'
|
||||
action_mark_as_read:
|
||||
# label: 'Where do you want to be redirected to after marking an article as read?'
|
||||
# redirect_homepage: 'To the homepage'
|
||||
|
|
|
@ -68,12 +68,8 @@ config:
|
|||
items_per_page_label: 'Articole pe pagină'
|
||||
language_label: 'Limbă'
|
||||
reading_speed:
|
||||
# label: 'Reading speed'
|
||||
# label: 'Reading speed (words per minute)'
|
||||
# help_message: 'You can use online tools to estimate your reading speed:'
|
||||
# 100_word: 'I read ~100 words per minute'
|
||||
# 200_word: 'I read ~200 words per minute'
|
||||
# 300_word: 'I read ~300 words per minute'
|
||||
# 400_word: 'I read ~400 words per minute'
|
||||
action_mark_as_read:
|
||||
# label: 'Where do you want to be redirected to after marking an article as read?'
|
||||
# redirect_homepage: 'To the homepage'
|
||||
|
|
|
@ -68,12 +68,8 @@ config:
|
|||
items_per_page_label: 'Записей на странице'
|
||||
language_label: 'Язык'
|
||||
reading_speed:
|
||||
label: 'Скорость чтения'
|
||||
label: 'Скорость чтения (слов в минуту)'
|
||||
help_message: 'Вы можете использовать онлайн-инструменты для оценки скорости чтения:'
|
||||
100_word: 'Я читаю ~100 слов в минуту'
|
||||
200_word: 'Я читаю ~200 слов в минуту'
|
||||
300_word: 'Я читаю ~300 слов в минуту'
|
||||
400_word: 'Я читаю ~400 слов в минуту'
|
||||
action_mark_as_read:
|
||||
label: 'Куда Вы хотите быть перенаправлены, после пометки записи, как прочитанная?'
|
||||
redirect_homepage: 'На домашнюю страницу'
|
||||
|
|
|
@ -68,12 +68,8 @@ config:
|
|||
items_per_page_label: 'ไอเทมต่อหน้า'
|
||||
language_label: 'ภาษา'
|
||||
reading_speed:
|
||||
label: 'การอ่านแบบด่วน'
|
||||
label: 'การอ่านแบบด่วน (คำต่อนาที)'
|
||||
help_message: 'คุณสามารถใช้เครื่องมือออนไลน์เพื่อประเมินการอ่านแบบด่วน:'
|
||||
100_word: 'ฉันอ่าน ~100 คำต่อนาที'
|
||||
200_word: 'ฉันอ่าน ~200 คำต่อนาท'
|
||||
300_word: 'ฉันอ่าน ~300 คำต่อนาท'
|
||||
400_word: 'ฉันอ่าน ~400 คำต่อนาท'
|
||||
action_mark_as_read:
|
||||
label: 'คุณต้องการเปลี่ยนทิศทางหลังจากระบุเครื่องหมายรายการอ่านที่ไหน?'
|
||||
redirect_homepage: 'ไปยังโฮมเพจ'
|
||||
|
|
|
@ -68,12 +68,8 @@ config:
|
|||
items_per_page_label: 'Sayfa başına makale sayısı'
|
||||
language_label: 'Dil'
|
||||
reading_speed:
|
||||
# label: 'Reading speed'
|
||||
# label: 'Reading speed (words per minute)'
|
||||
# help_message: 'You can use online tools to estimate your reading speed:'
|
||||
# 100_word: 'I read ~100 words per minute'
|
||||
# 200_word: 'I read ~200 words per minute'
|
||||
# 300_word: 'I read ~300 words per minute'
|
||||
# 400_word: 'I read ~400 words per minute'
|
||||
action_mark_as_read:
|
||||
# label: 'Where do you want to be redirected to after marking an article as read?'
|
||||
# redirect_homepage: 'To the homepage'
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<div id="entry-{{ entry.id|e }}" class="{% if listMode == 0 %}entry{% else %}listmode entry{% endif %}">
|
||||
<h2><a href="{{ path('view', { 'id': entry.id }) }}" title="{{ entry.title|e|raw }}">{{ entry.title | striptags | truncate(80, true, '…') | default('entry.default_title'|trans) | raw }}</a></h2>
|
||||
|
||||
{% set readingTime = entry.readingTime / app.user.config.readingSpeed %}
|
||||
{% set readingTime = entry.readingTime / app.user.config.readingSpeed * 200 %}
|
||||
<div class="estimatedTime">
|
||||
<span class="tool reading-time">
|
||||
{% if readingTime > 0 %}
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
{% endif %}
|
||||
|
||||
<i class="tool icon icon-time">
|
||||
{% set readingTime = entry.readingTime / app.user.config.readingSpeed %}
|
||||
{% set readingTime = entry.readingTime / app.user.config.readingSpeed * 200 %}
|
||||
{% if readingTime > 0 %}
|
||||
{{ 'entry.list.reading_time_minutes_short'|trans({'%readingTime%': readingTime|round}) }}
|
||||
{% else %}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% set readingTime = entry.readingTime / app.user.config.readingSpeed %}
|
||||
{% set readingTime = entry.readingTime / app.user.config.readingSpeed * 200 %}
|
||||
<i class="material-icons">timer</i>
|
||||
{% if readingTime > 0 %}
|
||||
<span>{{ 'entry.list.reading_time_minutes_short'|trans({'%readingTime%': readingTime|round}) }}</span>
|
||||
|
|
|
@ -51,7 +51,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$data = [
|
||||
'config[theme]' => 'baggy',
|
||||
'config[items_per_page]' => '30',
|
||||
'config[reading_speed]' => '0.5',
|
||||
'config[reading_speed]' => '100',
|
||||
'config[action_mark_as_read]' => '0',
|
||||
'config[language]' => 'en',
|
||||
];
|
||||
|
@ -92,7 +92,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$crawler = $client->request('GET', '/config');
|
||||
$form = $crawler->filter('button[id=config_save]')->form();
|
||||
$data = [
|
||||
'config[reading_speed]' => '2',
|
||||
'config[reading_speed]' => '400',
|
||||
];
|
||||
$client->submit($form, $data);
|
||||
|
||||
|
@ -106,7 +106,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$crawler = $client->request('GET', '/config');
|
||||
$form = $crawler->filter('button[id=config_save]')->form();
|
||||
$data = [
|
||||
'config[reading_speed]' => '0.5',
|
||||
'config[reading_speed]' => '100',
|
||||
];
|
||||
$client->submit($form, $data);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue