diff options
author | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2015-07-29 09:02:30 +0200 |
---|---|---|
committer | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2015-07-29 09:02:30 +0200 |
commit | 7e63b892f9682e62f6758bb51c6912499f5bd8d1 (patch) | |
tree | b0b1da23086cba171d134946092f43cd31cd1e62 /src/Wallabag/CoreBundle/Controller/EntryController.php | |
parent | 9b9b05008a96a45bbf6da4c0c1c1b1244b83c6af (diff) | |
parent | 9fb6ac830fa669beef1dd11070421262c073192c (diff) | |
download | wallabag-7e63b892f9682e62f6758bb51c6912499f5bd8d1.tar.gz wallabag-7e63b892f9682e62f6758bb51c6912499f5bd8d1.tar.zst wallabag-7e63b892f9682e62f6758bb51c6912499f5bd8d1.zip |
Merge pull request #1250 from frankoa/v2_pagination_and_api
Adds pagerfanta paginator everywhere, modifies article routing.
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/EntryController.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/EntryController.php | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 4a7a0644..49714d02 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -89,60 +89,72 @@ class EntryController extends Controller | |||
89 | /** | 89 | /** |
90 | * Shows unread entries for current user. | 90 | * Shows unread entries for current user. |
91 | * | 91 | * |
92 | * @Route("/unread", name="unread") | 92 | * @Route("/unread/list/{page}", name="unread", defaults={"page" = "1"}) |
93 | * | 93 | * |
94 | * @return \Symfony\Component\HttpFoundation\Response | 94 | * @return \Symfony\Component\HttpFoundation\Response |
95 | */ | 95 | */ |
96 | public function showUnreadAction() | 96 | public function showUnreadAction($page) |
97 | { | 97 | { |
98 | // TODO change pagination | ||
99 | $entries = $this->getDoctrine() | 98 | $entries = $this->getDoctrine() |
100 | ->getRepository('WallabagCoreBundle:Entry') | 99 | ->getRepository('WallabagCoreBundle:Entry') |
101 | ->findUnreadByUser($this->getUser()->getId(), 0); | 100 | ->findUnreadByUser($this->getUser()->getId()); |
101 | |||
102 | $entries->setCurrentPage($page); | ||
102 | 103 | ||
103 | return $this->render( | 104 | return $this->render( |
104 | 'WallabagCoreBundle:Entry:entries.html.twig', | 105 | 'WallabagCoreBundle:Entry:entries.html.twig', |
105 | array('entries' => $entries) | 106 | array( |
107 | 'entries' => $entries, | ||
108 | 'currentPage' => $page | ||
109 | ) | ||
106 | ); | 110 | ); |
107 | } | 111 | } |
108 | 112 | ||
109 | /** | 113 | /** |
110 | * Shows read entries for current user. | 114 | * Shows read entries for current user. |
111 | * | 115 | * |
112 | * @Route("/archive", name="archive") | 116 | * @Route("/archive/list/{page}", name="archive", defaults={"page" = "1"}) |
113 | * | 117 | * |
114 | * @return \Symfony\Component\HttpFoundation\Response | 118 | * @return \Symfony\Component\HttpFoundation\Response |
115 | */ | 119 | */ |
116 | public function showArchiveAction() | 120 | public function showArchiveAction($page) |
117 | { | 121 | { |
118 | // TODO change pagination | ||
119 | $entries = $this->getDoctrine() | 122 | $entries = $this->getDoctrine() |
120 | ->getRepository('WallabagCoreBundle:Entry') | 123 | ->getRepository('WallabagCoreBundle:Entry') |
121 | ->findArchiveByUser($this->getUser()->getId(), 0); | 124 | ->findArchiveByUser($this->getUser()->getId()); |
125 | |||
126 | $entries->setCurrentPage($page); | ||
122 | 127 | ||
123 | return $this->render( | 128 | return $this->render( |
124 | 'WallabagCoreBundle:Entry:entries.html.twig', | 129 | 'WallabagCoreBundle:Entry:entries.html.twig', |
125 | array('entries' => $entries) | 130 | array( |
131 | 'entries' => $entries, | ||
132 | 'currentPage' => $page | ||
133 | ) | ||
126 | ); | 134 | ); |
127 | } | 135 | } |
128 | 136 | ||
129 | /** | 137 | /** |
130 | * Shows starred entries for current user. | 138 | * Shows starred entries for current user. |
131 | * | 139 | * |
132 | * @Route("/starred", name="starred") | 140 | * @Route("/starred/list/{page}", name="starred", defaults={"page" = "1"}) |
133 | * | 141 | * |
134 | * @return \Symfony\Component\HttpFoundation\Response | 142 | * @return \Symfony\Component\HttpFoundation\Response |
135 | */ | 143 | */ |
136 | public function showStarredAction() | 144 | public function showStarredAction($page) |
137 | { | 145 | { |
138 | // TODO change pagination | ||
139 | $entries = $this->getDoctrine() | 146 | $entries = $this->getDoctrine() |
140 | ->getRepository('WallabagCoreBundle:Entry') | 147 | ->getRepository('WallabagCoreBundle:Entry') |
141 | ->findStarredByUser($this->getUser()->getId(), 0); | 148 | ->findStarredByUser($this->getUser()->getId()); |
149 | |||
150 | $entries->setCurrentPage($page); | ||
142 | 151 | ||
143 | return $this->render( | 152 | return $this->render( |
144 | 'WallabagCoreBundle:Entry:entries.html.twig', | 153 | 'WallabagCoreBundle:Entry:entries.html.twig', |
145 | array('entries' => $entries) | 154 | array( |
155 | 'entries' => $entries, | ||
156 | 'currentPage' => $page | ||
157 | ) | ||
146 | ); | 158 | ); |
147 | } | 159 | } |
148 | 160 | ||