]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Merge pull request #1524 from wallabag/sf2.8
authorNicolas Lœuillet <nicolas@loeuillet.org>
Fri, 15 Jan 2016 14:38:31 +0000 (15:38 +0100)
committerNicolas Lœuillet <nicolas@loeuillet.org>
Fri, 15 Jan 2016 14:38:31 +0000 (15:38 +0100)
Upgrade to Symfony 3.0

12 files changed:
docs/en/index.rst
docs/en/user/first_article.rst
src/Wallabag/CoreBundle/Controller/EntryController.php
src/Wallabag/CoreBundle/Controller/StaticController.php
src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
src/Wallabag/CoreBundle/Repository/EntryRepository.php
src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
src/Wallabag/CoreBundle/Resources/views/themes/baggy/Static/quickstart.html.twig [new file with mode: 0644]
src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/new_form.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/material/Static/quickstart.html.twig [new file with mode: 0644]
src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
src/Wallabag/UserBundle/DataFixtures/ORM/LoadUserData.php

index 3c0a0d5a99ba577204bf0d4407837a6f33deee7c..7dd01b3995ca83e4e284bcba8361dfdf6348c3da 100644 (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
\ No newline at end of file
+   user/tags
+
+.. _dev-docs:
+
+.. toctree::
+   :maxdepth: 2
+   :caption: Developer documentation
+
+   developer/docker
\ No newline at end of file
index c1ffd23f0b57136d6a71bbf761e0e981b5ce7ebf..6f94bbefa7b790fb065191e430405ca2bf3a4bd6 100644 (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
 ----------------------
 
index dda0a45610b78ff0199c00c929fb3aad60d6e42a..aa70307b15e29b930ef47726d2daad262892eaa5 100644 (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':
index 64875a6654c3723de9facd382a7f4552b8eee90d..9ada371b1c0a8f57e80072df6950a8564b8579bb 100644 (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()
+        );
+    }
 }
index 3b3c1e9795d9aa0f06708968432a8cf03ad5926f..850849600dd0588811a98fb1dc5f190ac6e251ff 100644 (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();
     }
 
index c6763a40caa26d81febc8083bb4c4c267f94acf3..a16be9e01924d4cefb89b6a37db999fb341ef704 100644 (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();
+    }
 }
index 067465842d4906a5cddd650d808db3aafd8e5677..941237bf5777e08a43c285af1120968d77c1d2a5 100644 (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"
\ No newline at end of file
+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"
\ No newline at end of file
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Static/quickstart.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Static/quickstart.html.twig
new file mode 100644 (file)
index 0000000..f57673c
--- /dev/null
@@ -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 %}
index fda53e5b0876387d176f75557013354d123bcf7d..47e3bc781fd9a5706298da9d42d841efd72bc943 100644 (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>
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/quickstart.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Static/quickstart.html.twig
new file mode 100644 (file)
index 0000000..e1f6fd5
--- /dev/null
@@ -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 %}
index 96f402b0973758cef2fe059bee46e2899d62381e..3a77518245e068bbb985ff6cba5adbb20a2a2107 100644 (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());
 
index d48855da76f0f43f6dd03622d2fdbd0d2cf0096e..26dbda3b2d02df4c0927fa8809d24b887f085d27 100644 (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();
     }