create ImportController to list importers

This commit is contained in:
Nicolas Lœuillet 2015-10-23 14:45:50 +02:00 committed by Jeremy Benoist
parent 557e549db7
commit d51b38ed30
5 changed files with 49 additions and 5 deletions

View file

@ -0,0 +1,17 @@
<?php
namespace Wallabag\ImportBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
class ImportController extends Controller
{
/**
* @Route("/import", name="import")
*/
public function importAction()
{
return $this->render('WallabagImportBundle:Import:index.html.twig', array());
}
}

View file

@ -4,20 +4,19 @@ namespace Wallabag\ImportBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Wallabag\ImportBundle\Import\PocketImport;
class PocketController extends Controller 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()); return $this->render('WallabagImportBundle:Pocket:index.html.twig', array());
} }
/** /**
* @Route("/auth-pocket", name="authpocket") * @Route("/import/pocket/auth", name="authpocket")
*/ */
public function authAction() 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() public function callbackAction()
{ {

View file

@ -4,6 +4,8 @@ namespace Wallabag\ImportBundle\Import;
interface ImportInterface interface ImportInterface
{ {
public function getName();
public function getDescription();
public function oAuthRequest($redirectUri, $callbackUri); public function oAuthRequest($redirectUri, $callbackUri);
public function oAuthAuthorize(); public function oAuthAuthorize();
public function import($accessToken); public function import($accessToken);

View file

@ -23,6 +23,16 @@ class PocketImport implements ImportInterface
$this->consumerKey = $consumerKey; $this->consumerKey = $consumerKey;
} }
public function getName()
{
return 'Pocket';
}
public function getDescription()
{
return 'This importer will import all your <a href="https://getpocket.com">Pocket</a> data.';
}
/** /**
* Create a new Client. * Create a new Client.
* *

View file

@ -0,0 +1,16 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{% trans %}import{% endtrans %}{% endblock %}
{% block content %}
<div class="row">
<div class="col s12">
<div class="card-panel settings">
{% trans %}Welcome on wallabag importer. Please select your previous service that you want to migrate.{% endtrans %}
<ul>
<li><a href="{{ path('pocket') }}">Pocket</a></li>
</ul>
</div>
</div>
</div>
{% endblock %}