Merge pull request #1560 from wallabag/v2-quickstart

Fix #1501 Quickstart for beginners
This commit is contained in:
Jeremy Benoist 2016-01-15 15:21:43 +01:00
commit 790573d458
12 changed files with 227 additions and 15 deletions

View file

@ -11,12 +11,13 @@ keeping content only. Elements like navigation or ads are deleted.
The main documentation for this application is organized into a couple sections:
* :ref:`user-docs`
* :ref:`dev-docs`
.. _user-docs:
.. toctree::
:maxdepth: 2
:caption: User Documentation
:caption: User documentation
user/create_account
user/login
@ -25,4 +26,12 @@ The main documentation for this application is organized into a couple sections:
user/import
user/download_articles
user/filters
user/tags
user/tags
.. _dev-docs:
.. toctree::
:maxdepth: 2
:caption: Developer documentation
developer/docker

View file

@ -3,6 +3,10 @@ Save your first article
The main purpose of wallabag is to save web articles. You have many ways to do it.
.. note::
A quickstart will be displayed in the application until you save your first article.
By using a bookmarklet
----------------------

View file

@ -166,6 +166,11 @@ class EntryController extends Controller
*/
public function showUnreadAction(Request $request, $page)
{
// load the quickstart if no entry in database
if ($page == 1 && $this->get('wallabag_core.entry_repository')->countAllEntriesByUsername($this->getUser()->getId()) == 0) {
return $this->redirect($this->generateUrl('quickstart'));
}
return $this->showEntries('unread', $request, $page);
}
@ -211,7 +216,7 @@ class EntryController extends Controller
*/
private function showEntries($type, Request $request, $page)
{
$repository = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entry');
$repository = $this->get('wallabag_core.entry_repository');
switch ($type) {
case 'starred':

View file

@ -28,4 +28,15 @@ class StaticController extends Controller
array()
);
}
/**
* @Route("/quickstart", name="quickstart")
*/
public function quickstartAction()
{
return $this->render(
'WallabagCoreBundle:Static:quickstart.html.twig',
array()
);
}
}

View file

@ -40,6 +40,15 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
$this->addReference('bob-config', $bobConfig);
$emptyConfig = new Config($this->getReference('empty-user'));
$emptyConfig->setTheme('material');
$emptyConfig->setItemsPerPage(10);
$emptyConfig->setLanguage('en');
$manager->persist($emptyConfig);
$this->addReference('empty-config', $emptyConfig);
$manager->flush();
}

View file

@ -122,6 +122,8 @@ class EntryRepository extends EntityRepository
/**
* Fetch an entry with a tag. Only used for tests.
*
* @param int $userId
*
* @return Entry
*/
public function findOneWithTags($userId)
@ -248,4 +250,21 @@ class EntryRepository extends EntityRepository
return false;
}
/**
* Count all entries for a user.
*
* @param int $userId
*
* @return integer
*/
public function countAllEntriesByUsername($userId)
{
$qb = $this->createQueryBuilder('e')
->select('count(e)')
->where('e.user=:userId')->setParameter('userId', $userId)
;
return $qb->getQuery()->getSingleScalarResult();
}
}

View file

@ -53,7 +53,7 @@ Username: "Nom d'utilisateur"
# Entries
'estimated reading time': 'durée de lecture'
original: original
original: "original"
Toggle mark as read: 'Marquer comme lu/non lu'
Toggle favorite: 'Marquer comme favori'
Delete: 'Supprimer'
@ -97,7 +97,7 @@ via Paypal: "via Paypal"
via Flattr: "via Flattr"
# Howto
Form: Formulaire
Form: "Formulaire"
Thanks to this form: "Grâce à ce formulaire"
Browser addons: "Extensions de navigateur"
Mobile apps: "Applications smartphone"
@ -135,8 +135,32 @@ Welcome on wallabag importer. Please select your previous service that you want
"This importer will import all your Pocket data. Pocket doesn't allow us to retrieve content from their service, so the readable content of each article will be re-fetched by wallabag.": "Cet outil va importer toutes vos données de Pocket. Pocket ne nous autorise pas à récupérer le contenu depuis leur service, donc wallabag doit reparcourir chaque article pour récupérer son contenu."
"This importer will import all your wallabag v1 articles. On your config page, click on \"JSON export\" in the \"Export your wallabag data\" section. You will have a \"wallabag-export-1-xxxx-xx-xx.json\" file.": "Cet outil va importer toutes vos données de wallabag v1. Sur votre page de configuration de wallabag v1, cliquez sur \"Export JSON\" dans la section \"Exporter vos données de wallabag\". Vous allez récupérer un fichier \"wallabag-export-1-xxxx-xx-xx.json\"."
"You can import your data from your Pocket account. You just have to click on the below button and authorize the application to connect to getpocket.com.": "Vous pouvez importer vos données depuis votre compte Pocket. Vous n'avez qu'à cliquer sur le bouton ci-dessous et à autoriser wallabag à se connecter à getpocket.com."
Connect to Pocket and import data: Se connecter à Pocket et importer les données.
Please select your wallabag export and click on the below button to upload and import it.: Choisissez le fichier de votre export wallabag v1 et cliquez sur le bouton ci-dessous pour l'importer.
File: Fichier
Upload file: Importer le fichier
Import contents: "Importer les contenus"
Connect to Pocket and import data: "Se connecter à Pocket et importer les données."
Please select your wallabag export and click on the below button to upload and import it.: "Choisissez le fichier de votre export wallabag v1 et cliquez sur le bouton ci-dessous pour l'importer."
File: "Fichier"
Upload file: "Importer le fichier"
Import contents: "Importer les contenus"
# Quickstart
Welcome on wallabag!: "Bienvenue sur wallabag !"
We'll accompany you to visit wallabag and show you some features which can interess you.: "Nous allons vous accompagner pour vous faire faire le tour de la maison et vous présenter quelques fonctionnalités qui pourraient vous intéresser pour vous approprier cet outil."
Follow us!: "Suivez-nous !"
Configure the application: "Configurez l'application"
Change language and design: "Changez la langue et le design de l'application"
Enable RSS feeds: "Activez les flux RSS"
First steps: "Premiers pas"
Save your first article: "Ajoutez votre premier article"
And classify it!: "Et rangez-le !"
Migrate from an existing service: "Migrer depuis un service existant"
You're using an other service? We'll help you to retrieve your data on wallabag.: "Vous êtes un ancien utilisateur d'un service existant ? Nous allons vous aider à récupérer vos données sur wallabag."
Migrate from Pocket: "Migrer depuis Pocket"
Migrate from wallabag v1: "Migrer depuis wallabag v1"
Full documentation: "Documentation complète"
Convert your articles into ePUB or PDF: "Convertissez vos articles en ePub ou en PDF"
See how you can look for an article by using search engine and filters: "Apprenez à utiliser le moteur de recherche et les filtres pour retrouver l'article qui vous intéresse"
And so many other articles!: "Et encore plein d'autres choses !"
Support: "Support"
If you need some help, we are here for you.: "Parce que vous avez peut-être besoin de nous poser une question, nous sommes disponibles pour vous."
On GitHub: "Sur GitHub"
By email: "Par email"
On Gitter: "Sur Gitter"

View file

@ -0,0 +1,40 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{% trans %}Quickstart{% endtrans %}{% endblock %}
{% block content %}
<h2>{% trans %}Welcome on wallabag!{% endtrans %}</h2>
<p>{% trans %}We'll accompany you to visit wallabag and show you some features which can interess you.{% endtrans %}</p>
<p>{% trans %}Follow us!{% endtrans %}</p>
<h4>{% trans %}Configure the application{% endtrans %}</h4>
<ul>
<li><a href="{{ path('config') }}">{% trans %}Change language and design{% endtrans %}</a></li>
<li><a href="{{ path('config') }}#set2">{% trans %}Enable RSS feeds{% endtrans %}</a></li>
</ul>
<h3>{% trans %}First steps{% endtrans %}</h3>
<ul>
<li><a href="{{ path('new') }}">{% trans %}Save your first article{% endtrans %}</a></li>
<li><a href="{{ path('unread') }}">{% trans %}And classify it!{% endtrans %}</a></li>
</ul>
<h3>{% trans %}Migrate from an existing service{% endtrans %}</h3>
<p>{% trans %}You're using an other service? We'll help you to retrieve your data on wallabag.{% endtrans %}</p>
<ul>
<li><a href="{{ path('import_pocket') }}">{% trans %}Migrate from Pocket{% endtrans %}</a></li>
<li><a href="{{ path('import_wallabag_v1') }}">{% trans %}Migrate from wallabag v1{% endtrans %}</a></li>
</ul>
<h3>{% trans %}Full documentation{% endtrans %}</h3>
<ul>
<li><a href="http://wallabag.readthedocs.org">{% trans %}Convert your articles into ePUB or PDF{% endtrans %}</a></li>
<li><a href="http://wallabag.readthedocs.org">{% trans %}See how you can look for an article by using search engine and filters{% endtrans %}</a></li>
<li><a href="http://wallabag.readthedocs.org">{% trans %}And so many other articles!{% endtrans %}</a></li>
</ul>
<h3>{% trans %}Support{% endtrans %}</h3>
<p>{% trans %}If you need some help, we are here for you.{% endtrans %}</p>
<ul>
<li><a href="https://github.com/wallabag/wallabag/issues/">{% trans %}On GitHub{% endtrans %}</a></li>
<li><a href="mailto:hello@wallabag.org">{% trans %}By email{% endtrans %}</a></li>
<li><a href="https://gitter.im/wallabag/wallabag">{% trans %}On Gitter{% endtrans %}</a></li>
</ul>
{% endblock %}

View file

@ -8,7 +8,7 @@
<span class="black-text">{{ form_errors(form.url) }}</span>
{% endif %}
{{ form_widget(form.url, { 'attr': {'autocomplete': 'off'} }) }}
{{ form_widget(form.url, { 'attr': {'autocomplete': 'off', 'placeholder': 'http://website'} }) }}
<div class="hidden">{{ form_rest(form) }}</div>
</form>

View file

@ -0,0 +1,50 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{% trans %}Quickstart{% endtrans %}{% endblock %}
{% block content %}
<div class="row">
<div class="col s12">
<div class="card-panel settings">
<div class="row">
<h3>{% trans %}Welcome on wallabag!{% endtrans %}</h3>
<p>{% trans %}We'll accompany you to visit wallabag and show you some features which can interess you.{% endtrans %}</p>
<p>{% trans %}Follow us!{% endtrans %}</p>
<h4>{% trans %}Configure the application{% endtrans %}</h4>
<ul>
<li><a href="{{ path('config') }}">{% trans %}Change language and design{% endtrans %}</a></li>
<li><a href="{{ path('config') }}#set2">{% trans %}Enable RSS feeds{% endtrans %}</a></li>
</ul>
<h4>{% trans %}First steps{% endtrans %}</h4>
<ul>
<li><a href="{{ path('new') }}">{% trans %}Save your first article{% endtrans %}</a></li>
<li><a href="{{ path('unread') }}">{% trans %}And classify it!{% endtrans %}</a></li>
</ul>
<h4>{% trans %}Migrate from an existing service{% endtrans %}</h4>
<p>{% trans %}You're using an other service? We'll help you to retrieve your data on wallabag.{% endtrans %}</p>
<ul>
<li><a href="{{ path('import_pocket') }}">{% trans %}Migrate from Pocket{% endtrans %}</a></li>
<li><a href="{{ path('import_wallabag_v1') }}">{% trans %}Migrate from wallabag v1{% endtrans %}</a></li>
</ul>
<h4>{% trans %}Full documentation{% endtrans %}</h4>
<ul>
<li><a href="http://wallabag.readthedocs.org">{% trans %}Convert your articles into ePUB or PDF{% endtrans %}</a></li>
<li><a href="http://wallabag.readthedocs.org">{% trans %}See how you can look for an article by using search engine and filters{% endtrans %}</a></li>
<li><a href="http://wallabag.readthedocs.org">{% trans %}And so many other articles!{% endtrans %}</a></li>
</ul>
<h4>{% trans %}Support{% endtrans %}</h4>
<p>{% trans %}If you need some help, we are here for you.{% endtrans %}</p>
<ul>
<li><a href="https://github.com/wallabag/wallabag/issues/">{% trans %}On GitHub{% endtrans %}</a></li>
<li><a href="mailto:hello@wallabag.org">{% trans %}By email{% endtrans %}</a></li>
<li><a href="https://gitter.im/wallabag/wallabag">{% trans %}On Gitter{% endtrans %}</a></li>
</ul>
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -19,6 +19,36 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertContains('login', $client->getResponse()->headers->get('location'));
}
public function testQuickstart()
{
$this->logInAs('empty');
$client = $this->getClient();
$client->request('GET', '/unread/list');
$client->followRedirect();
$this->assertEquals(200, $client->getResponse()->getStatusCode());
$this->assertContains('We\'ll accompany you to visit wallabag', $client->getResponse()->getContent());
// Test if quickstart is disabled when user has 1 entry
$crawler = $client->request('GET', '/new');
$this->assertEquals(200, $client->getResponse()->getStatusCode());
$form = $crawler->filter('button[type=submit]')->form();
$data = array(
'entry[url]' => 'https://www.wallabag.org/blog/2016/01/08/wallabag-alpha1-v2',
);
$client->submit($form, $data);
$this->assertEquals(302, $client->getResponse()->getStatusCode());
$client->followRedirect();
$client->request('GET', '/unread/list');
$this->assertContains('There is one entry.', $client->getResponse()->getContent());
}
public function testGetNew()
{
$this->logInAs('admin');
@ -42,9 +72,9 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertCount(4, $crawler->filter('div[class=entry]'));
// Good URL
$crawler = $client->request('GET', '/bookmarklet', array('url' => $this->url));
$client->request('GET', '/bookmarklet', array('url' => $this->url));
$this->assertEquals(302, $client->getResponse()->getStatusCode());
$crawler = $client->followRedirect();
$client->followRedirect();
$crawler = $client->request('GET', '/');
$this->assertCount(5, $crawler->filter('div[class=entry]'));
@ -125,7 +155,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertEquals(302, $client->getResponse()->getStatusCode());
$crawler = $client->followRedirect();
$client->followRedirect();
$em = $client->getContainer()
->get('doctrine.orm.entity_manager');
@ -455,7 +485,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$parameters = '?entry_filter%5BreadingTime%5D%5Bleft_number%5D=&amp;entry_filter%5BreadingTime%5D%5Bright_number%5D=';
$crawler = $client->request('GET', 'unread/list'.$parameters);
$client->request('GET', 'unread/list'.$parameters);
$this->assertContains($parameters, $client->getResponse()->getContent());

View file

@ -37,6 +37,17 @@ class LoadUserData extends AbstractFixture implements OrderedFixtureInterface
$this->addReference('bob-user', $bobUser);
$emptyUser = new User();
$emptyUser->setName('Empty');
$emptyUser->setEmail('empty@wallabag.org');
$emptyUser->setUsername('empty');
$emptyUser->setPlainPassword('mypassword');
$emptyUser->setEnabled(true);
$manager->persist($emptyUser);
$this->addReference('empty-user', $emptyUser);
$manager->flush();
}