diff options
author | Nicolas Lœuillet <nicolas@loeuillet.org> | 2017-12-22 15:44:00 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2019-01-19 21:09:32 +0100 |
commit | 09ef25c3c3882db94b3941f3ba33ebc78b5dbe4d (patch) | |
tree | 380f1b23be485b58c58052b22877054b7481c0b1 | |
parent | c73025ad8b684de1ac21ba7583f1af6f1d185159 (diff) | |
download | wallabag-09ef25c3c3882db94b3941f3ba33ebc78b5dbe4d.tar.gz wallabag-09ef25c3c3882db94b3941f3ba33ebc78b5dbe4d.tar.zst wallabag-09ef25c3c3882db94b3941f3ba33ebc78b5dbe4d.zip |
Added random feature
18 files changed, 169 insertions, 10 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 8b6cf443..a26de0a8 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 | /** |
@@ -433,6 +432,46 @@ class EntryRepository extends EntityRepository | |||
433 | } | 432 | } |
434 | 433 | ||
435 | /** | 434 | /** |
435 | * Returns a random entry, filtering by status. | ||
436 | * | ||
437 | * @param $userId | ||
438 | * @param string $status can be unread, archive or starred | ||
439 | * | ||
440 | * @throws \Doctrine\ORM\NoResultException | ||
441 | * @throws \Doctrine\ORM\NonUniqueResultException | ||
442 | * | ||
443 | * @return Entry | ||
444 | */ | ||
445 | public function getRandomEntry($userId, $status = '') | ||
446 | { | ||
447 | $max = $this->getEntityManager() | ||
448 | ->createQuery('SELECT MAX(e.id) FROM Wallabag\CoreBundle\Entity\Entry e WHERE e.user = :userId') | ||
449 | ->setParameter('userId', $userId) | ||
450 | ->getSingleScalarResult(); | ||
451 | |||
452 | $qb = $this->createQueryBuilder('e') | ||
453 | ->where('e.user = :user_id')->setParameter('user_id', $userId); | ||
454 | |||
455 | if ('unread' === $status) { | ||
456 | $qb->andWhere('e.isArchived = false'); | ||
457 | } | ||
458 | |||
459 | if ('archive' === $status) { | ||
460 | $qb->andWhere('e.isArchived = true'); | ||
461 | } | ||
462 | |||
463 | if ('starred' === $status) { | ||
464 | $qb->andWhere('e.isStarred = true'); | ||
465 | } | ||
466 | |||
467 | return $qb->andWhere('e.id >= :rand') | ||
468 | ->setParameter('rand', rand(0, $max)) | ||
469 | ->setMaxResults(1) | ||
470 | ->getQuery() | ||
471 | ->getSingleResult(); | ||
472 | } | ||
473 | |||
474 | /** | ||
436 | * Return a query builder to be used by other getBuilderFor* method. | 475 | * Return a query builder to be used by other getBuilderFor* method. |
437 | * | 476 | * |
438 | * @param int $userId | 477 | * @param int $userId |
@@ -470,7 +509,6 @@ class EntryRepository extends EntityRepository | |||
470 | */ | 509 | */ |
471 | private function sortQueryBuilder(QueryBuilder $qb, $sortBy = 'createdAt', $direction = 'desc') | 510 | private function sortQueryBuilder(QueryBuilder $qb, $sortBy = 'createdAt', $direction = 'desc') |
472 | { | 511 | { |
473 | return $qb | 512 | return $qb->orderBy(sprintf('e.%s', $sortBy), $direction); |
474 | ->orderBy(sprintf('e.%s', $sortBy), $direction); | ||
475 | } | 513 | } |
476 | } | 514 | } |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index 4cf69916..0099148a 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml | |||
@@ -590,6 +590,7 @@ flashes: | |||
590 | entry_starred: 'Artikel markeret som favorit' | 590 | entry_starred: 'Artikel markeret som favorit' |
591 | entry_unstarred: 'Artikel ikke længere markeret som favorit' | 591 | entry_unstarred: 'Artikel ikke længere markeret som favorit' |
592 | entry_deleted: 'Artikel slettet' | 592 | entry_deleted: 'Artikel slettet' |
593 | # no_random_entry: 'No article with these criterias was found' | ||
593 | tag: | 594 | tag: |
594 | notice: | 595 | notice: |
595 | # tag_added: 'Tag added' | 596 | # 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 10981788..5e531b78 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml | |||
@@ -590,6 +590,7 @@ flashes: | |||
590 | entry_starred: 'Eintrag favorisiert' | 590 | entry_starred: 'Eintrag favorisiert' |
591 | entry_unstarred: 'Eintrag defavorisiert' | 591 | entry_unstarred: 'Eintrag defavorisiert' |
592 | entry_deleted: 'Eintrag gelöscht' | 592 | entry_deleted: 'Eintrag gelöscht' |
593 | # no_random_entry: 'No article with these criterias was found' | ||
593 | tag: | 594 | tag: |
594 | notice: | 595 | notice: |
595 | tag_added: 'Tag hinzugefügt' | 596 | 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 95e10faf..2b952bd5 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml | |||
@@ -590,6 +590,7 @@ flashes: | |||
590 | entry_starred: 'Entry starred' | 590 | entry_starred: 'Entry starred' |
591 | entry_unstarred: 'Entry unstarred' | 591 | entry_unstarred: 'Entry unstarred' |
592 | entry_deleted: 'Entry deleted' | 592 | entry_deleted: 'Entry deleted' |
593 | no_random_entry: 'No article with these criterias was found' | ||
593 | tag: | 594 | tag: |
594 | notice: | 595 | notice: |
595 | tag_added: 'Tag added' | 596 | 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 c95bee5b..2e2fbb93 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml | |||
@@ -590,6 +590,7 @@ flashes: | |||
590 | entry_starred: 'Artículo marcado como favorito' | 590 | entry_starred: 'Artículo marcado como favorito' |
591 | entry_unstarred: 'Artículo desmarcado como favorito' | 591 | entry_unstarred: 'Artículo desmarcado como favorito' |
592 | entry_deleted: 'Artículo eliminado' | 592 | entry_deleted: 'Artículo eliminado' |
593 | # no_random_entry: 'No article with these criterias was found' | ||
593 | tag: | 594 | tag: |
594 | notice: | 595 | notice: |
595 | tag_added: 'Etiqueta añadida' | 596 | 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 4fde53dd..c58bbccb 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml | |||
@@ -590,6 +590,7 @@ flashes: | |||
590 | entry_starred: 'مقاله برگزیده شد' | 590 | entry_starred: 'مقاله برگزیده شد' |
591 | entry_unstarred: 'مقاله نابرگزیده شد' | 591 | entry_unstarred: 'مقاله نابرگزیده شد' |
592 | entry_deleted: 'مقاله پاک شد' | 592 | entry_deleted: 'مقاله پاک شد' |
593 | # no_random_entry: 'No article with these criterias was found' | ||
593 | tag: | 594 | tag: |
594 | notice: | 595 | notice: |
595 | tag_added: 'برچسب افزوده شد' | 596 | tag_added: 'برچسب افزوده شد' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index edf3ac35..c3887f24 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | |||
@@ -590,6 +590,7 @@ flashes: | |||
590 | entry_starred: "Article ajouté dans les favoris" | 590 | entry_starred: "Article ajouté dans les favoris" |
591 | entry_unstarred: "Article retiré des favoris" | 591 | entry_unstarred: "Article retiré des favoris" |
592 | entry_deleted: "Article supprimé" | 592 | entry_deleted: "Article supprimé" |
593 | no_random_entry: "Aucun article correspond aux critères n'a été trouvé" | ||
593 | tag: | 594 | tag: |
594 | notice: | 595 | notice: |
595 | tag_added: "Tag ajouté" | 596 | 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 f178ddbf..c2135ac0 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml | |||
@@ -590,6 +590,7 @@ flashes: | |||
590 | entry_starred: 'Contenuto segnato come preferito' | 590 | entry_starred: 'Contenuto segnato come preferito' |
591 | entry_unstarred: 'Contenuto rimosso dai preferiti' | 591 | entry_unstarred: 'Contenuto rimosso dai preferiti' |
592 | entry_deleted: 'Contenuto eliminato' | 592 | entry_deleted: 'Contenuto eliminato' |
593 | # no_random_entry: 'No article with these criterias was found' | ||
593 | tag: | 594 | tag: |
594 | notice: | 595 | notice: |
595 | tag_added: 'Etichetta aggiunta' | 596 | 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 a1220f52..6e2c1cf9 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml | |||
@@ -590,6 +590,7 @@ flashes: | |||
590 | entry_starred: 'Article ajustat dins los favorits' | 590 | entry_starred: 'Article ajustat dins los favorits' |
591 | entry_unstarred: 'Article quitat dels favorits' | 591 | entry_unstarred: 'Article quitat dels favorits' |
592 | entry_deleted: 'Article suprimit' | 592 | entry_deleted: 'Article suprimit' |
593 | # no_random_entry: 'No article with these criterias was found' | ||
593 | tag: | 594 | tag: |
594 | notice: | 595 | notice: |
595 | tag_added: 'Etiqueta ajustada' | 596 | 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 b6f7faf7..18156cbe 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml | |||
@@ -590,6 +590,7 @@ flashes: | |||
590 | entry_starred: 'Wpis oznaczony gwiazdką' | 590 | entry_starred: 'Wpis oznaczony gwiazdką' |
591 | entry_unstarred: 'Wpis odznaczony gwiazdką' | 591 | entry_unstarred: 'Wpis odznaczony gwiazdką' |
592 | entry_deleted: 'Wpis usunięty' | 592 | entry_deleted: 'Wpis usunięty' |
593 | # no_random_entry: 'No article with these criterias was found' | ||
593 | tag: | 594 | tag: |
594 | notice: | 595 | notice: |
595 | tag_added: 'Tag dodany' | 596 | 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 78df254f..8493af47 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml | |||
@@ -590,6 +590,7 @@ flashes: | |||
590 | entry_starred: 'Entrada destacada' | 590 | entry_starred: 'Entrada destacada' |
591 | entry_unstarred: 'Entrada não destacada' | 591 | entry_unstarred: 'Entrada não destacada' |
592 | entry_deleted: 'Entrada apagada' | 592 | entry_deleted: 'Entrada apagada' |
593 | # no_random_entry: 'No article with these criterias was found' | ||
593 | tag: | 594 | tag: |
594 | notice: | 595 | notice: |
595 | tag_added: 'Tag adicionada' | 596 | 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 8312ca15..8fba13dc 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml | |||
@@ -590,6 +590,7 @@ flashes: | |||
590 | entry_starred: 'Articol adăugat la favorite' | 590 | entry_starred: 'Articol adăugat la favorite' |
591 | entry_unstarred: 'Articol șters de la favorite' | 591 | entry_unstarred: 'Articol șters de la favorite' |
592 | entry_deleted: 'Articol șters' | 592 | entry_deleted: 'Articol șters' |
593 | # no_random_entry: 'No article with these criterias was found' | ||
593 | tag: | 594 | tag: |
594 | notice: | 595 | notice: |
595 | # tag_added: 'Tag added' | 596 | # 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 f14aad12..56a63b14 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml | |||
@@ -555,6 +555,7 @@ flashes: | |||
555 | entry_starred: 'Запись помечена звездочкой' | 555 | entry_starred: 'Запись помечена звездочкой' |
556 | entry_unstarred: 'Пометка звездочкой у записи убрана' | 556 | entry_unstarred: 'Пометка звездочкой у записи убрана' |
557 | entry_deleted: 'Запись удалена' | 557 | entry_deleted: 'Запись удалена' |
558 | # no_random_entry: 'No article with these criterias was found' | ||
558 | tag: | 559 | tag: |
559 | notice: | 560 | notice: |
560 | tag_added: 'Тег добавлен' | 561 | tag_added: 'Тег добавлен' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml index 7dbb1399..9f0a6532 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml | |||
@@ -588,6 +588,7 @@ flashes: | |||
588 | entry_starred: 'รายการที่แสดง' | 588 | entry_starred: 'รายการที่แสดง' |
589 | entry_unstarred: 'รายการที่ไม่ได้แสดง' | 589 | entry_unstarred: 'รายการที่ไม่ได้แสดง' |
590 | entry_deleted: 'รายการที่ถูกลบ' | 590 | entry_deleted: 'รายการที่ถูกลบ' |
591 | # no_random_entry: 'No article with these criterias was found' | ||
591 | tag: | 592 | tag: |
592 | notice: | 593 | notice: |
593 | tag_added: 'แท็กที่เพิ่ม' | 594 | tag_added: 'แท็กที่เพิ่ม' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index b4bc04d0..a2093223 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml | |||
@@ -568,6 +568,7 @@ flashes: | |||
568 | entry_starred: 'Makale favorilere eklendi' | 568 | entry_starred: 'Makale favorilere eklendi' |
569 | entry_unstarred: 'Makale favorilerden çıkartıldı' | 569 | entry_unstarred: 'Makale favorilerden çıkartıldı' |
570 | entry_deleted: 'Makale silindi' | 570 | entry_deleted: 'Makale silindi' |
571 | # no_random_entry: 'No article with these criterias was found' | ||
571 | tag: | 572 | tag: |
572 | notice: | 573 | notice: |
573 | tag_added: 'Etiket eklendi' | 574 | 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 832112be..7108efbd 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 742dd330..5deda0fc 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 %} |
@@ -60,9 +64,6 @@ | |||
60 | {% if tag is defined %} | 64 | {% if tag is defined %} |
61 | {% set currentTag = tag.slug %} | 65 | {% set currentTag = tag.slug %} |
62 | {% endif %} | 66 | {% endif %} |
63 | {% if currentRoute == 'homepage' %} | ||
64 | {% set currentRoute = 'unread' %} | ||
65 | {% endif %} | ||
66 | <h4 class="center">{{ 'entry.list.export_title'|trans }}</h4> | 67 | <h4 class="center">{{ 'entry.list.export_title'|trans }}</h4> |
67 | <ul> | 68 | <ul> |
68 | {% 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 %} | 69 | {% 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 %} |