diff --git a/app/DoctrineMigrations/Version20190708122957.php b/app/DoctrineMigrations/Version20190708122957.php new file mode 100644 index 000000000..9585e997a --- /dev/null +++ b/app/DoctrineMigrations/Version20190708122957.php @@ -0,0 +1,22 @@ +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'); + } +} diff --git a/src/Wallabag/CoreBundle/DataFixtures/ConfigFixtures.php b/src/Wallabag/CoreBundle/DataFixtures/ConfigFixtures.php index c54e9f2c3..5e914965d 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ConfigFixtures.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ConfigFixtures.php @@ -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); diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php index 1714ce74a..6901fa08e 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php @@ -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', diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php index 37d0640a6..8a575b680 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php @@ -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 diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index 5c4ca29ce..065d281c7 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml @@ -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' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index a21bd0f10..ef9099785 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml @@ -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' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 2f310246b..dc12015f3 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml @@ -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' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index c194041a5..6eb5498dc 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml @@ -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' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index 9aef7ddec..659331c67 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml @@ -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' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 9848ed9ae..f19d8c4cc 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -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" diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index efbf062b1..700a37d2a 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml @@ -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' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index 86ce46449..023aa2e50 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml @@ -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" diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index 9ebe02360..876db24a2 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml @@ -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' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml index d310e016f..786288c1d 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml @@ -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' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index c11ff0b8a..0d8904fe8 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml @@ -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' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml index 9fe753695..04daf8551 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml @@ -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: 'На домашнюю страницу' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml index 672dcbf01..66642029a 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml @@ -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: 'ไปยังโฮมเพจ' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index c2ad854d2..6ee723f1c 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml @@ -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' diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig index 6c5d26016..d8b391600 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig @@ -46,7 +46,7 @@

{{ entry.title | striptags | truncate(80, true, '…') | default('entry.default_title'|trans) | raw }}

- {% set readingTime = entry.readingTime / app.user.config.readingSpeed %} + {% set readingTime = entry.readingTime / app.user.config.readingSpeed * 200 %}
{% if readingTime > 0 %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig index e87ba201a..7616cf4ce 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig @@ -62,7 +62,7 @@ {% endif %} - {% 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 %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_reading_time.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_reading_time.html.twig index 6ba187684..b7167e958 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_reading_time.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_reading_time.html.twig @@ -1,4 +1,4 @@ -{% set readingTime = entry.readingTime / app.user.config.readingSpeed %} +{% set readingTime = entry.readingTime / app.user.config.readingSpeed * 200 %} timer {% if readingTime > 0 %} {{ 'entry.list.reading_time_minutes_short'|trans({'%readingTime%': readingTime|round}) }} diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php index b9e0bed25..2c428fa0f 100644 --- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php @@ -50,7 +50,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', ]; @@ -91,7 +91,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); @@ -105,7 +105,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); }