1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-07-22 17:18:37 +00:00

Added a configuration to define the redirection after archiving an entry

Fix #496
This commit is contained in:
Nicolas Lœuillet 2016-11-06 12:02:39 +01:00 committed by Jeremy Benoist
parent e042a5d78f
commit a42f38d9fb
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
26 changed files with 184 additions and 3 deletions

View file

@ -21,6 +21,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
$adminConfig->setReadingSpeed(1);
$adminConfig->setLanguage('en');
$adminConfig->setPocketConsumerKey('xxxxx');
$adminConfig->setActionMarkAsRead(0);
$manager->persist($adminConfig);
@ -32,6 +33,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
$bobConfig->setReadingSpeed(1);
$bobConfig->setLanguage('fr');
$bobConfig->setPocketConsumerKey(null);
$bobConfig->setActionMarkAsRead(1);
$manager->persist($bobConfig);
@ -43,6 +45,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
$emptyConfig->setReadingSpeed(1);
$emptyConfig->setLanguage('en');
$emptyConfig->setPocketConsumerKey(null);
$emptyConfig->setActionMarkAsRead(0);
$manager->persist($emptyConfig);

View file

@ -87,6 +87,13 @@ class Config
*/
private $pocketConsumerKey;
/**
* @var int
*
* @ORM\Column(name="action_mark_as_read", type="integer", nullable=true)
*/
private $actionMarkAsRead;
/**
* @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
*/
@ -309,6 +316,26 @@ class Config
return $this->pocketConsumerKey;
}
/**
* @return int
*/
public function getActionMarkAsRead()
{
return $this->actionMarkAsRead;
}
/**
* @param int $actionMarkAsRead
*
* @return Config
*/
public function setActionMarkAsRead($actionMarkAsRead)
{
$this->actionMarkAsRead = $actionMarkAsRead;
return $this;
}
/**
* @param TaggingRule $rule
*

View file

@ -48,6 +48,13 @@ class ConfigType extends AbstractType
'config.form_settings.reading_speed.400_word' => '2',
],
])
->add('action_mark_as_read', ChoiceType::class, [
'label' => 'config.form_settings.action_mark_as_read.label',
'choices' => [
'config.form_settings.action_mark_as_read.redirect_homepage' => '0',
'config.form_settings.action_mark_as_read.redirect_current_page' => '1',
],
])
->add('language', ChoiceType::class, [
'choices' => array_flip($this->languages),
'label' => 'config.form_settings.language_label',

View file

@ -3,6 +3,7 @@
namespace Wallabag\CoreBundle\Helper;
use Symfony\Component\Routing\Router;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
/**
* Manage redirections to avoid redirecting to empty routes.
@ -10,10 +11,12 @@ use Symfony\Component\Routing\Router;
class Redirect
{
private $router;
private $actionMarkAsRead;
public function __construct(Router $router)
public function __construct(Router $router, TokenStorage $token)
{
$this->router = $router;
$this->actionMarkAsRead = $token->getToken()->getUser()->getConfig()->getActionMarkAsRead();
}
/**
@ -24,6 +27,10 @@ class Redirect
*/
public function to($url, $fallback = '')
{
if ($this->actionMarkAsRead == 0) {
return $this->router->generate('homepage');
}
if (null !== $url) {
return $url;
}

View file

@ -109,6 +109,7 @@ services:
class: Wallabag\CoreBundle\Helper\Redirect
arguments:
- "@router"
- "@security.token_storage"
wallabag_core.helper.prepare_pager_for_entries:
class: Wallabag\CoreBundle\Helper\PreparePagerForEntries

View file

@ -70,6 +70,10 @@ config:
# 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 to be redirected after mark an article as read?'
# redirect_homepage: 'To the homepage'
# redirect_current_page: 'To the current page'
pocket_consumer_key_label: Brugers nøgle til Pocket for at importere materialer
# android_configuration: Configure your Android application
form_rss:

View file

@ -70,6 +70,10 @@ config:
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: 'Where do you to be redirected after mark an article as read?'
# redirect_homepage: 'To the homepage'
# redirect_current_page: 'To the current page'
pocket_consumer_key_label: Consumer-Key für Pocket, um Inhalte zu importieren
# android_configuration: Configure your Android application
form_rss:

View file

@ -70,6 +70,10 @@ config:
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 after mark an article as read?'
redirect_homepage: 'To the homepage'
redirect_current_page: 'To the current page'
pocket_consumer_key_label: Consumer key for Pocket to import contents
android_configuration: Configure your Android application
form_rss:

View file

@ -70,6 +70,10 @@ config:
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: 'Where do you to be redirected after mark an article as read?'
# redirect_homepage: 'To the homepage'
# redirect_current_page: 'To the current page'
# pocket_consumer_key_label: Consumer key for Pocket to import contents
# android_configuration: Configure your Android application
form_rss:

View file

@ -70,6 +70,10 @@ config:
200_word: 'من تقریباً ۲۰۰ واژه را در دقیقه می‌خوانم'
300_word: 'من تقریباً ۳۰۰ واژه را در دقیقه می‌خوانم'
400_word: 'من تقریباً ۴۰۰ واژه را در دقیقه می‌خوانم'
action_mark_as_read:
# label: 'Where do you to be redirected after mark an article as read?'
# redirect_homepage: 'To the homepage'
# redirect_current_page: 'To the current page'
pocket_consumer_key_label: کلید کاربری Pocket برای درون‌ریزی مطالب
# android_configuration: Configure your Android application
form_rss:

View file

@ -70,6 +70,10 @@ config:
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: 'Où souhaitez-vous être redirigé après avoir marqué un article comme lu ?'
redirect_homepage: "À la page d'accueil"
redirect_current_page: 'À la page courante'
pocket_consumer_key_label: Clé dauthentification Pocket pour importer les données
android_configuration: Configurez votre application Android
form_rss:

View file

@ -70,6 +70,10 @@ config:
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: 'Where do you to be redirected after mark an article as read?'
# redirect_homepage: 'To the homepage'
# redirect_current_page: 'To the current page'
pocket_consumer_key_label: Consumer key per Pocket per importare i contenuti
# android_configuration: Configure your Android application
form_rss:

View file

@ -70,6 +70,10 @@ config:
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: 'Where do you to be redirected after mark an article as read?'
# redirect_homepage: 'To the homepage'
# redirect_current_page: 'To the current page'
pocket_consumer_key_label: Clau d'autentificacion Pocket per importar las donadas
android_configuration: Configuratz vòstra aplicacion Android
form_rss:

View file

@ -70,6 +70,10 @@ config:
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: 'Where do you to be redirected after mark an article as read?'
# redirect_homepage: 'To the homepage'
# redirect_current_page: 'To the current page'
pocket_consumer_key_label: 'Klucz klienta Pocket do importu zawartości'
android_configuration: Skonfiguruj swoją androidową aplikację
form_rss:

View file

@ -70,6 +70,10 @@ config:
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 to be redirected after mark an article as read?'
# redirect_homepage: 'To the homepage'
# redirect_current_page: 'To the current page'
pocket_consumer_key_label: 'Chave do consumidor do Pocket para importar conteúdo'
# android_configuration: Configure your Android application
form_rss:

View file

@ -70,6 +70,10 @@ config:
# 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 to be redirected after mark an article as read?'
# redirect_homepage: 'To the homepage'
# redirect_current_page: 'To the current page'
pocket_consumer_key_label: Cheie consumator pentru importarea contentului din Pocket
# android_configuration: Configure your Android application
form_rss:

View file

@ -70,6 +70,10 @@ config:
# 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 to be redirected after mark an article as read?'
# redirect_homepage: 'To the homepage'
# redirect_current_page: 'To the current page'
# pocket_consumer_key_label: Consumer key for Pocket to import contents
# android_configuration: Configure your Android application
form_rss:

View file

@ -36,6 +36,14 @@
</div>
</fieldset>
<fieldset class="w500p inline">
<div class="row">
{{ form_label(form.config.action_mark_as_read) }}
{{ form_errors(form.config.action_mark_as_read) }}
{{ form_widget(form.config.action_mark_as_read) }}
</div>
</fieldset>
<fieldset class="w500p inline">
<div class="row">
{{ form_label(form.config.language) }}

View file

@ -51,6 +51,14 @@
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ form_label(form.config.action_mark_as_read) }}
{{ form_errors(form.config.action_mark_as_read) }}
{{ form_widget(form.config.action_mark_as_read) }}
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ form_label(form.config.language) }}