aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorKevin Decherf <kevin@kdecherf.com>2019-08-27 00:03:30 +0200
committerKevin Decherf <kevin@kdecherf.com>2020-04-25 15:59:23 +0200
commit7408a6cb687959eac6bc7a2ed370695bbf88b6d6 (patch)
treed9a6c4c552f085d75df2e6d37cd5cf7979149061
parentb22eb276232b5c15a6fbadc9dd10144e709faec3 (diff)
downloadwallabag-7408a6cb687959eac6bc7a2ed370695bbf88b6d6.tar.gz
wallabag-7408a6cb687959eac6bc7a2ed370695bbf88b6d6.tar.zst
wallabag-7408a6cb687959eac6bc7a2ed370695bbf88b6d6.zip
Add controller, views and translations for ignore origin instance rules
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
-rw-r--r--app/config/security.yml1
-rw-r--r--src/Wallabag/CoreBundle/Controller/IgnoreOriginInstanceRuleController.php138
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/IgnoreOriginInstanceRuleType.php37
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.da.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.de.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.en.yml24
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.es.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml4
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.it.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.th.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/IgnoreOriginInstanceRule/edit.html.twig44
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/IgnoreOriginInstanceRule/index.html.twig42
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/IgnoreOriginInstanceRule/new.html.twig37
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig1
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/IgnoreOriginInstanceRule/edit.html.twig44
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/IgnoreOriginInstanceRule/index.html.twig42
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/IgnoreOriginInstanceRule/new.html.twig37
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig6
-rw-r--r--tests/Wallabag/CoreBundle/Controller/IgnoreOriginInstanceRuleControllerTest.php148
26 files changed, 673 insertions, 4 deletions
diff --git a/app/config/security.yml b/app/config/security.yml
index 760b2550..5a73440b 100644
--- a/app/config/security.yml
+++ b/app/config/security.yml
@@ -79,4 +79,5 @@ security:
79 - { path: ^/annotations, roles: ROLE_USER } 79 - { path: ^/annotations, roles: ROLE_USER }
80 - { path: ^/2fa, role: IS_AUTHENTICATED_2FA_IN_PROGRESS } 80 - { path: ^/2fa, role: IS_AUTHENTICATED_2FA_IN_PROGRESS }
81 - { path: ^/users, roles: ROLE_SUPER_ADMIN } 81 - { path: ^/users, roles: ROLE_SUPER_ADMIN }
82 - { path: ^/ignore-origin-instance-rules, roles: ROLE_SUPER_ADMIN }
82 - { path: ^/, roles: ROLE_USER } 83 - { path: ^/, roles: ROLE_USER }
diff --git a/src/Wallabag/CoreBundle/Controller/IgnoreOriginInstanceRuleController.php b/src/Wallabag/CoreBundle/Controller/IgnoreOriginInstanceRuleController.php
new file mode 100644
index 00000000..ef1f0ed7
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Controller/IgnoreOriginInstanceRuleController.php
@@ -0,0 +1,138 @@
1<?php
2
3namespace Wallabag\CoreBundle\Controller;
4
5use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6use Symfony\Component\HttpFoundation\Request;
7use Symfony\Component\Routing\Annotation\Route;
8use Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule;
9
10/**
11 * IgnoreOriginInstanceRuleController controller.
12 *
13 * @Route("/ignore-origin-instance-rules")
14 */
15class IgnoreOriginInstanceRuleController extends Controller
16{
17 /**
18 * Lists all IgnoreOriginInstanceRule entities.
19 *
20 * @Route("/", name="ignore_origin_instance_rules_index", methods={"GET"})
21 */
22 public function indexAction()
23 {
24 $rules = $this->get('wallabag_core.ignore_origin_instance_rule_repository')->findAll();
25
26 return $this->render('WallabagCoreBundle:IgnoreOriginInstanceRule:index.html.twig', [
27 'rules' => $rules,
28 ]);
29 }
30
31 /**
32 * Creates a new ignore origin instance rule entity.
33 *
34 * @Route("/new", name="ignore_origin_instance_rules_new", methods={"GET", "POST"})
35 *
36 * @return \Symfony\Component\HttpFoundation\Response
37 */
38 public function newAction(Request $request)
39 {
40 $ignoreOriginInstanceRule = new IgnoreOriginInstanceRule();
41
42 $form = $this->createForm('Wallabag\CoreBundle\Form\Type\IgnoreOriginInstanceRuleType', $ignoreOriginInstanceRule);
43 $form->handleRequest($request);
44
45 if ($form->isSubmitted() && $form->isValid()) {
46 $em = $this->getDoctrine()->getManager();
47 $em->persist($ignoreOriginInstanceRule);
48 $em->flush();
49
50 $this->get('session')->getFlashBag()->add(
51 'notice',
52 $this->get('translator')->trans('flashes.ignore_origin_instance_rule.notice.added')
53 );
54
55 return $this->redirectToRoute('ignore_origin_instance_rules_index');
56 }
57
58 return $this->render('WallabagCoreBundle:IgnoreOriginInstanceRule:new.html.twig', [
59 'rule' => $ignoreOriginInstanceRule,
60 'form' => $form->createView(),
61 ]);
62 }
63
64 /**
65 * Displays a form to edit an existing ignore origin instance rule entity.
66 *
67 * @Route("/{id}/edit", name="ignore_origin_instance_rules_edit", methods={"GET", "POST"})
68 *
69 * @return \Symfony\Component\HttpFoundation\Response
70 */
71 public function editAction(Request $request, IgnoreOriginInstanceRule $ignoreOriginInstanceRule)
72 {
73 $deleteForm = $this->createDeleteForm($ignoreOriginInstanceRule);
74 $editForm = $this->createForm('Wallabag\CoreBundle\Form\Type\IgnoreOriginInstanceRuleType', $ignoreOriginInstanceRule);
75 $editForm->handleRequest($request);
76
77 if ($editForm->isSubmitted() && $editForm->isValid()) {
78 $em = $this->getDoctrine()->getManager();
79 $em->persist($ignoreOriginInstanceRule);
80 $em->flush();
81
82 $this->get('session')->getFlashBag()->add(
83 'notice',
84 $this->get('translator')->trans('flashes.ignore_origin_instance_rule.notice.updated')
85 );
86
87 return $this->redirectToRoute('ignore_origin_instance_rules_index');
88 }
89
90 return $this->render('WallabagCoreBundle:IgnoreOriginInstanceRule:edit.html.twig', [
91 'rule' => $ignoreOriginInstanceRule,
92 'edit_form' => $editForm->createView(),
93 'delete_form' => $deleteForm->createView(),
94 ]);
95 }
96
97 /**
98 * Deletes a site credential entity.
99 *
100 * @Route("/{id}", name="ignore_origin_instance_rules_delete", methods={"DELETE"})
101 *
102 * @return \Symfony\Component\HttpFoundation\RedirectResponse
103 */
104 public function deleteAction(Request $request, IgnoreOriginInstanceRule $ignoreOriginInstanceRule)
105 {
106 $form = $this->createDeleteForm($ignoreOriginInstanceRule);
107 $form->handleRequest($request);
108
109 if ($form->isSubmitted() && $form->isValid()) {
110 $this->get('session')->getFlashBag()->add(
111 'notice',
112 $this->get('translator')->trans('flashes.ignore_origin_instance_rule.notice.deleted')
113 );
114
115 $em = $this->getDoctrine()->getManager();
116 $em->remove($ignoreOriginInstanceRule);
117 $em->flush();
118 }
119
120 return $this->redirectToRoute('ignore_origin_instance_rules_index');
121 }
122
123 /**
124 * Creates a form to delete a ignore origin instance rule entity.
125 *
126 * @param IgnoreOriginInstanceRule $ignoreOriginInstanceRule The ignore origin instance rule entity
127 *
128 * @return \Symfony\Component\Form\Form The form
129 */
130 private function createDeleteForm(IgnoreOriginInstanceRule $ignoreOriginInstanceRule)
131 {
132 return $this->createFormBuilder()
133 ->setAction($this->generateUrl('ignore_origin_instance_rules_delete', ['id' => $ignoreOriginInstanceRule->getId()]))
134 ->setMethod('DELETE')
135 ->getForm()
136 ;
137 }
138}
diff --git a/src/Wallabag/CoreBundle/Form/Type/IgnoreOriginInstanceRuleType.php b/src/Wallabag/CoreBundle/Form/Type/IgnoreOriginInstanceRuleType.php
new file mode 100644
index 00000000..d2e414fb
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Form/Type/IgnoreOriginInstanceRuleType.php
@@ -0,0 +1,37 @@
1<?php
2
3namespace Wallabag\CoreBundle\Form\Type;
4
5use Symfony\Component\Form\AbstractType;
6use Symfony\Component\Form\Extension\Core\Type\SubmitType;
7use Symfony\Component\Form\Extension\Core\Type\TextType;
8use Symfony\Component\Form\FormBuilderInterface;
9use Symfony\Component\OptionsResolver\OptionsResolver;
10
11class IgnoreOriginInstanceRuleType extends AbstractType
12{
13 public function buildForm(FormBuilderInterface $builder, array $options)
14 {
15 $builder
16 ->add('rule', TextType::class, [
17 'required' => true,
18 'label' => 'config.form_rules.rule_label',
19 ])
20 ->add('save', SubmitType::class, [
21 'label' => 'config.form.save',
22 ])
23 ;
24 }
25
26 public function configureOptions(OptionsResolver $resolver)
27 {
28 $resolver->setDefaults([
29 'data_class' => 'Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule',
30 ]);
31 }
32
33 public function getBlockPrefix()
34 {
35 return 'ignore_origin_instance_rule';
36 }
37}
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
index 92440c92..05ee0b10 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'Tilbage til de ulæste artikler' 33 back_to_unread: 'Tilbage til de ulæste artikler'
34 # users_management: 'Users management' 34 # users_management: 'Users management'
35 # site_credentials: 'Site credentials' 35 # site_credentials: 'Site credentials'
36 # ignore_origin_instance_rules: 'Global ignore origin rules'
36 # quickstart: "Quickstart" 37 # quickstart: "Quickstart"
37 top: 38 top:
38 add_new_entry: 'Tilføj ny artikel' 39 add_new_entry: 'Tilføj ny artikel'
@@ -661,3 +662,8 @@ flashes:
661 # added: 'Site credential for "%host%" added' 662 # added: 'Site credential for "%host%" added'
662 # updated: 'Site credential for "%host%" updated' 663 # updated: 'Site credential for "%host%" updated'
663 # deleted: 'Site credential for "%host%" deleted' 664 # deleted: 'Site credential for "%host%" deleted'
665 ignore_origin_instance_rule:
666 notice:
667 # added: 'Global ignore origin rule added'
668 # updated: 'Global ignore origin rule updated'
669 # deleted: 'Global ignore origin rule deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
index 7a9382cb..908be26e 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'Zurück zu ungelesenen Artikeln' 33 back_to_unread: 'Zurück zu ungelesenen Artikeln'
34 users_management: 'Benutzerverwaltung' 34 users_management: 'Benutzerverwaltung'
35 site_credentials: 'Zugangsdaten' 35 site_credentials: 'Zugangsdaten'
36 # ignore_origin_instance_rules: 'Global ignore origin rules'
36 quickstart: "Schnelleinstieg" 37 quickstart: "Schnelleinstieg"
37 top: 38 top:
38 add_new_entry: 'Neuen Artikel hinzufügen' 39 add_new_entry: 'Neuen Artikel hinzufügen'
@@ -661,3 +662,8 @@ flashes:
661 added: 'Zugangsdaten für "%host%" hinzugefügt' 662 added: 'Zugangsdaten für "%host%" hinzugefügt'
662 updated: 'Zugangsdaten für "%host%" aktualisiert' 663 updated: 'Zugangsdaten für "%host%" aktualisiert'
663 deleted: 'Zugangsdaten für "%host%" gelöscht' 664 deleted: 'Zugangsdaten für "%host%" gelöscht'
665 ignore_origin_instance_rule:
666 notice:
667 # added: 'Global ignore origin rule added'
668 # updated: 'Global ignore origin rule updated'
669 # deleted: 'Global ignore origin rule deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
index b16662c3..d831a2aa 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'Back to unread articles' 33 back_to_unread: 'Back to unread articles'
34 users_management: 'Users management' 34 users_management: 'Users management'
35 site_credentials: 'Site credentials' 35 site_credentials: 'Site credentials'
36 ignore_origin_instance_rules: 'Global ignore origin rules'
36 quickstart: "Quickstart" 37 quickstart: "Quickstart"
37 top: 38 top:
38 add_new_entry: 'Add a new entry' 39 add_new_entry: 'Add a new entry'
@@ -595,6 +596,24 @@ site_credential:
595 delete_confirm: Are you sure? 596 delete_confirm: Are you sure?
596 back_to_list: Back to list 597 back_to_list: Back to list
597 598
599ignore_origin_instance_rule:
600 page_title: Global ignore origin rules
601 new_ignore_origin_instance_rule: Create a global ignore origin rule
602 edit_ignore_origin_instance_rule: Edit an existing ignore origin rule
603 description: "Here you can manage the global ignore origin rules used to ignore some patterns of origin url."
604 list:
605 actions: Actions
606 edit_action: Edit
607 yes: Yes
608 no: No
609 create_new_one: Create a new global ignore origin rule
610 form:
611 rule_label: Rule
612 save: Save
613 delete: Delete
614 delete_confirm: Are you sure?
615 back_to_list: Back to list
616
598error: 617error:
599 page_title: An error occurred 618 page_title: An error occurred
600 619
@@ -661,3 +680,8 @@ flashes:
661 added: 'Site credential for "%host%" added' 680 added: 'Site credential for "%host%" added'
662 updated: 'Site credential for "%host%" updated' 681 updated: 'Site credential for "%host%" updated'
663 deleted: 'Site credential for "%host%" deleted' 682 deleted: 'Site credential for "%host%" deleted'
683 ignore_origin_instance_rule:
684 notice:
685 added: 'Global ignore origin rule added'
686 updated: 'Global ignore origin rule updated'
687 deleted: 'Global ignore origin rule deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
index 3e77afd6..4de4dcb5 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'Volver a los artículos sin leer' 33 back_to_unread: 'Volver a los artículos sin leer'
34 users_management: 'Configuración de usuarios' 34 users_management: 'Configuración de usuarios'
35 site_credentials: 'Credenciales del sitio' 35 site_credentials: 'Credenciales del sitio'
36 # ignore_origin_instance_rules: 'Global ignore origin rules'
36 quickstart: "Inicio rápido" 37 quickstart: "Inicio rápido"
37 top: 38 top:
38 add_new_entry: 'Añadir un nuevo artículo' 39 add_new_entry: 'Añadir un nuevo artículo'
@@ -661,3 +662,8 @@ flashes:
661 added: 'Credenciales del sitio añadidas para "%host%"' 662 added: 'Credenciales del sitio añadidas para "%host%"'
662 updated: 'Credenciales del sitio actualizadas para "%host%"' 663 updated: 'Credenciales del sitio actualizadas para "%host%"'
663 deleted: 'Credenciales del sitio eliminadas para "%host%"' 664 deleted: 'Credenciales del sitio eliminadas para "%host%"'
665 ignore_origin_instance_rule:
666 notice:
667 # added: 'Global ignore origin rule added'
668 # updated: 'Global ignore origin rule updated'
669 # deleted: 'Global ignore origin rule deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
index 38c252f7..32dcdb3c 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'بازگشت به خوانده‌نشده‌ها' 33 back_to_unread: 'بازگشت به خوانده‌نشده‌ها'
34 # users_management: 'Users management' 34 # users_management: 'Users management'
35 # site_credentials: 'Site credentials' 35 # site_credentials: 'Site credentials'
36 # ignore_origin_instance_rules: 'Global ignore origin rules'
36 quickstart: "Quickstart" 37 quickstart: "Quickstart"
37 top: 38 top:
38 add_new_entry: 'افزودن مقالهٔ تازه' 39 add_new_entry: 'افزودن مقالهٔ تازه'
@@ -661,3 +662,8 @@ flashes:
661 # added: 'Site credential for "%host%" added' 662 # added: 'Site credential for "%host%" added'
662 # updated: 'Site credential for "%host%" updated' 663 # updated: 'Site credential for "%host%" updated'
663 # deleted: 'Site credential for "%host%" deleted' 664 # deleted: 'Site credential for "%host%" deleted'
665 ignore_origin_instance_rule:
666 notice:
667 # added: 'Global ignore origin rule added'
668 # updated: 'Global ignore origin rule updated'
669 # deleted: 'Global ignore origin rule deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
index b12dd9ca..dfdf2083 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: "Retour aux articles non lus" 33 back_to_unread: "Retour aux articles non lus"
34 users_management: "Gestion des utilisateurs" 34 users_management: "Gestion des utilisateurs"
35 site_credentials: 'Accès aux sites' 35 site_credentials: 'Accès aux sites'
36 ignore_origin_instance_rules: "Règles globales d'omission d'origine"
36 quickstart: "Pour bien débuter" 37 quickstart: "Pour bien débuter"
37 top: 38 top:
38 add_new_entry: "Sauvegarder un nouvel article" 39 add_new_entry: "Sauvegarder un nouvel article"
@@ -619,11 +620,8 @@ flashes:
619 otp_disabled: "Authentification à double-facteur désactivée" 620 otp_disabled: "Authentification à double-facteur désactivée"
620 tagging_rules_imported: Règles bien importées 621 tagging_rules_imported: Règles bien importées
621 tagging_rules_not_imported: Impossible d'importer les règles 622 tagging_rules_not_imported: Impossible d'importer les règles
622<<<<<<< HEAD
623=======
624 ignore_origin_rules_deleted: "Règle d'omission d'origine supprimée" 623 ignore_origin_rules_deleted: "Règle d'omission d'origine supprimée"
625 ignore_origin_rules_updated: "Règle d'omission d'origine mise à jour" 624 ignore_origin_rules_updated: "Règle d'omission d'origine mise à jour"
626>>>>>>> 4c595340... fixup! Add new Ignore Origin rules tab, update ConfigController
627 entry: 625 entry:
628 notice: 626 notice:
629 entry_already_saved: "Article déjà sauvegardé le %date%" 627 entry_already_saved: "Article déjà sauvegardé le %date%"
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
index eb44318b..42a50ca5 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'Torna ai contenuti non letti' 33 back_to_unread: 'Torna ai contenuti non letti'
34 users_management: 'Gestione utenti' 34 users_management: 'Gestione utenti'
35 site_credentials: 'Credenziali sito' 35 site_credentials: 'Credenziali sito'
36 # ignore_origin_instance_rules: 'Global ignore origin rules'
36 quickstart: "Introduzione" 37 quickstart: "Introduzione"
37 top: 38 top:
38 add_new_entry: 'Aggiungi un nuovo contenuto' 39 add_new_entry: 'Aggiungi un nuovo contenuto'
@@ -661,3 +662,8 @@ flashes:
661 # added: 'Site credential for "%host%" added' 662 # added: 'Site credential for "%host%" added'
662 # updated: 'Site credential for "%host%" updated' 663 # updated: 'Site credential for "%host%" updated'
663 # deleted: 'Site credential for "%host%" deleted' 664 # deleted: 'Site credential for "%host%" deleted'
665 ignore_origin_instance_rule:
666 notice:
667 # added: 'Global ignore origin rule added'
668 # updated: 'Global ignore origin rule updated'
669 # deleted: 'Global ignore origin rule deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
index 165186b1..df3553c8 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'Tornar als articles pas legits' 33 back_to_unread: 'Tornar als articles pas legits'
34 users_management: 'Gestion dels utilizaires' 34 users_management: 'Gestion dels utilizaires'
35 site_credentials: 'Identificants del site' 35 site_credentials: 'Identificants del site'
36 # ignore_origin_instance_rules: 'Global ignore origin rules'
36 quickstart: "Per ben començar" 37 quickstart: "Per ben començar"
37 top: 38 top:
38 add_new_entry: 'Enregistrar un novèl article' 39 add_new_entry: 'Enregistrar un novèl article'
@@ -661,3 +662,8 @@ flashes:
661 added: 'Identificant per "%host%" ajustat' 662 added: 'Identificant per "%host%" ajustat'
662 updated: 'Identificant per "%host%" mes a jorn' 663 updated: 'Identificant per "%host%" mes a jorn'
663 deleted: 'Identificant per "%host%" suprimit' 664 deleted: 'Identificant per "%host%" suprimit'
665 ignore_origin_instance_rule:
666 notice:
667 # added: 'Global ignore origin rule added'
668 # updated: 'Global ignore origin rule updated'
669 # deleted: 'Global ignore origin rule deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
index fbf64f30..41977ede 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'Powrót do nieprzeczytanych artykułów' 33 back_to_unread: 'Powrót do nieprzeczytanych artykułów'
34 users_management: 'Zarządzanie użytkownikami' 34 users_management: 'Zarządzanie użytkownikami'
35 site_credentials: 'Poświadczenia strony' 35 site_credentials: 'Poświadczenia strony'
36 # ignore_origin_instance_rules: 'Global ignore origin rules'
36 quickstart: "Szybki start" 37 quickstart: "Szybki start"
37 top: 38 top:
38 add_new_entry: 'Dodaj nowy wpis' 39 add_new_entry: 'Dodaj nowy wpis'
@@ -661,3 +662,8 @@ flashes:
661 added: 'Poświadczenie dla "%host%" dodane' 662 added: 'Poświadczenie dla "%host%" dodane'
662 updated: 'Poświadczenie dla "%host%" zaktualizowane' 663 updated: 'Poświadczenie dla "%host%" zaktualizowane'
663 deleted: 'Poświadczenie dla "%host%" usuniętę' 664 deleted: 'Poświadczenie dla "%host%" usuniętę'
665 ignore_origin_instance_rule:
666 notice:
667 # added: 'Global ignore origin rule added'
668 # updated: 'Global ignore origin rule updated'
669 # deleted: 'Global ignore origin rule deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
index 93910d4b..78918e15 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'Voltar para os artigos não lidos' 33 back_to_unread: 'Voltar para os artigos não lidos'
34 users_management: 'Gestão de Usuários' 34 users_management: 'Gestão de Usuários'
35 site_credentials: 'Credenciais do site' 35 site_credentials: 'Credenciais do site'
36 # ignore_origin_instance_rules: 'Global ignore origin rules'
36 quickstart: "Começo Rápido" 37 quickstart: "Começo Rápido"
37 top: 38 top:
38 add_new_entry: 'Adicionar um novo artigo' 39 add_new_entry: 'Adicionar um novo artigo'
@@ -658,3 +659,8 @@ flashes:
658 added: 'Credencial do site para "%host%" foi adicionada' 659 added: 'Credencial do site para "%host%" foi adicionada'
659 updated: 'Credencial do site pa "%host%" atualizada' 660 updated: 'Credencial do site pa "%host%" atualizada'
660 deleted: 'Credencial do site pa "%host%" removida' 661 deleted: 'Credencial do site pa "%host%" removida'
662 ignore_origin_instance_rule:
663 notice:
664 # added: 'Global ignore origin rule added'
665 # updated: 'Global ignore origin rule updated'
666 # deleted: 'Global ignore origin rule deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
index 5984d229..5400187a 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'Înapoi la articolele necitite' 33 back_to_unread: 'Înapoi la articolele necitite'
34 # users_management: 'Users management' 34 # users_management: 'Users management'
35 # site_credentials: 'Site credentials' 35 # site_credentials: 'Site credentials'
36 # ignore_origin_instance_rules: 'Global ignore origin rules'
36 # quickstart: "Quickstart" 37 # quickstart: "Quickstart"
37 top: 38 top:
38 add_new_entry: 'Introdu un nou articol' 39 add_new_entry: 'Introdu un nou articol'
@@ -660,3 +661,8 @@ flashes:
660 # added: 'Site credential for "%host%" added' 661 # added: 'Site credential for "%host%" added'
661 # updated: 'Site credential for "%host%" updated' 662 # updated: 'Site credential for "%host%" updated'
662 # deleted: 'Site credential for "%host%" deleted' 663 # deleted: 'Site credential for "%host%" deleted'
664 ignore_origin_instance_rule:
665 notice:
666 # added: 'Global ignore origin rule added'
667 # updated: 'Global ignore origin rule updated'
668 # deleted: 'Global ignore origin rule deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml
index a138ee5d..ce803ecd 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'Назад к непрочитанным записям' 33 back_to_unread: 'Назад к непрочитанным записям'
34 users_management: 'Управление пользователями' 34 users_management: 'Управление пользователями'
35 site_credentials: 'Site credentials' 35 site_credentials: 'Site credentials'
36 # ignore_origin_instance_rules: 'Global ignore origin rules'
36 quickstart: "Быстрый старт" 37 quickstart: "Быстрый старт"
37 top: 38 top:
38 add_new_entry: 'Добавить новую запись' 39 add_new_entry: 'Добавить новую запись'
@@ -660,3 +661,8 @@ flashes:
660 # added: 'Site credential for "%host%" added' 661 # added: 'Site credential for "%host%" added'
661 # updated: 'Site credential for "%host%" updated' 662 # updated: 'Site credential for "%host%" updated'
662 # deleted: 'Site credential for "%host%" deleted' 663 # deleted: 'Site credential for "%host%" deleted'
664 ignore_origin_instance_rule:
665 notice:
666 # added: 'Global ignore origin rule added'
667 # updated: 'Global ignore origin rule updated'
668 # deleted: 'Global ignore origin rule deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml
index b786a73d..7c887781 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'กลับไปยังรายการที่ไม่ได้อ่าน' 33 back_to_unread: 'กลับไปยังรายการที่ไม่ได้อ่าน'
34 users_management: 'การจัดการผู้ใช้' 34 users_management: 'การจัดการผู้ใช้'
35 site_credentials: 'การรับรองไซต์' 35 site_credentials: 'การรับรองไซต์'
36 # ignore_origin_instance_rules: 'Global ignore origin rules'
36 quickstart: "เริ่มแบบด่วน" 37 quickstart: "เริ่มแบบด่วน"
37 top: 38 top:
38 add_new_entry: 'เพิ่มรายการใหม่' 39 add_new_entry: 'เพิ่มรายการใหม่'
@@ -660,3 +661,8 @@ flashes:
660 added: 'ไซต์ข้อมูลประจำตัวสำหรับ "%host%" ที่ทำการเพิ่ม' 661 added: 'ไซต์ข้อมูลประจำตัวสำหรับ "%host%" ที่ทำการเพิ่ม'
661 updated: 'ไซต์ข้อมูลประจำตัวสำหรับ "%host%" ที่ทำการอัปเดต' 662 updated: 'ไซต์ข้อมูลประจำตัวสำหรับ "%host%" ที่ทำการอัปเดต'
662 deleted: 'ไซต์ข้อมูลประจำตัวสำหรับ "%host%" ที่ทำการลบ' 663 deleted: 'ไซต์ข้อมูลประจำตัวสำหรับ "%host%" ที่ทำการลบ'
664 ignore_origin_instance_rule:
665 notice:
666 # added: 'Global ignore origin rule added'
667 # updated: 'Global ignore origin rule updated'
668 # deleted: 'Global ignore origin rule deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
index a317c2f5..f2ce40d9 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
@@ -33,6 +33,7 @@ menu:
33 back_to_unread: 'Okunmayan makalelere geri dön' 33 back_to_unread: 'Okunmayan makalelere geri dön'
34 # users_management: 'Users management' 34 # users_management: 'Users management'
35 # site_credentials: 'Site credentials' 35 # site_credentials: 'Site credentials'
36 # ignore_origin_instance_rules: 'Global ignore origin rules'
36 quickstart: "Hızlı başlangıç" 37 quickstart: "Hızlı başlangıç"
37 top: 38 top:
38 add_new_entry: 'Yeni bir makale ekle' 39 add_new_entry: 'Yeni bir makale ekle'
@@ -660,3 +661,8 @@ flashes:
660 # added: 'Site credential for "%host%" added' 661 # added: 'Site credential for "%host%" added'
661 # updated: 'Site credential for "%host%" updated' 662 # updated: 'Site credential for "%host%" updated'
662 # deleted: 'Site credential for "%host%" deleted' 663 # deleted: 'Site credential for "%host%" deleted'
664 ignore_origin_instance_rule:
665 notice:
666 # added: 'Global ignore origin rule added'
667 # updated: 'Global ignore origin rule updated'
668 # deleted: 'Global ignore origin rule deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/IgnoreOriginInstanceRule/edit.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/IgnoreOriginInstanceRule/edit.html.twig
new file mode 100644
index 00000000..ebb07d07
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/IgnoreOriginInstanceRule/edit.html.twig
@@ -0,0 +1,44 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{{ 'ignore_origin_instance_rule.page_title'|trans }}{% endblock %}
4
5{% block content %}
6
7 <div class="row">
8 <div class="col s12">
9 <div class="card-panel">
10 <div class="row">
11 <div class="input-field col s12">
12 <h4>{{ 'ignore_origin_instance_rule.edit_ignore_origin_instance_rule'|trans }}</h4>
13
14 <div id="set6" class="col s12">
15 {{ form_start(edit_form) }}
16 {{ form_errors(edit_form) }}
17
18 <div class="row">
19 <div class="input-field col s12">
20 {{ form_label(edit_form.rule) }}
21 {{ form_errors(edit_form.rule) }}
22 {{ form_widget(edit_form.rule) }}
23 </div>
24 </div>
25
26 <br/>
27
28 {{ form_widget(edit_form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
29 {{ form_widget(edit_form._token) }}
30 </form>
31 <p>
32 {{ form_start(delete_form) }}
33 <button onclick="return confirm('{{ 'ignore_origin_instance_rule.form.delete_confirm'|trans|escape('js') }}')" type="submit" class="btn waves-effect waves-light red">{{ 'ignore_origin_instance_rule.form.delete'|trans }}</button>
34 {{ form_end(delete_form) }}
35 </p>
36 <p><a class="waves-effect waves-light btn blue-grey" href="{{ path('ignore_origin_instance_rules_index') }}">{{ 'ignore_origin_instance_rule.form.back_to_list'|trans }}</a></p>
37 </div>
38 </div>
39 </div>
40 </div>
41 </div>
42 </div>
43
44{% endblock %}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/IgnoreOriginInstanceRule/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/IgnoreOriginInstanceRule/index.html.twig
new file mode 100644
index 00000000..2de7cf0a
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/IgnoreOriginInstanceRule/index.html.twig
@@ -0,0 +1,42 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{{ 'ignore_origin_instance_rule.page_title'|trans }}{% endblock %}
4
5{% block content %}
6
7 <div class="row">
8 <div class="col s12">
9 <div class="card-panel">
10 <div class="row">
11 <div class="input-field col s12">
12 <p class="help">{{ 'ignore_origin_instance_rule.description'|trans|raw }}</p>
13
14 <table class="bordered">
15 <thead>
16 <tr>
17 <th>{{ 'ignore_origin_instance_rule.form.rule_label'|trans }}</th>
18 <th>{{ 'ignore_origin_instance_rule.list.actions'|trans }}</th>
19 </tr>
20 </thead>
21 <tbody>
22 {% for rule in rules %}
23 <tr>
24 <td>{{ rule.rule }}</td>
25 <td>
26 <a href="{{ path('ignore_origin_instance_rules_edit', { 'id': rule.id }) }}">{{ 'ignore_origin_instance_rule.list.edit_action'|trans }}</a>
27 </td>
28 </tr>
29 {% endfor %}
30 </tbody>
31 </table>
32 <br />
33 <p>
34 <a href="{{ path('ignore_origin_instance_rules_new') }}" class="waves-effect waves-light btn">{{ 'ignore_origin_instance_rule.list.create_new_one'|trans }}</a>
35 </p>
36 </div>
37 </div>
38 </div>
39 </div>
40 </div>
41
42{% endblock %}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/IgnoreOriginInstanceRule/new.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/IgnoreOriginInstanceRule/new.html.twig
new file mode 100644
index 00000000..fbe1f795
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/IgnoreOriginInstanceRule/new.html.twig
@@ -0,0 +1,37 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{{ 'ignore_origin_instance_rule.page_title'|trans }}{% endblock %}
4
5{% block content %}
6
7 <div class="row">
8 <div class="col s12">
9 <div class="card-panel">
10 <div class="row">
11 <div class="input-field col s12">
12 <h4>{{ 'ignore_origin_instance_rule.new_ignore_origin_instance_rule'|trans }}</h4>
13
14 <div id="set6" class="col s12">
15 {{ form_start(form) }}
16 {{ form_errors(form) }}
17
18 <div class="row">
19 <div class="input-field col s12">
20 {{ form_label(form.rule) }}
21 {{ form_errors(form.rule) }}
22 {{ form_widget(form.rule) }}
23 </div>
24 </div>
25
26 {{ form_widget(form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
27 {{ form_rest(form) }}
28 </form>
29 <p><a class="waves-effect waves-light btn blue-grey" href="{{ path('ignore_origin_instance_rules_index') }}">{{ 'ignore_origin_instance_rule.form.back_to_list'|trans }}</a></p>
30 </div>
31 </div>
32 </div>
33 </div>
34 </div>
35 </div>
36
37{% endblock %}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig
index 6b1e2bd7..e1446ff7 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig
@@ -45,6 +45,7 @@
45 {% if is_granted('ROLE_SUPER_ADMIN') %} 45 {% if is_granted('ROLE_SUPER_ADMIN') %}
46 <li class="menu users"><a href="{{ path('user_index') }}">{{ 'menu.left.users_management'|trans }}</a></li> 46 <li class="menu users"><a href="{{ path('user_index') }}">{{ 'menu.left.users_management'|trans }}</a></li>
47 <li class="menu internal"><a href="{{ path('craue_config_settings_modify') }}">{{ 'menu.left.internal_settings'|trans }}</a></li> 47 <li class="menu internal"><a href="{{ path('craue_config_settings_modify') }}">{{ 'menu.left.internal_settings'|trans }}</a></li>
48 <li class="menu ignore"><a href="{{ path('ignore_origin_instance_rules_index') }}">{{ 'menu.left.ignore_origin_instance_rules'|trans }}</a></li>
48 {% endif %} 49 {% endif %}
49 <li class="menu import"><a href="{{ path('import') }}">{{ 'menu.left.import'|trans }}</a></li> 50 <li class="menu import"><a href="{{ path('import') }}">{{ 'menu.left.import'|trans }}</a></li>
50 <li class="menu howto"><a href="{{ path('howto') }}">{{ 'menu.left.howto'|trans }}</a></li> 51 <li class="menu howto"><a href="{{ path('howto') }}">{{ 'menu.left.howto'|trans }}</a></li>
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/IgnoreOriginInstanceRule/edit.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/IgnoreOriginInstanceRule/edit.html.twig
new file mode 100644
index 00000000..ebb07d07
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/IgnoreOriginInstanceRule/edit.html.twig
@@ -0,0 +1,44 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{{ 'ignore_origin_instance_rule.page_title'|trans }}{% endblock %}
4
5{% block content %}
6
7 <div class="row">
8 <div class="col s12">
9 <div class="card-panel">
10 <div class="row">
11 <div class="input-field col s12">
12 <h4>{{ 'ignore_origin_instance_rule.edit_ignore_origin_instance_rule'|trans }}</h4>
13
14 <div id="set6" class="col s12">
15 {{ form_start(edit_form) }}
16 {{ form_errors(edit_form) }}
17
18 <div class="row">
19 <div class="input-field col s12">
20 {{ form_label(edit_form.rule) }}
21 {{ form_errors(edit_form.rule) }}
22 {{ form_widget(edit_form.rule) }}
23 </div>
24 </div>
25
26 <br/>
27
28 {{ form_widget(edit_form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
29 {{ form_widget(edit_form._token) }}
30 </form>
31 <p>
32 {{ form_start(delete_form) }}
33 <button onclick="return confirm('{{ 'ignore_origin_instance_rule.form.delete_confirm'|trans|escape('js') }}')" type="submit" class="btn waves-effect waves-light red">{{ 'ignore_origin_instance_rule.form.delete'|trans }}</button>
34 {{ form_end(delete_form) }}
35 </p>
36 <p><a class="waves-effect waves-light btn blue-grey" href="{{ path('ignore_origin_instance_rules_index') }}">{{ 'ignore_origin_instance_rule.form.back_to_list'|trans }}</a></p>
37 </div>
38 </div>
39 </div>
40 </div>
41 </div>
42 </div>
43
44{% endblock %}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/IgnoreOriginInstanceRule/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/IgnoreOriginInstanceRule/index.html.twig
new file mode 100644
index 00000000..2de7cf0a
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/IgnoreOriginInstanceRule/index.html.twig
@@ -0,0 +1,42 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{{ 'ignore_origin_instance_rule.page_title'|trans }}{% endblock %}
4
5{% block content %}
6
7 <div class="row">
8 <div class="col s12">
9 <div class="card-panel">
10 <div class="row">
11 <div class="input-field col s12">
12 <p class="help">{{ 'ignore_origin_instance_rule.description'|trans|raw }}</p>
13
14 <table class="bordered">
15 <thead>
16 <tr>
17 <th>{{ 'ignore_origin_instance_rule.form.rule_label'|trans }}</th>
18 <th>{{ 'ignore_origin_instance_rule.list.actions'|trans }}</th>
19 </tr>
20 </thead>
21 <tbody>
22 {% for rule in rules %}
23 <tr>
24 <td>{{ rule.rule }}</td>
25 <td>
26 <a href="{{ path('ignore_origin_instance_rules_edit', { 'id': rule.id }) }}">{{ 'ignore_origin_instance_rule.list.edit_action'|trans }}</a>
27 </td>
28 </tr>
29 {% endfor %}
30 </tbody>
31 </table>
32 <br />
33 <p>
34 <a href="{{ path('ignore_origin_instance_rules_new') }}" class="waves-effect waves-light btn">{{ 'ignore_origin_instance_rule.list.create_new_one'|trans }}</a>
35 </p>
36 </div>
37 </div>
38 </div>
39 </div>
40 </div>
41
42{% endblock %}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/IgnoreOriginInstanceRule/new.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/IgnoreOriginInstanceRule/new.html.twig
new file mode 100644
index 00000000..fbe1f795
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/IgnoreOriginInstanceRule/new.html.twig
@@ -0,0 +1,37 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{{ 'ignore_origin_instance_rule.page_title'|trans }}{% endblock %}
4
5{% block content %}
6
7 <div class="row">
8 <div class="col s12">
9 <div class="card-panel">
10 <div class="row">
11 <div class="input-field col s12">
12 <h4>{{ 'ignore_origin_instance_rule.new_ignore_origin_instance_rule'|trans }}</h4>
13
14 <div id="set6" class="col s12">
15 {{ form_start(form) }}
16 {{ form_errors(form) }}
17
18 <div class="row">
19 <div class="input-field col s12">
20 {{ form_label(form.rule) }}
21 {{ form_errors(form.rule) }}
22 {{ form_widget(form.rule) }}
23 </div>
24 </div>
25
26 {{ form_widget(form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
27 {{ form_rest(form) }}
28 </form>
29 <p><a class="waves-effect waves-light btn blue-grey" href="{{ path('ignore_origin_instance_rules_index') }}">{{ 'ignore_origin_instance_rule.form.back_to_list'|trans }}</a></p>
30 </div>
31 </div>
32 </div>
33 </div>
34 </div>
35 </div>
36
37{% endblock %}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
index c51d07fc..d9b6d190 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
@@ -78,9 +78,13 @@
78 <a class="waves-effect" href="{{ path('user_index') }}">{{ 'menu.left.users_management'|trans }}</a> 78 <a class="waves-effect" href="{{ path('user_index') }}">{{ 'menu.left.users_management'|trans }}</a>
79 </li> 79 </li>
80 80
81 <li class="bold border-bottom {% if currentRoute == 'craue_config_settings_modify' %}active{% endif %}"> 81 <li class="bold {% if currentRoute == 'craue_config_settings_modify' %}active{% endif %}">
82 <a class="waves-effect" href="{{ path('craue_config_settings_modify') }}">{{ 'menu.left.internal_settings'|trans }}</a> 82 <a class="waves-effect" href="{{ path('craue_config_settings_modify') }}">{{ 'menu.left.internal_settings'|trans }}</a>
83 </li> 83 </li>
84
85 <li class="bold border-bottom {% if currentRoute == 'ignore_origin_instance_rules_index' %}active{% endif %}">
86 <a class="waves-effect" href="{{ path('ignore_origin_instance_rules_index') }}">{{ 'menu.left.ignore_origin_instance_rules'|trans }}</a>
87 </li>
84 {% endif %} 88 {% endif %}
85 <li class="bold {% if currentRoute == 'import' %}active{% endif %}"> 89 <li class="bold {% if currentRoute == 'import' %}active{% endif %}">
86 <a class="waves-effect" href="{{ path('import') }}">{{ 'menu.left.import'|trans }}</a> 90 <a class="waves-effect" href="{{ path('import') }}">{{ 'menu.left.import'|trans }}</a>
diff --git a/tests/Wallabag/CoreBundle/Controller/IgnoreOriginInstanceRuleControllerTest.php b/tests/Wallabag/CoreBundle/Controller/IgnoreOriginInstanceRuleControllerTest.php
new file mode 100644
index 00000000..9783cd25
--- /dev/null
+++ b/tests/Wallabag/CoreBundle/Controller/IgnoreOriginInstanceRuleControllerTest.php
@@ -0,0 +1,148 @@
1<?php
2
3namespace Tests\Wallabag\CoreBundle\Controller;
4
5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6
7class IgnoreOriginInstanceRuleControllerTest extends WallabagCoreTestCase
8{
9 public function testListIgnoreOriginInstanceRule()
10 {
11 $this->logInAs('admin');
12 $client = $this->getClient();
13
14 $crawler = $client->request('GET', '/ignore-origin-instance-rules/');
15
16 $this->assertSame(200, $client->getResponse()->getStatusCode());
17
18 $body = $crawler->filter('body')->extract(['_text'])[0];
19
20 $this->assertContains('ignore_origin_instance_rule.description', $body);
21 $this->assertContains('ignore_origin_instance_rule.list.create_new_one', $body);
22 }
23
24 public function testIgnoreOriginInstanceRuleCreationEditionDeletion()
25 {
26 $this->logInAs('admin');
27 $client = $this->getClient();
28
29 // Creation
30 $crawler = $client->request('GET', '/ignore-origin-instance-rules/new');
31
32 $this->assertSame(200, $client->getResponse()->getStatusCode());
33
34 $body = $crawler->filter('body')->extract(['_text'])[0];
35
36 $this->assertContains('ignore_origin_instance_rule.new_ignore_origin_instance_rule', $body);
37 $this->assertContains('ignore_origin_instance_rule.form.back_to_list', $body);
38
39 $form = $crawler->filter('button[id=ignore_origin_instance_rule_save]')->form();
40
41 $data = [
42 'ignore_origin_instance_rule[rule]' => 'host = "foo.example.com"',
43 ];
44
45 $client->submit($form, $data);
46
47 $this->assertSame(302, $client->getResponse()->getStatusCode());
48
49 $crawler = $client->followRedirect();
50
51 $this->assertContains('flashes.ignore_origin_instance_rule.notice.added', $crawler->filter('body')->extract(['_text'])[0]);
52
53 // Edition
54 $editLink = $crawler->filter('div[id=content] table a')->last()->link();
55
56 $crawler = $client->click($editLink);
57
58 $this->assertSame(200, $client->getResponse()->getStatusCode());
59
60 $this->assertContains('foo.example.com', $crawler->filter('form[name=ignore_origin_instance_rule] input[type=text]')->extract(['value'])[0]);
61
62 $body = $crawler->filter('body')->extract(['_text'])[0];
63
64 $this->assertContains('ignore_origin_instance_rule.edit_ignore_origin_instance_rule', $body);
65 $this->assertContains('ignore_origin_instance_rule.form.back_to_list', $body);
66
67 $form = $crawler->filter('button[id=ignore_origin_instance_rule_save]')->form();
68
69 $data = [
70 'ignore_origin_instance_rule[rule]' => 'host = "bar.example.com"',
71 ];
72
73 $client->submit($form, $data);
74
75 $this->assertSame(302, $client->getResponse()->getStatusCode());
76
77 $crawler = $client->followRedirect();
78
79 $this->assertContains('flashes.ignore_origin_instance_rule.notice.updated', $crawler->filter('body')->extract(['_text'])[0]);
80
81 $editLink = $crawler->filter('div[id=content] table a')->last()->link();
82
83 $crawler = $client->click($editLink);
84
85 $this->assertSame(200, $client->getResponse()->getStatusCode());
86
87 $this->assertContains('bar.example.com', $crawler->filter('form[name=ignore_origin_instance_rule] input[type=text]')->extract(['value'])[0]);
88
89 $deleteForm = $crawler->filter('body')->selectButton('ignore_origin_instance_rule.form.delete')->form();
90
91 $client->submit($deleteForm, []);
92
93 $this->assertSame(302, $client->getResponse()->getStatusCode());
94
95 $crawler = $client->followRedirect();
96
97 $this->assertContains('flashes.ignore_origin_instance_rule.notice.deleted', $crawler->filter('body')->extract(['_text'])[0]);
98 }
99
100 public function dataForIgnoreOriginInstanceRuleCreationFail()
101 {
102 return [
103 [
104 [
105 'ignore_origin_instance_rule[rule]' => 'foo = "bar"',
106 ],
107 [
108 'The variable',
109 'does not exist.',
110 ],
111 ],
112 [
113 [
114 'ignore_origin_instance_rule[rule]' => '_all != "none"',
115 ],
116 [
117 'The operator',
118 'does not exist.',
119 ],
120 ],
121 ];
122 }
123
124 /**
125 * @dataProvider dataForIgnoreOriginInstanceRuleCreationFail
126 */
127 public function testIgnoreOriginInstanceRuleCreationFail($data, $messages)
128 {
129 $this->logInAs('admin');
130 $client = $this->getClient();
131
132 $crawler = $client->request('GET', '/ignore-origin-instance-rules/new');
133
134 $this->assertSame(200, $client->getResponse()->getStatusCode());
135
136 $form = $crawler->filter('button[id=ignore_origin_instance_rule_save]')->form();
137
138 $crawler = $client->submit($form, $data);
139
140 $this->assertSame(200, $client->getResponse()->getStatusCode());
141
142 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
143
144 foreach ($messages as $message) {
145 $this->assertContains($message, $body[0]);
146 }
147 }
148}