diff options
author | Kevin Decherf <kevin@kdecherf.com> | 2019-01-22 18:30:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-22 18:30:02 +0100 |
commit | 3527c300215e6e6010efb8bb840b8b6f5c63a1cc (patch) | |
tree | d3c23a18c966831ecd5f956d6365a2c7126c98c8 /src | |
parent | c73025ad8b684de1ac21ba7583f1af6f1d185159 (diff) | |
parent | fe5850d6e27f8cf20e7efc5c56672974b4779d9f (diff) | |
download | wallabag-3527c300215e6e6010efb8bb840b8b6f5c63a1cc.tar.gz wallabag-3527c300215e6e6010efb8bb840b8b6f5c63a1cc.tar.zst wallabag-3527c300215e6e6010efb8bb840b8b6f5c63a1cc.zip |
Merge pull request #3526 from wallabag/add-random-article
Add random feature
Diffstat (limited to 'src')
20 files changed, 171 insertions, 64 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index ac372a33..5c8ecb40 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,46 @@ class EntryController extends Controller | |||
233 | } | 234 | } |
234 | 235 | ||
235 | /** | 236 | /** |
237 | * Shows untagged articles for current user. | ||
238 | * | ||
239 | * @param Request $request | ||
240 | * @param int $page | ||
241 | * | ||
242 | * @Route("/untagged/list/{page}", name="untagged", defaults={"page" = "1"}) | ||
243 | * | ||
244 | * @return \Symfony\Component\HttpFoundation\Response | ||
245 | */ | ||
246 | public function showUntaggedEntriesAction(Request $request, $page) | ||
247 | { | ||
248 | return $this->showEntries('untagged', $request, $page); | ||
249 | } | ||
250 | |||
251 | /** | ||
252 | * Shows random entry depending on the given type. | ||
253 | * | ||
254 | * @param string $type | ||
255 | * | ||
256 | * @Route("/{type}/random", name="random_entry", requirements={"type": "unread|starred|archive|untagged|all"}) | ||
257 | * | ||
258 | * @return \Symfony\Component\HttpFoundation\RedirectResponse | ||
259 | */ | ||
260 | public function redirectRandomEntryAction($type = 'all') | ||
261 | { | ||
262 | try { | ||
263 | $entry = $this->get('wallabag_core.entry_repository') | ||
264 | ->getRandomEntry($this->getUser()->getId(), $type); | ||
265 | } catch (NoResultException $e) { | ||
266 | $bag = $this->get('session')->getFlashBag(); | ||
267 | $bag->clear(); | ||
268 | $bag->add('notice', 'flashes.entry.notice.no_random_entry'); | ||
269 | |||
270 | return $this->redirect($this->generateUrl($type)); | ||
271 | } | ||
272 | |||
273 | return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()])); | ||
274 | } | ||
275 | |||
276 | /** | ||
236 | * Shows entry content. | 277 | * Shows entry content. |
237 | * | 278 | * |
238 | * @param Entry $entry | 279 | * @param Entry $entry |
@@ -466,54 +507,6 @@ class EntryController extends Controller | |||
466 | } | 507 | } |
467 | 508 | ||
468 | /** | 509 | /** |
469 | * Shows untagged articles for current user. | ||
470 | * | ||
471 | * @param Request $request | ||
472 | * @param int $page | ||
473 | * | ||
474 | * @Route("/untagged/list/{page}", name="untagged", defaults={"page" = "1"}) | ||
475 | * | ||
476 | * @return \Symfony\Component\HttpFoundation\Response | ||
477 | */ | ||
478 | public function showUntaggedEntriesAction(Request $request, $page) | ||
479 | { | ||
480 | return $this->showEntries('untagged', $request, $page); | ||
481 | } | ||
482 | |||
483 | /** | ||
484 | * Fetch content and update entry. | ||
485 | * In case it fails, $entry->getContent will return an error message. | ||
486 | * | ||
487 | * @param Entry $entry | ||
488 | * @param string $prefixMessage Should be the translation key: entry_saved or entry_reloaded | ||
489 | */ | ||
490 | private function updateEntry(Entry $entry, $prefixMessage = 'entry_saved') | ||
491 | { | ||
492 | $message = 'flashes.entry.notice.' . $prefixMessage; | ||
493 | |||
494 | try { | ||
495 | $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl()); | ||
496 | } catch (\Exception $e) { | ||
497 | $this->get('logger')->error('Error while saving an entry', [ | ||
498 | 'exception' => $e, | ||
499 | 'entry' => $entry, | ||
500 | ]); | ||
501 | |||
502 | $message = 'flashes.entry.notice.' . $prefixMessage . '_failed'; | ||
503 | } | ||
504 | |||
505 | if (empty($entry->getDomainName())) { | ||
506 | $this->get('wallabag_core.content_proxy')->setEntryDomainName($entry); | ||
507 | } | ||
508 | |||
509 | if (empty($entry->getTitle())) { | ||
510 | $this->get('wallabag_core.content_proxy')->setDefaultEntryTitle($entry); | ||
511 | } | ||
512 | |||
513 | $this->get('session')->getFlashBag()->add('notice', $message); | ||
514 | } | ||
515 | |||
516 | /** | ||
517 | * Global method to retrieve entries depending on the given type | 510 | * Global method to retrieve entries depending on the given type |
518 | * It returns the response to be send. | 511 | * It returns the response to be send. |
519 | * | 512 | * |
@@ -586,6 +579,39 @@ class EntryController extends Controller | |||
586 | } | 579 | } |
587 | 580 | ||
588 | /** | 581 | /** |
582 | * Fetch content and update entry. | ||
583 | * In case it fails, $entry->getContent will return an error message. | ||
584 | * | ||
585 | * @param Entry $entry | ||
586 | * @param string $prefixMessage Should be the translation key: entry_saved or entry_reloaded | ||
587 | */ | ||
588 | private function updateEntry(Entry $entry, $prefixMessage = 'entry_saved') | ||
589 | { | ||
590 | $message = 'flashes.entry.notice.' . $prefixMessage; | ||
591 | |||
592 | try { | ||
593 | $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl()); | ||
594 | } catch (\Exception $e) { | ||
595 | $this->get('logger')->error('Error while saving an entry', [ | ||
596 | 'exception' => $e, | ||
597 | 'entry' => $entry, | ||
598 | ]); | ||
599 | |||
600 | $message = 'flashes.entry.notice.' . $prefixMessage . '_failed'; | ||
601 | } | ||
602 | |||
603 | if (empty($entry->getDomainName())) { | ||
604 | $this->get('wallabag_core.content_proxy')->setEntryDomainName($entry); | ||
605 | } | ||
606 | |||
607 | if (empty($entry->getTitle())) { | ||
608 | $this->get('wallabag_core.content_proxy')->setDefaultEntryTitle($entry); | ||
609 | } | ||
610 | |||
611 | $this->get('session')->getFlashBag()->add('notice', $message); | ||
612 | } | ||
613 | |||
614 | /** | ||
589 | * Check if the logged user can manage the given entry. | 615 | * Check if the logged user can manage the given entry. |
590 | * | 616 | * |
591 | * @param Entry $entry | 617 | * @param Entry $entry |
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 8b6cf443..45366623 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -3,6 +3,7 @@ | |||
3 | namespace Wallabag\CoreBundle\Repository; | 3 | namespace Wallabag\CoreBundle\Repository; |
4 | 4 | ||
5 | use Doctrine\ORM\EntityRepository; | 5 | use Doctrine\ORM\EntityRepository; |
6 | use Doctrine\ORM\NoResultException; | ||
6 | use Doctrine\ORM\QueryBuilder; | 7 | use Doctrine\ORM\QueryBuilder; |
7 | use Pagerfanta\Adapter\DoctrineORMAdapter; | 8 | use Pagerfanta\Adapter\DoctrineORMAdapter; |
8 | use Pagerfanta\Pagerfanta; | 9 | use Pagerfanta\Pagerfanta; |
@@ -110,8 +111,7 @@ class EntryRepository extends EntityRepository | |||
110 | */ | 111 | */ |
111 | public function getBuilderForUntaggedByUser($userId) | 112 | public function getBuilderForUntaggedByUser($userId) |
112 | { | 113 | { |
113 | return $this | 114 | return $this->sortQueryBuilder($this->getRawBuilderForUntaggedByUser($userId)); |
114 | ->sortQueryBuilder($this->getRawBuilderForUntaggedByUser($userId)); | ||
115 | } | 115 | } |
116 | 116 | ||
117 | /** | 117 | /** |
@@ -326,8 +326,8 @@ class EntryRepository extends EntityRepository | |||
326 | * Find an entry by its url and its owner. | 326 | * Find an entry by its url and its owner. |
327 | * If it exists, return the entry otherwise return false. | 327 | * If it exists, return the entry otherwise return false. |
328 | * | 328 | * |
329 | * @param $url | 329 | * @param string $url |
330 | * @param $userId | 330 | * @param int $userId |
331 | * | 331 | * |
332 | * @return Entry|bool | 332 | * @return Entry|bool |
333 | */ | 333 | */ |
@@ -418,8 +418,8 @@ class EntryRepository extends EntityRepository | |||
418 | /** | 418 | /** |
419 | * Find all entries by url and owner. | 419 | * Find all entries by url and owner. |
420 | * | 420 | * |
421 | * @param $url | 421 | * @param string $url |
422 | * @param $userId | 422 | * @param int $userId |
423 | * | 423 | * |
424 | * @return array | 424 | * @return array |
425 | */ | 425 | */ |
@@ -433,6 +433,49 @@ class EntryRepository extends EntityRepository | |||
433 | } | 433 | } |
434 | 434 | ||
435 | /** | 435 | /** |
436 | * Returns a random entry, filtering by status. | ||
437 | * | ||
438 | * @param int $userId | ||
439 | * @param string $type Can be unread, archive, starred, etc | ||
440 | * | ||
441 | * @throws NoResultException | ||
442 | * | ||
443 | * @return Entry | ||
444 | */ | ||
445 | public function getRandomEntry($userId, $type = '') | ||
446 | { | ||
447 | $qb = $this->getQueryBuilderByUser($userId) | ||
448 | ->select('e.id'); | ||
449 | |||
450 | switch ($type) { | ||
451 | case 'unread': | ||
452 | $qb->andWhere('e.isArchived = false'); | ||
453 | break; | ||
454 | case 'archive': | ||
455 | $qb->andWhere('e.isArchived = true'); | ||
456 | break; | ||
457 | case 'starred': | ||
458 | $qb->andWhere('e.isStarred = true'); | ||
459 | break; | ||
460 | case 'untagged': | ||
461 | $qb->leftJoin('e.tags', 't'); | ||
462 | $qb->andWhere('t.id is null'); | ||
463 | break; | ||
464 | } | ||
465 | |||
466 | $ids = $qb->getQuery()->getArrayResult(); | ||
467 | |||
468 | if (empty($ids)) { | ||
469 | throw new NoResultException(); | ||
470 | } | ||
471 | |||
472 | // random select one in the list | ||
473 | $randomId = $ids[mt_rand(0, \count($ids) - 1)]['id']; | ||
474 | |||
475 | return $this->find($randomId); | ||
476 | } | ||
477 | |||
478 | /** | ||
436 | * Return a query builder to be used by other getBuilderFor* method. | 479 | * Return a query builder to be used by other getBuilderFor* method. |
437 | * | 480 | * |
438 | * @param int $userId | 481 | * @param int $userId |
@@ -470,7 +513,6 @@ class EntryRepository extends EntityRepository | |||
470 | */ | 513 | */ |
471 | private function sortQueryBuilder(QueryBuilder $qb, $sortBy = 'createdAt', $direction = 'desc') | 514 | private function sortQueryBuilder(QueryBuilder $qb, $sortBy = 'createdAt', $direction = 'desc') |
472 | { | 515 | { |
473 | return $qb | 516 | return $qb->orderBy(sprintf('e.%s', $sortBy), $direction); |
474 | ->orderBy(sprintf('e.%s', $sortBy), $direction); | ||
475 | } | 517 | } |
476 | } | 518 | } |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index 4cf69916..5a770dff 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml | |||
@@ -37,6 +37,7 @@ menu: | |||
37 | add_new_entry: 'Tilføj ny artikel' | 37 | add_new_entry: 'Tilføj ny artikel' |
38 | search: 'Søg' | 38 | search: 'Søg' |
39 | filter_entries: 'Filtrer artikler' | 39 | filter_entries: 'Filtrer artikler' |
40 | # random_entry: Jump to a random entry from that list | ||
40 | # export: 'Export' | 41 | # export: 'Export' |
41 | search_form: | 42 | search_form: |
42 | input_label: 'Indtast søgning' | 43 | input_label: 'Indtast søgning' |
@@ -590,6 +591,7 @@ flashes: | |||
590 | entry_starred: 'Artikel markeret som favorit' | 591 | entry_starred: 'Artikel markeret som favorit' |
591 | entry_unstarred: 'Artikel ikke længere markeret som favorit' | 592 | entry_unstarred: 'Artikel ikke længere markeret som favorit' |
592 | entry_deleted: 'Artikel slettet' | 593 | entry_deleted: 'Artikel slettet' |
594 | # no_random_entry: 'No article with these criterias was found' | ||
593 | tag: | 595 | tag: |
594 | notice: | 596 | notice: |
595 | # tag_added: 'Tag added' | 597 | # 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..2ae8f08e 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml | |||
@@ -37,6 +37,7 @@ menu: | |||
37 | add_new_entry: 'Neuen Artikel hinzufügen' | 37 | add_new_entry: 'Neuen Artikel hinzufügen' |
38 | search: 'Suche' | 38 | search: 'Suche' |
39 | filter_entries: 'Artikel filtern' | 39 | filter_entries: 'Artikel filtern' |
40 | # random_entry: Jump to a random entry from that list | ||
40 | export: 'Exportieren' | 41 | export: 'Exportieren' |
41 | search_form: | 42 | search_form: |
42 | input_label: 'Suchbegriff hier eingeben' | 43 | input_label: 'Suchbegriff hier eingeben' |
@@ -590,6 +591,7 @@ flashes: | |||
590 | entry_starred: 'Eintrag favorisiert' | 591 | entry_starred: 'Eintrag favorisiert' |
591 | entry_unstarred: 'Eintrag defavorisiert' | 592 | entry_unstarred: 'Eintrag defavorisiert' |
592 | entry_deleted: 'Eintrag gelöscht' | 593 | entry_deleted: 'Eintrag gelöscht' |
594 | # no_random_entry: 'No article with these criterias was found' | ||
593 | tag: | 595 | tag: |
594 | notice: | 596 | notice: |
595 | tag_added: 'Tag hinzugefügt' | 597 | 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..d1d74159 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml | |||
@@ -37,6 +37,7 @@ menu: | |||
37 | add_new_entry: 'Add a new entry' | 37 | add_new_entry: 'Add a new entry' |
38 | search: 'Search' | 38 | search: 'Search' |
39 | filter_entries: 'Filter entries' | 39 | filter_entries: 'Filter entries' |
40 | random_entry: Jump to a random entry from that list | ||
40 | export: 'Export' | 41 | export: 'Export' |
41 | search_form: | 42 | search_form: |
42 | input_label: 'Enter your search here' | 43 | input_label: 'Enter your search here' |
@@ -590,6 +591,7 @@ flashes: | |||
590 | entry_starred: 'Entry starred' | 591 | entry_starred: 'Entry starred' |
591 | entry_unstarred: 'Entry unstarred' | 592 | entry_unstarred: 'Entry unstarred' |
592 | entry_deleted: 'Entry deleted' | 593 | entry_deleted: 'Entry deleted' |
594 | no_random_entry: 'No article with these criterias was found' | ||
593 | tag: | 595 | tag: |
594 | notice: | 596 | notice: |
595 | tag_added: 'Tag added' | 597 | 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..741d3e9f 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml | |||
@@ -37,6 +37,7 @@ menu: | |||
37 | add_new_entry: 'Añadir un nuevo artículo' | 37 | add_new_entry: 'Añadir un nuevo artículo' |
38 | search: 'Buscar' | 38 | search: 'Buscar' |
39 | filter_entries: 'Filtrar los artículos' | 39 | filter_entries: 'Filtrar los artículos' |
40 | # random_entry: Jump to a random entry from that list | ||
40 | export: 'Exportar' | 41 | export: 'Exportar' |
41 | search_form: | 42 | search_form: |
42 | input_label: 'Introduzca su búsqueda aquí' | 43 | input_label: 'Introduzca su búsqueda aquí' |
@@ -590,6 +591,7 @@ flashes: | |||
590 | entry_starred: 'Artículo marcado como favorito' | 591 | entry_starred: 'Artículo marcado como favorito' |
591 | entry_unstarred: 'Artículo desmarcado como favorito' | 592 | entry_unstarred: 'Artículo desmarcado como favorito' |
592 | entry_deleted: 'Artículo eliminado' | 593 | entry_deleted: 'Artículo eliminado' |
594 | # no_random_entry: 'No article with these criterias was found' | ||
593 | tag: | 595 | tag: |
594 | notice: | 596 | notice: |
595 | tag_added: 'Etiqueta añadida' | 597 | 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..2ef5dd52 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml | |||
@@ -37,6 +37,7 @@ menu: | |||
37 | add_new_entry: 'افزودن مقالهٔ تازه' | 37 | add_new_entry: 'افزودن مقالهٔ تازه' |
38 | search: 'جستجو' | 38 | search: 'جستجو' |
39 | filter_entries: 'فیلترکردن مقالهها' | 39 | filter_entries: 'فیلترکردن مقالهها' |
40 | # random_entry: Jump to a random entry from that list | ||
40 | export: 'برونبری' | 41 | export: 'برونبری' |
41 | search_form: | 42 | search_form: |
42 | input_label: 'جستجوی خود را اینجا بنویسید:' | 43 | input_label: 'جستجوی خود را اینجا بنویسید:' |
@@ -590,6 +591,7 @@ flashes: | |||
590 | entry_starred: 'مقاله برگزیده شد' | 591 | entry_starred: 'مقاله برگزیده شد' |
591 | entry_unstarred: 'مقاله نابرگزیده شد' | 592 | entry_unstarred: 'مقاله نابرگزیده شد' |
592 | entry_deleted: 'مقاله پاک شد' | 593 | entry_deleted: 'مقاله پاک شد' |
594 | # no_random_entry: 'No article with these criterias was found' | ||
593 | tag: | 595 | tag: |
594 | notice: | 596 | notice: |
595 | tag_added: 'برچسب افزوده شد' | 597 | tag_added: 'برچسب افزوده شد' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index edf3ac35..7a2029b4 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | |||
@@ -37,6 +37,7 @@ menu: | |||
37 | add_new_entry: "Sauvegarder un nouvel article" | 37 | add_new_entry: "Sauvegarder un nouvel article" |
38 | search: "Rechercher" | 38 | search: "Rechercher" |
39 | filter_entries: "Filtrer les articles" | 39 | filter_entries: "Filtrer les articles" |
40 | random_entry: Aller à un article aléatoire de cette liste | ||
40 | export: "Exporter" | 41 | export: "Exporter" |
41 | search_form: | 42 | search_form: |
42 | input_label: "Saisissez votre terme de recherche" | 43 | input_label: "Saisissez votre terme de recherche" |
@@ -590,6 +591,7 @@ flashes: | |||
590 | entry_starred: "Article ajouté dans les favoris" | 591 | entry_starred: "Article ajouté dans les favoris" |
591 | entry_unstarred: "Article retiré des favoris" | 592 | entry_unstarred: "Article retiré des favoris" |
592 | entry_deleted: "Article supprimé" | 593 | entry_deleted: "Article supprimé" |
594 | no_random_entry: "Aucun article correspond aux critères n'a été trouvé" | ||
593 | tag: | 595 | tag: |
594 | notice: | 596 | notice: |
595 | tag_added: "Tag ajouté" | 597 | 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..3a459445 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml | |||
@@ -37,6 +37,7 @@ menu: | |||
37 | add_new_entry: 'Aggiungi un nuovo contenuto' | 37 | add_new_entry: 'Aggiungi un nuovo contenuto' |
38 | search: 'Cerca' | 38 | search: 'Cerca' |
39 | filter_entries: 'Filtra contenuti' | 39 | filter_entries: 'Filtra contenuti' |
40 | # random_entry: Jump to a random entry from that list | ||
40 | export: 'Esporta' | 41 | export: 'Esporta' |
41 | search_form: | 42 | search_form: |
42 | input_label: 'Inserisci qui la tua ricerca' | 43 | input_label: 'Inserisci qui la tua ricerca' |
@@ -590,6 +591,7 @@ flashes: | |||
590 | entry_starred: 'Contenuto segnato come preferito' | 591 | entry_starred: 'Contenuto segnato come preferito' |
591 | entry_unstarred: 'Contenuto rimosso dai preferiti' | 592 | entry_unstarred: 'Contenuto rimosso dai preferiti' |
592 | entry_deleted: 'Contenuto eliminato' | 593 | entry_deleted: 'Contenuto eliminato' |
594 | # no_random_entry: 'No article with these criterias was found' | ||
593 | tag: | 595 | tag: |
594 | notice: | 596 | notice: |
595 | tag_added: 'Etichetta aggiunta' | 597 | 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..9df9e645 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml | |||
@@ -37,6 +37,7 @@ menu: | |||
37 | add_new_entry: 'Enregistrar un novèl article' | 37 | add_new_entry: 'Enregistrar un novèl article' |
38 | search: 'Cercar' | 38 | search: 'Cercar' |
39 | filter_entries: 'Filtrar los articles' | 39 | filter_entries: 'Filtrar los articles' |
40 | # random_entry: Jump to a random entry from that list | ||
40 | export: 'Exportar' | 41 | export: 'Exportar' |
41 | search_form: | 42 | search_form: |
42 | input_label: 'Picatz vòstre mot-clau a cercar aquí' | 43 | input_label: 'Picatz vòstre mot-clau a cercar aquí' |
@@ -590,6 +591,7 @@ flashes: | |||
590 | entry_starred: 'Article ajustat dins los favorits' | 591 | entry_starred: 'Article ajustat dins los favorits' |
591 | entry_unstarred: 'Article quitat dels favorits' | 592 | entry_unstarred: 'Article quitat dels favorits' |
592 | entry_deleted: 'Article suprimit' | 593 | entry_deleted: 'Article suprimit' |
594 | # no_random_entry: 'No article with these criterias was found' | ||
593 | tag: | 595 | tag: |
594 | notice: | 596 | notice: |
595 | tag_added: 'Etiqueta ajustada' | 597 | 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..684c40e2 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml | |||
@@ -37,6 +37,7 @@ menu: | |||
37 | add_new_entry: 'Dodaj nowy wpis' | 37 | add_new_entry: 'Dodaj nowy wpis' |
38 | search: 'Szukaj' | 38 | search: 'Szukaj' |
39 | filter_entries: 'Filtruj wpisy' | 39 | filter_entries: 'Filtruj wpisy' |
40 | # random_entry: Jump to a random entry from that list | ||
40 | export: 'Eksportuj' | 41 | export: 'Eksportuj' |
41 | search_form: | 42 | search_form: |
42 | input_label: 'Wpisz swoje zapytanie tutaj' | 43 | input_label: 'Wpisz swoje zapytanie tutaj' |
@@ -590,6 +591,7 @@ flashes: | |||
590 | entry_starred: 'Wpis oznaczony gwiazdką' | 591 | entry_starred: 'Wpis oznaczony gwiazdką' |
591 | entry_unstarred: 'Wpis odznaczony gwiazdką' | 592 | entry_unstarred: 'Wpis odznaczony gwiazdką' |
592 | entry_deleted: 'Wpis usunięty' | 593 | entry_deleted: 'Wpis usunięty' |
594 | # no_random_entry: 'No article with these criterias was found' | ||
593 | tag: | 595 | tag: |
594 | notice: | 596 | notice: |
595 | tag_added: 'Tag dodany' | 597 | 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..7932d7ab 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml | |||
@@ -37,6 +37,7 @@ menu: | |||
37 | add_new_entry: 'Adicionar uma nova entrada' | 37 | add_new_entry: 'Adicionar uma nova entrada' |
38 | search: 'Pesquisa' | 38 | search: 'Pesquisa' |
39 | filter_entries: 'Filtrar entradas' | 39 | filter_entries: 'Filtrar entradas' |
40 | # random_entry: Jump to a random entry from that list | ||
40 | export: 'Exportar' | 41 | export: 'Exportar' |
41 | search_form: | 42 | search_form: |
42 | input_label: 'Digite aqui sua pesquisa' | 43 | input_label: 'Digite aqui sua pesquisa' |
@@ -590,6 +591,7 @@ flashes: | |||
590 | entry_starred: 'Entrada destacada' | 591 | entry_starred: 'Entrada destacada' |
591 | entry_unstarred: 'Entrada não destacada' | 592 | entry_unstarred: 'Entrada não destacada' |
592 | entry_deleted: 'Entrada apagada' | 593 | entry_deleted: 'Entrada apagada' |
594 | # no_random_entry: 'No article with these criterias was found' | ||
593 | tag: | 595 | tag: |
594 | notice: | 596 | notice: |
595 | tag_added: 'Tag adicionada' | 597 | 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..4d091f03 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml | |||
@@ -37,6 +37,7 @@ menu: | |||
37 | add_new_entry: 'Introdu un nou articol' | 37 | add_new_entry: 'Introdu un nou articol' |
38 | search: 'Căutare' | 38 | search: 'Căutare' |
39 | filter_entries: 'Filtrează articolele' | 39 | filter_entries: 'Filtrează articolele' |
40 | # random_entry: Jump to a random entry from that list | ||
40 | # export: 'Export' | 41 | # export: 'Export' |
41 | search_form: | 42 | search_form: |
42 | input_label: 'Introdu căutarea ta' | 43 | input_label: 'Introdu căutarea ta' |
@@ -590,6 +591,7 @@ flashes: | |||
590 | entry_starred: 'Articol adăugat la favorite' | 591 | entry_starred: 'Articol adăugat la favorite' |
591 | entry_unstarred: 'Articol șters de la favorite' | 592 | entry_unstarred: 'Articol șters de la favorite' |
592 | entry_deleted: 'Articol șters' | 593 | entry_deleted: 'Articol șters' |
594 | # no_random_entry: 'No article with these criterias was found' | ||
593 | tag: | 595 | tag: |
594 | notice: | 596 | notice: |
595 | # tag_added: 'Tag added' | 597 | # 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..cc327ae4 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml | |||
@@ -36,6 +36,7 @@ menu: | |||
36 | add_new_entry: 'Добавить новую запись' | 36 | add_new_entry: 'Добавить новую запись' |
37 | search: 'Поиск' | 37 | search: 'Поиск' |
38 | filter_entries: 'Фильтр записей' | 38 | filter_entries: 'Фильтр записей' |
39 | # random_entry: Jump to a random entry from that list | ||
39 | export: 'Экспорт' | 40 | export: 'Экспорт' |
40 | search_form: | 41 | search_form: |
41 | input_label: 'Введите текст для поиска' | 42 | input_label: 'Введите текст для поиска' |
@@ -555,6 +556,7 @@ flashes: | |||
555 | entry_starred: 'Запись помечена звездочкой' | 556 | entry_starred: 'Запись помечена звездочкой' |
556 | entry_unstarred: 'Пометка звездочкой у записи убрана' | 557 | entry_unstarred: 'Пометка звездочкой у записи убрана' |
557 | entry_deleted: 'Запись удалена' | 558 | entry_deleted: 'Запись удалена' |
559 | # no_random_entry: 'No article with these criterias was found' | ||
558 | tag: | 560 | tag: |
559 | notice: | 561 | notice: |
560 | tag_added: 'Тег добавлен' | 562 | tag_added: 'Тег добавлен' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml index 7dbb1399..148aa541 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml | |||
@@ -37,6 +37,7 @@ menu: | |||
37 | add_new_entry: 'เพิ่มรายการใหม่' | 37 | add_new_entry: 'เพิ่มรายการใหม่' |
38 | search: 'ค้นหา' | 38 | search: 'ค้นหา' |
39 | filter_entries: 'ตัวกรองรายการ' | 39 | filter_entries: 'ตัวกรองรายการ' |
40 | # random_entry: Jump to a random entry from that list | ||
40 | export: 'นำข้อมูลออก' | 41 | export: 'นำข้อมูลออก' |
41 | search_form: | 42 | search_form: |
42 | input_label: 'ค้นหาที่นี้' | 43 | input_label: 'ค้นหาที่นี้' |
@@ -588,6 +589,7 @@ flashes: | |||
588 | entry_starred: 'รายการที่แสดง' | 589 | entry_starred: 'รายการที่แสดง' |
589 | entry_unstarred: 'รายการที่ไม่ได้แสดง' | 590 | entry_unstarred: 'รายการที่ไม่ได้แสดง' |
590 | entry_deleted: 'รายการที่ถูกลบ' | 591 | entry_deleted: 'รายการที่ถูกลบ' |
592 | # no_random_entry: 'No article with these criterias was found' | ||
591 | tag: | 593 | tag: |
592 | notice: | 594 | notice: |
593 | tag_added: 'แท็กที่เพิ่ม' | 595 | tag_added: 'แท็กที่เพิ่ม' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index b4bc04d0..6fb9852a 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml | |||
@@ -37,6 +37,7 @@ menu: | |||
37 | add_new_entry: 'Yeni bir makale ekle' | 37 | add_new_entry: 'Yeni bir makale ekle' |
38 | search: 'Ara' | 38 | search: 'Ara' |
39 | filter_entries: 'Filtrele' | 39 | filter_entries: 'Filtrele' |
40 | # random_entry: Jump to a random entry from that list | ||
40 | export: 'Dışa Aktar' | 41 | export: 'Dışa Aktar' |
41 | search_form: | 42 | search_form: |
42 | input_label: 'Aramak istediğiniz herhangi bir şey yazın' | 43 | input_label: 'Aramak istediğiniz herhangi bir şey yazın' |
@@ -568,6 +569,7 @@ flashes: | |||
568 | entry_starred: 'Makale favorilere eklendi' | 569 | entry_starred: 'Makale favorilere eklendi' |
569 | entry_unstarred: 'Makale favorilerden çıkartıldı' | 570 | entry_unstarred: 'Makale favorilerden çıkartıldı' |
570 | entry_deleted: 'Makale silindi' | 571 | entry_deleted: 'Makale silindi' |
572 | # no_random_entry: 'No article with these criterias was found' | ||
571 | tag: | 573 | tag: |
572 | notice: | 574 | notice: |
573 | tag_added: 'Etiket eklendi' | 575 | 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..fb296c9d 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,6 +20,9 @@ | |||
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> |
@@ -28,6 +31,9 @@ | |||
28 | {% if app.user.config.rssToken %} | 31 | {% if app.user.config.rssToken %} |
29 | {% include "@WallabagCore/themes/common/Entry/_rss_link.html.twig" %} | 32 | {% include "@WallabagCore/themes/common/Entry/_rss_link.html.twig" %} |
30 | {% endif %} | 33 | {% endif %} |
34 | {% if currentRoute in ['unread', 'starred', 'archive', 'untagged', 'all'] %} | ||
35 | <a href="{{ path('random_entry', { 'type': currentRoute }) }}"><i class="btn-clickable material-icons md-24 js-random-action">casino</i></a> | ||
36 | {% endif %} | ||
31 | <i class="btn-clickable download-btn material-icons md-24 js-export-action">file_download</i> | 37 | <i class="btn-clickable download-btn material-icons md-24 js-export-action">file_download</i> |
32 | <i class="btn-clickable filter-btn material-icons md-24 js-filters-action">filter_list</i> | 38 | <i class="btn-clickable filter-btn material-icons md-24 js-filters-action">filter_list</i> |
33 | {% if entries.getNbPages > 1 %} | 39 | {% if entries.getNbPages > 1 %} |
@@ -90,9 +96,6 @@ | |||
90 | {% if tag is defined %} | 96 | {% if tag is defined %} |
91 | {% set currentTag = tag %} | 97 | {% set currentTag = tag %} |
92 | {% endif %} | 98 | {% endif %} |
93 | {% if currentRoute == 'homepage' %} | ||
94 | {% set currentRoute = 'unread' %} | ||
95 | {% endif %} | ||
96 | <h2>{{ 'entry.list.export_title'|trans }}</h2> | 99 | <h2>{{ 'entry.list.export_title'|trans }}</h2> |
97 | <a href="javascript: void(null);" id="download-form-close" class="close-button--popup close-button">×</a> | 100 | <a href="javascript: void(null);" id="download-form-close" class="close-button--popup close-button">×</a> |
98 | <ul> | 101 | <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..067c8975 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,6 +21,9 @@ | |||
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) }} |
@@ -60,9 +63,6 @@ | |||
60 | {% if tag is defined %} | 63 | {% if tag is defined %} |
61 | {% set currentTag = tag.slug %} | 64 | {% set currentTag = tag.slug %} |
62 | {% endif %} | 65 | {% endif %} |
63 | {% if currentRoute == 'homepage' %} | ||
64 | {% set currentRoute = 'unread' %} | ||
65 | {% endif %} | ||
66 | <h4 class="center">{{ 'entry.list.export_title'|trans }}</h4> | 66 | <h4 class="center">{{ 'entry.list.export_title'|trans }}</h4> |
67 | <ul> | 67 | <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 %} | 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 %} |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig index 052a8c01..b9c45567 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig | |||
@@ -46,6 +46,8 @@ | |||
46 | {% set activeRoute = 'starred' %} | 46 | {% set activeRoute = 'starred' %} |
47 | {% elseif currentRoute == 'unread' or currentRoute == 'homepage' or currentRouteFromQueryParams == 'unread' %} | 47 | {% elseif currentRoute == 'unread' or currentRoute == 'homepage' or currentRouteFromQueryParams == 'unread' %} |
48 | {% set activeRoute = 'unread' %} | 48 | {% set activeRoute = 'unread' %} |
49 | {% elseif currentRoute == 'untagged' %} | ||
50 | {% set activeRoute = 'untagged' %} | ||
49 | {% endif %} | 51 | {% endif %} |
50 | 52 | ||
51 | <li class="bold {% if activeRoute == 'unread' %}active{% endif %}"> | 53 | <li class="bold {% if activeRoute == 'unread' %}active{% endif %}"> |
@@ -113,6 +115,13 @@ | |||
113 | <i class="material-icons">search</i> | 115 | <i class="material-icons">search</i> |
114 | </a> | 116 | </a> |
115 | </li> | 117 | </li> |
118 | {% if activeRoute %} | ||
119 | <li id="button_random"> | ||
120 | <a class="waves-effect tooltipped js-random-action" data-position="bottom" data-delay="50" data-tooltip="{{ 'menu.top.random_entry'|trans }}" href="{{ path('random_entry', { 'type': activeRoute }) }}"> | ||
121 | <i class="material-icons">casino</i> | ||
122 | </a> | ||
123 | </li> | ||
124 | {% endif %} | ||
116 | <li id="button_filters"> | 125 | <li id="button_filters"> |
117 | <a class="nav-panel-menu button-collapse-right tooltipped js-filters-action" data-position="bottom" data-delay="50" data-tooltip="{{ 'menu.top.filter_entries'|trans }}" href="#" data-activates="filters"> | 126 | <a class="nav-panel-menu button-collapse-right tooltipped js-filters-action" data-position="bottom" data-delay="50" data-tooltip="{{ 'menu.top.filter_entries'|trans }}" href="#" data-activates="filters"> |
118 | <i class="material-icons">filter_list</i> | 127 | <i class="material-icons">filter_list</i> |
@@ -125,7 +134,7 @@ | |||
125 | </li> | 134 | </li> |
126 | </ul> | 135 | </ul> |
127 | </div> | 136 | </div> |
128 | {{ render(controller("WallabagCoreBundle:Entry:searchForm", {'currentRoute': app.request.attributes.get('_route')})) }} | 137 | {{ render(controller("WallabagCoreBundle:Entry:searchForm", {'currentRoute': currentRoute})) }} |
129 | {{ render(controller("WallabagCoreBundle:Entry:addEntryForm")) }} | 138 | {{ render(controller("WallabagCoreBundle:Entry:addEntryForm")) }} |
130 | </div> | 139 | </div> |
131 | </nav> | 140 | </nav> |
diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php index 44c034f8..439c978c 100644 --- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php +++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php | |||
@@ -79,7 +79,6 @@ class InstapaperImport extends AbstractImport | |||
79 | $entries[] = [ | 79 | $entries[] = [ |
80 | 'url' => $data[0], | 80 | 'url' => $data[0], |
81 | 'title' => $data[1], | 81 | 'title' => $data[1], |
82 | 'status' => $data[3], | ||
83 | 'is_archived' => 'Archive' === $data[3] || 'Starred' === $data[3], | 82 | 'is_archived' => 'Archive' === $data[3] || 'Starred' === $data[3], |
84 | 'is_starred' => 'Starred' === $data[3], | 83 | 'is_starred' => 'Starred' === $data[3], |
85 | 'html' => false, | 84 | 'html' => false, |