From 5c072d2b57b2b5f95b25411909ac8a6af2ef6ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sat, 9 Jan 2016 14:34:49 +0100 Subject: Quickstart for beginners --- src/Wallabag/CoreBundle/Controller/EntryController.php | 7 ++++++- src/Wallabag/CoreBundle/Controller/StaticController.php | 11 +++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 37f7ab60..3d22c7bc 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -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': diff --git a/src/Wallabag/CoreBundle/Controller/StaticController.php b/src/Wallabag/CoreBundle/Controller/StaticController.php index 64875a66..9ada371b 100644 --- a/src/Wallabag/CoreBundle/Controller/StaticController.php +++ b/src/Wallabag/CoreBundle/Controller/StaticController.php @@ -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() + ); + } } -- cgit v1.2.3