diff options
18 files changed, 170 insertions, 11 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index ac372a33..6c843ba7 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | namespace Wallabag\CoreBundle\Controller; | 3 | namespace Wallabag\CoreBundle\Controller; |
4 | 4 | ||
5 | use Doctrine\ORM\NoResultException; | ||
5 | use Pagerfanta\Adapter\DoctrineORMAdapter; | 6 | use Pagerfanta\Adapter\DoctrineORMAdapter; |
6 | use Pagerfanta\Exception\OutOfRangeCurrentPageException; | 7 | use Pagerfanta\Exception\OutOfRangeCurrentPageException; |
7 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; | 8 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; |
@@ -233,6 +234,110 @@ class EntryController extends Controller | |||
233 | } | 234 | } |
234 | 235 | ||
235 | /** | 236 | /** |
237 | * Shows random unread entry. | ||
238 | * | ||
239 | * @param Entry $entry | ||
240 | * | ||
241 | * @Route("/unread/random", name="unread_random") | ||
242 | * | ||
243 | * @return \Symfony\Component\HttpFoundation\Response | ||
244 | */ | ||
245 | public function showRandomUnreadEntryAction() | ||
246 | { | ||
247 | $repository = $this->get('wallabag_core.entry_repository'); | ||
248 | |||
249 | try { | ||
250 | $entry = $repository->getRandomEntry($this->getUser()->getId(), 'unread'); | ||
251 | } catch (NoResultException $e) { | ||
252 | $bag = $this->get('session')->getFlashBag(); | ||
253 | $bag->clear(); | ||
254 | $bag->add('notice', 'flashes.entry.notice.no_random_entry'); | ||
255 | |||
256 | return $this->redirect($this->generateUrl('homepage')); | ||
257 | } | ||
258 | |||
259 | return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()])); | ||
260 | } | ||
261 | |||
262 | /** | ||
263 | * Shows random favorite entry. | ||
264 | * | ||
265 | * @param Entry $entry | ||
266 | * | ||
267 | * @Route("/starred/random", name="starred_random") | ||
268 | * | ||
269 | * @return \Symfony\Component\HttpFoundation\Response | ||
270 | */ | ||
271 | public function showRandomStarredEntryAction() | ||
272 | { | ||
273 | $repository = $this->get('wallabag_core.entry_repository'); | ||
274 | |||
275 | try { | ||
276 | $entry = $repository->getRandomEntry($this->getUser()->getId(), 'starred'); | ||
277 | } catch (NoResultException $e) { | ||
278 | $bag = $this->get('session')->getFlashBag(); | ||
279 | $bag->clear(); | ||
280 | $bag->add('notice', 'flashes.entry.notice.no_random_entry'); | ||
281 | |||
282 | return $this->redirect($this->generateUrl('homepage')); | ||
283 | } | ||
284 | |||
285 | return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()])); | ||
286 | } | ||
287 | |||
288 | /** | ||
289 | * Shows random archived entry. | ||
290 | * | ||
291 | * @param Entry $entry | ||
292 | * | ||
293 | * @Route("/archive/random", name="archive_random") | ||
294 | * | ||
295 | * @return \Symfony\Component\HttpFoundation\Response | ||
296 | */ | ||
297 | public function showRandomArchiveEntryAction() | ||
298 | { | ||
299 | $repository = $this->get('wallabag_core.entry_repository'); | ||
300 | |||
301 | try { | ||
302 | $entry = $repository->getRandomEntry($this->getUser()->getId(), 'starred'); | ||
303 | } catch (NoResultException $e) { | ||
304 | $bag = $this->get('session')->getFlashBag(); | ||
305 | $bag->clear(); | ||
306 | $bag->add('notice', 'flashes.entry.notice.no_random_entry'); | ||
307 | |||
308 | return $this->redirect($this->generateUrl('homepage')); | ||
309 | } | ||
310 | |||
311 | return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()])); | ||
312 | } | ||
313 | |||
314 | /** | ||
315 | * Shows random all entry. | ||
316 | * | ||
317 | * @param Entry $entry | ||
318 | * | ||
319 | * @Route("/all/random", name="all_random") | ||
320 | * | ||
321 | * @return \Symfony\Component\HttpFoundation\Response | ||
322 | */ | ||
323 | public function showRandomAllEntryAction() | ||
324 | { | ||
325 | $repository = $this->get('wallabag_core.entry_repository'); | ||
326 | |||
327 | try { | ||
328 | $entry = $repository->getRandomEntry($this->getUser()->getId()); | ||
329 | } catch (NoResultException $e) { | ||
330 | $bag = $this->get('session')->getFlashBag(); | ||
331 | $bag->clear(); | ||
332 | $bag->add('notice', 'flashes.entry.notice.no_random_entry'); | ||
333 | |||
334 | return $this->redirect($this->generateUrl('homepage')); | ||
335 | } | ||
336 | |||
337 | return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()])); | ||
338 | } | ||
339 | |||
340 | /** | ||
236 | * Shows entry content. | 341 | * Shows entry content. |
237 | * | 342 | * |
238 | * @param Entry $entry | 343 | * @param Entry $entry |
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 93c630c0..7fe090be 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -110,8 +110,7 @@ class EntryRepository extends EntityRepository | |||
110 | */ | 110 | */ |
111 | public function getBuilderForUntaggedByUser($userId) | 111 | public function getBuilderForUntaggedByUser($userId) |
112 | { | 112 | { |
113 | return $this | 113 | return $this->sortQueryBuilder($this->getRawBuilderForUntaggedByUser($userId)); |
114 | ->sortQueryBuilder($this->getRawBuilderForUntaggedByUser($userId)); | ||
115 | } | 114 | } |
116 | 115 | ||
117 | /** | 116 | /** |
@@ -429,6 +428,46 @@ class EntryRepository extends EntityRepository | |||
429 | } | 428 | } |
430 | 429 | ||
431 | /** | 430 | /** |
431 | * Returns a random entry, filtering by status. | ||
432 | * | ||
433 | * @param $userId | ||
434 | * @param string $status can be unread, archive or starred | ||
435 | * | ||
436 | * @throws \Doctrine\ORM\NoResultException | ||
437 | * @throws \Doctrine\ORM\NonUniqueResultException | ||
438 | * | ||
439 | * @return Entry | ||
440 | */ | ||
441 | public function getRandomEntry($userId, $status = '') | ||
442 | { | ||
443 | $max = $this->getEntityManager() | ||
444 | ->createQuery('SELECT MAX(e.id) FROM Wallabag\CoreBundle\Entity\Entry e WHERE e.user = :userId') | ||
445 | ->setParameter('userId', $userId) | ||
446 | ->getSingleScalarResult(); | ||
447 | |||
448 | $qb = $this->createQueryBuilder('e') | ||
449 | ->where('e.user = :user_id')->setParameter('user_id', $userId); | ||
450 | |||
451 | if ('unread' === $status) { | ||
452 | $qb->andWhere('e.isArchived = false'); | ||
453 | } | ||
454 | |||
455 | if ('archive' === $status) { | ||
456 | $qb->andWhere('e.isArchived = true'); | ||
457 | } | ||
458 | |||
459 | if ('starred' === $status) { | ||
460 | $qb->andWhere('e.isStarred = true'); | ||
461 | } | ||
462 | |||
463 | return $qb->andWhere('e.id >= :rand') | ||
464 | ->setParameter('rand', rand(0, $max)) | ||
465 | ->setMaxResults(1) | ||
466 | ->getQuery() | ||
467 | ->getSingleResult(); | ||
468 | } | ||
469 | |||
470 | /** | ||
432 | * Return a query builder to be used by other getBuilderFor* method. | 471 | * Return a query builder to be used by other getBuilderFor* method. |
433 | * | 472 | * |
434 | * @param int $userId | 473 | * @param int $userId |
@@ -466,7 +505,6 @@ class EntryRepository extends EntityRepository | |||
466 | */ | 505 | */ |
467 | private function sortQueryBuilder(QueryBuilder $qb, $sortBy = 'createdAt', $direction = 'desc') | 506 | private function sortQueryBuilder(QueryBuilder $qb, $sortBy = 'createdAt', $direction = 'desc') |
468 | { | 507 | { |
469 | return $qb | 508 | return $qb->orderBy(sprintf('e.%s', $sortBy), $direction); |
470 | ->orderBy(sprintf('e.%s', $sortBy), $direction); | ||
471 | } | 509 | } |
472 | } | 510 | } |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index e1384675..8049d625 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml | |||
@@ -582,6 +582,7 @@ flashes: | |||
582 | entry_starred: 'Artikel markeret som favorit' | 582 | entry_starred: 'Artikel markeret som favorit' |
583 | entry_unstarred: 'Artikel ikke længere markeret som favorit' | 583 | entry_unstarred: 'Artikel ikke længere markeret som favorit' |
584 | entry_deleted: 'Artikel slettet' | 584 | entry_deleted: 'Artikel slettet' |
585 | # no_random_entry: 'No article with these criterias was found' | ||
585 | tag: | 586 | tag: |
586 | notice: | 587 | notice: |
587 | # tag_added: 'Tag added' | 588 | # tag_added: 'Tag added' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index c297ffb5..fcc0a415 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml | |||
@@ -582,6 +582,7 @@ flashes: | |||
582 | entry_starred: 'Eintrag favorisiert' | 582 | entry_starred: 'Eintrag favorisiert' |
583 | entry_unstarred: 'Eintrag defavorisiert' | 583 | entry_unstarred: 'Eintrag defavorisiert' |
584 | entry_deleted: 'Eintrag gelöscht' | 584 | entry_deleted: 'Eintrag gelöscht' |
585 | # no_random_entry: 'No article with these criterias was found' | ||
585 | tag: | 586 | tag: |
586 | notice: | 587 | notice: |
587 | tag_added: 'Tag hinzugefügt' | 588 | tag_added: 'Tag hinzugefügt' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index bd81c72f..e7418ed2 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml | |||
@@ -582,6 +582,7 @@ flashes: | |||
582 | entry_starred: 'Entry starred' | 582 | entry_starred: 'Entry starred' |
583 | entry_unstarred: 'Entry unstarred' | 583 | entry_unstarred: 'Entry unstarred' |
584 | entry_deleted: 'Entry deleted' | 584 | entry_deleted: 'Entry deleted' |
585 | no_random_entry: 'No article with these criterias was found' | ||
585 | tag: | 586 | tag: |
586 | notice: | 587 | notice: |
587 | tag_added: 'Tag added' | 588 | tag_added: 'Tag added' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index 700190a6..7c97e2d8 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml | |||
@@ -582,6 +582,7 @@ flashes: | |||
582 | entry_starred: 'Artículo marcado como favorito' | 582 | entry_starred: 'Artículo marcado como favorito' |
583 | entry_unstarred: 'Artículo desmarcado como favorito' | 583 | entry_unstarred: 'Artículo desmarcado como favorito' |
584 | entry_deleted: 'Artículo eliminado' | 584 | entry_deleted: 'Artículo eliminado' |
585 | # no_random_entry: 'No article with these criterias was found' | ||
585 | tag: | 586 | tag: |
586 | notice: | 587 | notice: |
587 | tag_added: 'Etiqueta añadida' | 588 | tag_added: 'Etiqueta añadida' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index 83645933..fc23f927 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml | |||
@@ -582,6 +582,7 @@ flashes: | |||
582 | entry_starred: 'مقاله برگزیده شد' | 582 | entry_starred: 'مقاله برگزیده شد' |
583 | entry_unstarred: 'مقاله نابرگزیده شد' | 583 | entry_unstarred: 'مقاله نابرگزیده شد' |
584 | entry_deleted: 'مقاله پاک شد' | 584 | entry_deleted: 'مقاله پاک شد' |
585 | # no_random_entry: 'No article with these criterias was found' | ||
585 | tag: | 586 | tag: |
586 | notice: | 587 | notice: |
587 | tag_added: 'برچسب افزوده شد' | 588 | tag_added: 'برچسب افزوده شد' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index edf29654..1c5fb5c8 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | |||
@@ -582,6 +582,7 @@ flashes: | |||
582 | entry_starred: "Article ajouté dans les favoris" | 582 | entry_starred: "Article ajouté dans les favoris" |
583 | entry_unstarred: "Article retiré des favoris" | 583 | entry_unstarred: "Article retiré des favoris" |
584 | entry_deleted: "Article supprimé" | 584 | entry_deleted: "Article supprimé" |
585 | no_random_entry: "Aucun article correspond aux critères n'a été trouvé" | ||
585 | tag: | 586 | tag: |
586 | notice: | 587 | notice: |
587 | tag_added: "Tag ajouté" | 588 | tag_added: "Tag ajouté" |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index 47292116..7ea0b7ea 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml | |||
@@ -582,6 +582,7 @@ flashes: | |||
582 | entry_starred: 'Contenuto segnato come preferito' | 582 | entry_starred: 'Contenuto segnato come preferito' |
583 | entry_unstarred: 'Contenuto rimosso dai preferiti' | 583 | entry_unstarred: 'Contenuto rimosso dai preferiti' |
584 | entry_deleted: 'Contenuto eliminato' | 584 | entry_deleted: 'Contenuto eliminato' |
585 | # no_random_entry: 'No article with these criterias was found' | ||
585 | tag: | 586 | tag: |
586 | notice: | 587 | notice: |
587 | tag_added: 'Etichetta aggiunta' | 588 | tag_added: 'Etichetta aggiunta' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index 95bc9560..4fd74fd8 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml | |||
@@ -582,6 +582,7 @@ flashes: | |||
582 | entry_starred: 'Article ajustat dins los favorits' | 582 | entry_starred: 'Article ajustat dins los favorits' |
583 | entry_unstarred: 'Article quitat dels favorits' | 583 | entry_unstarred: 'Article quitat dels favorits' |
584 | entry_deleted: 'Article suprimit' | 584 | entry_deleted: 'Article suprimit' |
585 | # no_random_entry: 'No article with these criterias was found' | ||
585 | tag: | 586 | tag: |
586 | notice: | 587 | notice: |
587 | tag_added: 'Etiqueta ajustada' | 588 | tag_added: 'Etiqueta ajustada' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index a64e60b0..37b31aab 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml | |||
@@ -582,6 +582,7 @@ flashes: | |||
582 | entry_starred: 'Wpis oznaczony gwiazdką' | 582 | entry_starred: 'Wpis oznaczony gwiazdką' |
583 | entry_unstarred: 'Wpis odznaczony gwiazdką' | 583 | entry_unstarred: 'Wpis odznaczony gwiazdką' |
584 | entry_deleted: 'Wpis usunięty' | 584 | entry_deleted: 'Wpis usunięty' |
585 | # no_random_entry: 'No article with these criterias was found' | ||
585 | tag: | 586 | tag: |
586 | notice: | 587 | notice: |
587 | tag_added: 'Tag dodany' | 588 | tag_added: 'Tag dodany' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml index 7aef9694..ff7f2b49 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml | |||
@@ -582,6 +582,7 @@ flashes: | |||
582 | entry_starred: 'Entrada destacada' | 582 | entry_starred: 'Entrada destacada' |
583 | entry_unstarred: 'Entrada não destacada' | 583 | entry_unstarred: 'Entrada não destacada' |
584 | entry_deleted: 'Entrada apagada' | 584 | entry_deleted: 'Entrada apagada' |
585 | # no_random_entry: 'No article with these criterias was found' | ||
585 | tag: | 586 | tag: |
586 | notice: | 587 | notice: |
587 | tag_added: 'Tag adicionada' | 588 | tag_added: 'Tag adicionada' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index 9b7068c6..51fed69c 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml | |||
@@ -582,6 +582,7 @@ flashes: | |||
582 | entry_starred: 'Articol adăugat la favorite' | 582 | entry_starred: 'Articol adăugat la favorite' |
583 | entry_unstarred: 'Articol șters de la favorite' | 583 | entry_unstarred: 'Articol șters de la favorite' |
584 | entry_deleted: 'Articol șters' | 584 | entry_deleted: 'Articol șters' |
585 | # no_random_entry: 'No article with these criterias was found' | ||
585 | tag: | 586 | tag: |
586 | notice: | 587 | notice: |
587 | # tag_added: 'Tag added' | 588 | # tag_added: 'Tag added' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml index 5f210c93..f3506d43 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml | |||
@@ -544,6 +544,7 @@ flashes: | |||
544 | entry_starred: 'Запись помечена звездочкой' | 544 | entry_starred: 'Запись помечена звездочкой' |
545 | entry_unstarred: 'Пометка звездочкой у записи убрана' | 545 | entry_unstarred: 'Пометка звездочкой у записи убрана' |
546 | entry_deleted: 'Запись удалена' | 546 | entry_deleted: 'Запись удалена' |
547 | # no_random_entry: 'No article with these criterias was found' | ||
547 | tag: | 548 | tag: |
548 | notice: | 549 | notice: |
549 | tag_added: 'Тег добавлен' | 550 | tag_added: 'Тег добавлен' |
@@ -564,4 +565,4 @@ flashes: | |||
564 | notice: | 565 | notice: |
565 | added: 'Пользователь "%username%" добавлен' | 566 | added: 'Пользователь "%username%" добавлен' |
566 | updated: 'Пользователь "%username%" обновлен' | 567 | updated: 'Пользователь "%username%" обновлен' |
567 | deleted: 'Пользователь "%username%" удален' \ No newline at end of file | 568 | deleted: 'Пользователь "%username%" удален' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml index 9d22f90d..f231e79a 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml | |||
@@ -580,6 +580,7 @@ flashes: | |||
580 | entry_starred: 'รายการที่แสดง' | 580 | entry_starred: 'รายการที่แสดง' |
581 | entry_unstarred: 'รายการที่ไม่ได้แสดง' | 581 | entry_unstarred: 'รายการที่ไม่ได้แสดง' |
582 | entry_deleted: 'รายการที่ถูกลบ' | 582 | entry_deleted: 'รายการที่ถูกลบ' |
583 | # no_random_entry: 'No article with these criterias was found' | ||
583 | tag: | 584 | tag: |
584 | notice: | 585 | notice: |
585 | tag_added: 'แท็กที่เพิ่ม' | 586 | tag_added: 'แท็กที่เพิ่ม' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index 5c95fe63..148047a0 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml | |||
@@ -560,6 +560,7 @@ flashes: | |||
560 | entry_starred: 'Makale favorilere eklendi' | 560 | entry_starred: 'Makale favorilere eklendi' |
561 | entry_unstarred: 'Makale favorilerden çıkartıldı' | 561 | entry_unstarred: 'Makale favorilerden çıkartıldı' |
562 | entry_deleted: 'Makale silindi' | 562 | entry_deleted: 'Makale silindi' |
563 | # no_random_entry: 'No article with these criterias was found' | ||
563 | tag: | 564 | tag: |
564 | notice: | 565 | notice: |
565 | tag_added: 'Etiket eklendi' | 566 | tag_added: 'Etiket eklendi' |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig index adc704bb..ac2e6688 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig | |||
@@ -20,11 +20,15 @@ | |||
20 | 20 | ||
21 | {% block content %} | 21 | {% block content %} |
22 | {% set currentRoute = app.request.attributes.get('_route') %} | 22 | {% set currentRoute = app.request.attributes.get('_route') %} |
23 | {% if currentRoute == 'homepage' %} | ||
24 | {% set currentRoute = 'unread' %} | ||
25 | {% endif %} | ||
23 | {% set listMode = app.user.config.listMode %} | 26 | {% set listMode = app.user.config.listMode %} |
24 | <div class="results"> | 27 | <div class="results"> |
25 | <div class="nb-results">{{ 'entry.list.number_on_the_page'|transchoice(entries.count) }}</div> | 28 | <div class="nb-results">{{ 'entry.list.number_on_the_page'|transchoice(entries.count) }}</div> |
26 | <div class="pagination"> | 29 | <div class="pagination"> |
27 | <a href="{{ path('switch_view_mode') }}"><i class="listMode-btn material-icons md-24">{% if listMode == 0 %}list{% else %}view_module{% endif %}</i></a> | 30 | <a href="{{ path('switch_view_mode') }}"><i class="listMode-btn material-icons md-24">{% if listMode == 0 %}list{% else %}view_module{% endif %}</i></a> |
31 | <a href="{{ path(currentRoute ~ '_random') }}">random</a> | ||
28 | {% if app.user.config.rssToken %} | 32 | {% if app.user.config.rssToken %} |
29 | {% include "@WallabagCore/themes/common/Entry/_rss_link.html.twig" %} | 33 | {% include "@WallabagCore/themes/common/Entry/_rss_link.html.twig" %} |
30 | {% endif %} | 34 | {% endif %} |
@@ -90,9 +94,6 @@ | |||
90 | {% if tag is defined %} | 94 | {% if tag is defined %} |
91 | {% set currentTag = tag %} | 95 | {% set currentTag = tag %} |
92 | {% endif %} | 96 | {% endif %} |
93 | {% if currentRoute == 'homepage' %} | ||
94 | {% set currentRoute = 'unread' %} | ||
95 | {% endif %} | ||
96 | <h2>{{ 'entry.list.export_title'|trans }}</h2> | 97 | <h2>{{ 'entry.list.export_title'|trans }}</h2> |
97 | <a href="javascript: void(null);" id="download-form-close" class="close-button--popup close-button">×</a> | 98 | <a href="javascript: void(null);" id="download-form-close" class="close-button--popup close-button">×</a> |
98 | <ul> | 99 | <ul> |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig index e883503e..586cd7b1 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig | |||
@@ -21,10 +21,14 @@ | |||
21 | {% block content %} | 21 | {% block content %} |
22 | {% set listMode = app.user.config.listMode %} | 22 | {% set listMode = app.user.config.listMode %} |
23 | {% set currentRoute = app.request.attributes.get('_route') %} | 23 | {% set currentRoute = app.request.attributes.get('_route') %} |
24 | {% if currentRoute == 'homepage' %} | ||
25 | {% set currentRoute = 'unread' %} | ||
26 | {% endif %} | ||
24 | <div class="results"> | 27 | <div class="results"> |
25 | <div class="nb-results"> | 28 | <div class="nb-results"> |
26 | {{ 'entry.list.number_on_the_page'|transchoice(entries.count) }} | 29 | {{ 'entry.list.number_on_the_page'|transchoice(entries.count) }} |
27 | <a href="{{ path('switch_view_mode') }}"><i class="material-icons">{% if listMode == 0 %}view_list{% else %}view_module{% endif %}</i></a> | 30 | <a href="{{ path('switch_view_mode') }}"><i class="material-icons">{% if listMode == 0 %}view_list{% else %}view_module{% endif %}</i></a> |
31 | <a href="{{ path(currentRoute ~ '_random') }}">random</a> | ||
28 | {% if app.user.config.rssToken %} | 32 | {% if app.user.config.rssToken %} |
29 | {% include "@WallabagCore/themes/common/Entry/_rss_link.html.twig" %} | 33 | {% include "@WallabagCore/themes/common/Entry/_rss_link.html.twig" %} |
30 | {% endif %} | 34 | {% endif %} |
@@ -62,9 +66,6 @@ | |||
62 | {% if tag is defined %} | 66 | {% if tag is defined %} |
63 | {% set currentTag = tag.slug %} | 67 | {% set currentTag = tag.slug %} |
64 | {% endif %} | 68 | {% endif %} |
65 | {% if currentRoute == 'homepage' %} | ||
66 | {% set currentRoute = 'unread' %} | ||
67 | {% endif %} | ||
68 | <h4 class="center">{{ 'entry.list.export_title'|trans }}</h4> | 69 | <h4 class="center">{{ 'entry.list.export_title'|trans }}</h4> |
69 | <ul> | 70 | <ul> |
70 | {% if craue_setting('export_epub') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'epub', 'tag' : currentTag }) }}">EPUB</a></li>{% endif %} | 71 | {% if craue_setting('export_epub') %}<li class="bold"><a class="waves-effect" href="{{ path('export_entries', { 'category': currentRoute, 'format': 'epub', 'tag' : currentTag }) }}">EPUB</a></li>{% endif %} |