diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2019-01-19 22:08:29 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2019-01-19 22:24:10 +0100 |
commit | 50f35f0db2be9586205e793f315608eec59c9666 (patch) | |
tree | 0f88f3ab6ad32db026494a7104341c45ee997515 /src/Wallabag | |
parent | 9a57653aec85b0f5220436d5cb76545e66c24a11 (diff) | |
download | wallabag-50f35f0db2be9586205e793f315608eec59c9666.tar.gz wallabag-50f35f0db2be9586205e793f315608eec59c9666.tar.zst wallabag-50f35f0db2be9586205e793f315608eec59c9666.zip |
Move icon into the top menu bar
Change the way to select a random entry:
- select all ids from the given user (with filters)
- choose randomly one in php
- find that entry
Diffstat (limited to 'src/Wallabag')
19 files changed, 40 insertions, 25 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index dfb5eb54..5c8ecb40 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -253,7 +253,7 @@ class EntryController extends Controller | |||
253 | * | 253 | * |
254 | * @param string $type | 254 | * @param string $type |
255 | * | 255 | * |
256 | * @Route("/{type}/random", name="random_entry", requirements={"_locale": "unread|starred|archive|untagged|all"}) | 256 | * @Route("/{type}/random", name="random_entry", requirements={"type": "unread|starred|archive|untagged|all"}) |
257 | * | 257 | * |
258 | * @return \Symfony\Component\HttpFoundation\RedirectResponse | 258 | * @return \Symfony\Component\HttpFoundation\RedirectResponse |
259 | */ | 259 | */ |
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 879e6671..fabb1963 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -325,8 +325,8 @@ class EntryRepository extends EntityRepository | |||
325 | * Find an entry by its url and its owner. | 325 | * Find an entry by its url and its owner. |
326 | * If it exists, return the entry otherwise return false. | 326 | * If it exists, return the entry otherwise return false. |
327 | * | 327 | * |
328 | * @param $url | 328 | * @param string $url |
329 | * @param $userId | 329 | * @param int $userId |
330 | * | 330 | * |
331 | * @return Entry|bool | 331 | * @return Entry|bool |
332 | */ | 332 | */ |
@@ -417,8 +417,8 @@ class EntryRepository extends EntityRepository | |||
417 | /** | 417 | /** |
418 | * Find all entries by url and owner. | 418 | * Find all entries by url and owner. |
419 | * | 419 | * |
420 | * @param $url | 420 | * @param string $url |
421 | * @param $userId | 421 | * @param int $userId |
422 | * | 422 | * |
423 | * @return array | 423 | * @return array |
424 | */ | 424 | */ |
@@ -434,20 +434,17 @@ class EntryRepository extends EntityRepository | |||
434 | /** | 434 | /** |
435 | * Returns a random entry, filtering by status. | 435 | * Returns a random entry, filtering by status. |
436 | * | 436 | * |
437 | * @param $userId | 437 | * @param int $userId |
438 | * @param string $type can be unread, archive, starred, etc | 438 | * @param string $type Can be unread, archive, starred, etc |
439 | * | 439 | * |
440 | * @throws \Doctrine\ORM\NoResultException | 440 | * @throws \Doctrine\ORM\NoResultException |
441 | * @throws \Doctrine\ORM\NonUniqueResultException | ||
442 | * | ||
443 | * @see https://github.com/doctrine/doctrine2/issues/5479#issuecomment-403862934 | ||
444 | * | 441 | * |
445 | * @return Entry | 442 | * @return Entry |
446 | */ | 443 | */ |
447 | public function getRandomEntry($userId, $type = '') | 444 | public function getRandomEntry($userId, $type = '') |
448 | { | 445 | { |
449 | $qb = $this->getQueryBuilderByUser($userId) | 446 | $qb = $this->getQueryBuilderByUser($userId) |
450 | ->select('MIN(e.id)', 'MAX(e.id)'); | 447 | ->select('e.id'); |
451 | 448 | ||
452 | switch ($type) { | 449 | switch ($type) { |
453 | case 'unread': | 450 | case 'unread': |
@@ -465,18 +462,12 @@ class EntryRepository extends EntityRepository | |||
465 | break; | 462 | break; |
466 | } | 463 | } |
467 | 464 | ||
468 | $idLimits = $qb | 465 | $ids = $qb->getQuery()->getArrayResult(); |
469 | ->getQuery() | ||
470 | ->getOneOrNullResult(); | ||
471 | $randomPossibleIds = rand($idLimits[1], $idLimits[2]); | ||
472 | 466 | ||
473 | return $qb | 467 | // random select one in the list |
474 | ->select('e') | 468 | $randomId = $ids[mt_rand(0, \count($ids) - 1)]['id']; |
475 | ->andWhere('e.id >= :random_id') | 469 | |
476 | ->setParameter('random_id', $randomPossibleIds) | 470 | return $this->find($randomId); |
477 | ->setMaxResults(1) | ||
478 | ->getQuery() | ||
479 | ->getSingleResult(); | ||
480 | } | 471 | } |
481 | 472 | ||
482 | /** | 473 | /** |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index 0099148a..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' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index 5e531b78..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' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 2b952bd5..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' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index 2e2fbb93..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í' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index c58bbccb..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: 'جستجوی خود را اینجا بنویسید:' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index c3887f24..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" |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index c2135ac0..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' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index 6e2c1cf9..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í' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index 18156cbe..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' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml index 8493af47..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' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index 8fba13dc..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' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml index 56a63b14..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: 'Введите текст для поиска' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml index 9f0a6532..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: 'ค้นหาที่นี้' |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index a2093223..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' |
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 f3baae2c..549d60e7 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 | |||
@@ -28,10 +28,12 @@ | |||
28 | <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> |
29 | <div class="pagination"> | 29 | <div class="pagination"> |
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> | 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('random_entry', { 'type': currentRoute }) }}">random</a> | ||
32 | {% if app.user.config.rssToken %} | 31 | {% if app.user.config.rssToken %} |
33 | {% include "@WallabagCore/themes/common/Entry/_rss_link.html.twig" %} | 32 | {% include "@WallabagCore/themes/common/Entry/_rss_link.html.twig" %} |
34 | {% 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">shuffle</i></a> | ||
36 | {% endif %} | ||
35 | <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> |
36 | <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> |
37 | {% if entries.getNbPages > 1 %} | 39 | {% if entries.getNbPages > 1 %} |
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 49128573..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 | |||
@@ -28,7 +28,6 @@ | |||
28 | <div class="nb-results"> | 28 | <div class="nb-results"> |
29 | {{ 'entry.list.number_on_the_page'|transchoice(entries.count) }} | 29 | {{ 'entry.list.number_on_the_page'|transchoice(entries.count) }} |
30 | <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('random_entry', { 'type': currentRoute }) }}" title="random"><i class="material-icons">shuffle</i></a> | ||
32 | {% if app.user.config.rssToken %} | 31 | {% if app.user.config.rssToken %} |
33 | {% include "@WallabagCore/themes/common/Entry/_rss_link.html.twig" %} | 32 | {% include "@WallabagCore/themes/common/Entry/_rss_link.html.twig" %} |
34 | {% endif %} | 33 | {% 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..948e7eaa 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">shuffle</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> |