From d51b38ed309c9aead938e8c8963c05c6d82b4ec2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 23 Oct 2015 14:45:50 +0200 Subject: [PATCH] create ImportController to list importers --- .../Controller/ImportController.php | 17 +++++++++++++++++ .../Controller/PocketController.php | 9 ++++----- .../ImportBundle/Import/ImportInterface.php | 2 ++ .../ImportBundle/Import/PocketImport.php | 10 ++++++++++ .../Resources/views/Import/index.html.twig | 16 ++++++++++++++++ 5 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 src/Wallabag/ImportBundle/Controller/ImportController.php create mode 100644 src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig diff --git a/src/Wallabag/ImportBundle/Controller/ImportController.php b/src/Wallabag/ImportBundle/Controller/ImportController.php new file mode 100644 index 00000000..3569793b --- /dev/null +++ b/src/Wallabag/ImportBundle/Controller/ImportController.php @@ -0,0 +1,17 @@ +render('WallabagImportBundle:Import:index.html.twig', array()); + } +} diff --git a/src/Wallabag/ImportBundle/Controller/PocketController.php b/src/Wallabag/ImportBundle/Controller/PocketController.php index 9602c282..f851c81c 100644 --- a/src/Wallabag/ImportBundle/Controller/PocketController.php +++ b/src/Wallabag/ImportBundle/Controller/PocketController.php @@ -4,20 +4,19 @@ namespace Wallabag\ImportBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; -use Wallabag\ImportBundle\Import\PocketImport; class PocketController extends Controller { /** - * @Route("/import", name="import") + * @Route("/import/pocket", name="pocket") */ - public function importAction() + public function indexAction() { return $this->render('WallabagImportBundle:Pocket:index.html.twig', array()); } /** - * @Route("/auth-pocket", name="authpocket") + * @Route("/import/pocket/auth", name="authpocket") */ public function authAction() { @@ -28,7 +27,7 @@ class PocketController extends Controller } /** - * @Route("/callback-pocket", name="callbackpocket") + * @Route("/import/pocket/callback", name="callbackpocket") */ public function callbackAction() { diff --git a/src/Wallabag/ImportBundle/Import/ImportInterface.php b/src/Wallabag/ImportBundle/Import/ImportInterface.php index 88de3fa8..f07a120c 100644 --- a/src/Wallabag/ImportBundle/Import/ImportInterface.php +++ b/src/Wallabag/ImportBundle/Import/ImportInterface.php @@ -4,6 +4,8 @@ namespace Wallabag\ImportBundle\Import; interface ImportInterface { + public function getName(); + public function getDescription(); public function oAuthRequest($redirectUri, $callbackUri); public function oAuthAuthorize(); public function import($accessToken); diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php index 413c9ccc..81af8e57 100644 --- a/src/Wallabag/ImportBundle/Import/PocketImport.php +++ b/src/Wallabag/ImportBundle/Import/PocketImport.php @@ -23,6 +23,16 @@ class PocketImport implements ImportInterface $this->consumerKey = $consumerKey; } + public function getName() + { + return 'Pocket'; + } + + public function getDescription() + { + return 'This importer will import all your Pocket data.'; + } + /** * Create a new Client. * diff --git a/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig new file mode 100644 index 00000000..bdd57e5e --- /dev/null +++ b/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig @@ -0,0 +1,16 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} +{% block title %}{% trans %}import{% endtrans %}{% endblock %} + +{% block content %} + +
+
+
+ {% trans %}Welcome on wallabag importer. Please select your previous service that you want to migrate.{% endtrans %} + +
+
+
+{% endblock %} -- 2.41.0