Added route to list entries with annotations

This commit is contained in:
Nicolas Lœuillet 2020-04-20 19:00:58 +02:00 committed by Jeremy Benoist
parent 9a6146d2ef
commit dce50ddb79
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
23 changed files with 143 additions and 4 deletions

View file

@ -69,11 +69,11 @@ security:
- { path: ^/logout, roles: [IS_AUTHENTICATED_ANONYMOUSLY, IS_AUTHENTICATED_2FA_IN_PROGRESS] }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: /(unread|starred|archive|all).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: /(unread|starred|archive|with_annotations|all).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/locale, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: /tags/(.*).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/feed, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: /(unread|starred|archive).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } # For backwards compatibility
- { path: /(unread|starred|archive|with_annotations).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } # For backwards compatibility
- { path: ^/share, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/settings, roles: ROLE_SUPER_ADMIN }
- { path: ^/annotations, roles: ROLE_USER }

View file

@ -277,12 +277,26 @@ class EntryController extends Controller
return $this->showEntries('untagged', $request, $page);
}
/**
* Shows entries with annotations for current user.
*
* @param int $page
*
* @Route("/with_annotations/list/{page}", name="with_annotations", defaults={"page" = "1"})
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function showWithAnnotationsEntriesAction(Request $request, $page)
{
return $this->showEntries('with_annotations', $request, $page);
}
/**
* Shows random entry depending on the given type.
*
* @param string $type
*
* @Route("/{type}/random", name="random_entry", requirements={"type": "unread|starred|archive|untagged|all"})
* @Route("/{type}/random", name="random_entry", requirements={"type": "unread|starred|archive|untagged|with_annotations|all"})
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
@ -563,6 +577,9 @@ class EntryController extends Controller
$qb = $repository->getBuilderForArchiveByUser($this->getUser()->getId());
$formOptions['filter_archived'] = true;
break;
case 'with_annotations':
$qb = $repository->getBuilderForAnnotationsByUser($this->getUser()->getId());
break;
case 'unread':
$qb = $repository->getBuilderForUnreadByUser($this->getUser()->getId());
$formOptions['filter_unread'] = true;

View file

@ -47,7 +47,7 @@ class ExportController extends Controller
*
* @Route("/export/{category}.{format}", name="export_entries", requirements={
* "format": "epub|mobi|pdf|json|xml|txt|csv",
* "category": "all|unread|starred|archive|tag_entries|untagged|search|same_domain"
* "category": "all|unread|starred|archive|tag_entries|untagged|search|with_annotations|same_domain"
* })
*
* @return \Symfony\Component\HttpFoundation\Response
@ -80,6 +80,13 @@ class ExportController extends Controller
->getResult();
$title = 'Search ' . $searchTerm;
} elseif ('with_annotations' === $category) {
$entries = $repository->getBuilderForAnnotationsByUser(
$this->getUser()->getId()
)->getQuery()
->getResult();
$title = 'With annotations';
} else {
$entries = $repository
->$methodBuilder($this->getUser()->getId())

View file

@ -142,6 +142,21 @@ class EntryRepository extends EntityRepository
return $this->sortQueryBuilder($this->getRawBuilderForUntaggedByUser($userId));
}
/**
* Retrieve entries with annotations for a user.
*
* @param int $userId
*
* @return QueryBuilder
*/
public function getBuilderForAnnotationsByUser($userId)
{
return $this
->getSortedQueryBuilderByUser($userId)
->innerJoin('e.annotations', 'a')
;
}
/**
* Retrieve untagged entries for a user.
*
@ -579,6 +594,10 @@ class EntryRepository extends EntityRepository
$qb->leftJoin('e.tags', 't');
$qb->andWhere('t.id is null');
break;
case 'with_annotations':
$qb->leftJoin('e.annotations', 'a');
$qb->andWhere('a.id is not null');
break;
}
$ids = $qb->getQuery()->getArrayResult();

View file

@ -13,6 +13,7 @@ menu:
starred: 'Favoritter'
archive: 'Arkiv'
all_articles: 'Alle artikler'
# with_annotations: 'With annotations'
config: 'Opsætning'
tags: 'Tags'
howto: 'KUow-to'
@ -65,6 +66,17 @@ config:
new_password_label: 'Ny adgangskode'
repeat_new_password_label: 'Gentag adgangskode'
entry:
# default_title: 'Title of the entry'
page_titles:
# unread: 'Unread entries'
# starred: 'Starred entries'
# archived: 'Archived entries'
# filtered: 'Filtered entries'
# with_annotations: 'Entries with annotations'
# filtered_tags: 'Filtered by tags:'
# filtered_search: 'Filtered by search:'
# untagged: 'Untagged entries'
# all: 'All entries'
list:
reading_time: 'estimeret læsetid'
reading_time_minutes: 'estimeret læsetid: %readingTime% min'

View file

@ -19,6 +19,7 @@ menu:
starred: Favoriten
archive: Archiv
all_articles: Alle Artikel
# with_annotations: 'With annotations'
config: Konfiguration
tags: Tags
internal_settings: Interne Einstellungen
@ -236,6 +237,7 @@ entry:
starred: Favorisierte Einträge
archived: Archivierte Einträge
filtered: Gefilterte Einträge
# with_annotations: 'Entries with annotations'
filtered_tags: 'Gefiltert nach Tags:'
filtered_search: 'Gefiltert nach Suche:'
untagged: Nicht markierte Einträge

View file

@ -19,6 +19,7 @@ menu:
starred: Starred
archive: Archive
all_articles: All entries
with_annotations: With annotations
config: Config
tags: Tags
internal_settings: Internal Settings
@ -220,6 +221,7 @@ entry:
starred: Starred entries
archived: Archived entries
filtered: Filtered entries
with_annotations: Entries with annotations
filtered_tags: 'Filtered by tags:'
filtered_search: 'Filtered by search:'
untagged: Untagged entries

View file

@ -19,6 +19,7 @@ menu:
starred: 'Favoritos'
archive: 'Archivados'
all_articles: 'Todos los artículos'
# with_annotations: 'With annotations'
config: 'Configuración'
tags: 'Etiquetas'
internal_settings: 'Configuración interna'
@ -217,6 +218,7 @@ entry:
starred: 'Artículos favoritos'
archived: 'Artículos archivados'
filtered: 'Artículos filtrados'
# with_annotations: 'Entries with annotations'
filtered_tags: 'Filtrado por etiquetas:'
filtered_search: 'Filtrado por búsqueda:'
untagged: 'Artículos sin etiquetas'

View file

@ -15,6 +15,7 @@ security:
go_to_account: حساب خود را ببینید
menu:
left:
<<<<<<< HEAD
unread: خوانده‌نشده
starred: برگزیده
archive: بایگانی
@ -32,6 +33,27 @@ menu:
site_credentials: اعتبارنامه‌های وب‌گاه
users_management: مدیریت کاربران
developer: مدیریت کارخواه‌های API
=======
unread: 'خوانده‌نشده'
starred: 'برگزیده'
archive: 'بایگانی'
all_articles: 'همه'
# with_annotations: 'With annotations'
config: 'پیکربندی'
tags: 'برچسب‌ها'
internal_settings: 'تنظیمات درونی'
import: 'درون‌ریزی'
howto: 'خودآموز'
# developer: 'API clients management'
logout: 'خروج'
about: 'درباره'
search: 'جستجو'
save_link: 'ذخیرهٔ یک پیوند'
back_to_unread: 'بازگشت به خوانده‌نشده‌ها'
# users_management: 'Users management'
# site_credentials: 'Site credentials'
quickstart: "Quickstart"
>>>>>>> 4b997bc8 (Added route to list entries with annotations)
top:
add_new_entry: افزودن مقالهٔ تازه
search: جستجو
@ -106,10 +128,22 @@ config:
tagging_rules_definition_title: برچسب‌گذاری خودکار یعنی چه؟
entry:
page_titles:
<<<<<<< HEAD
unread: مقاله‌های خوانده‌نشده
starred: مقاله‌های برگزیده
archived: مقاله‌های بایگانی‌شده
filtered: مقاله‌های فیلترشده
=======
unread: 'مقاله‌های خوانده‌نشده'
starred: 'مقاله‌های برگزیده'
archived: 'مقاله‌های بایگانی‌شده'
filtered: 'مقاله‌های فیلترشده'
# with_annotations: 'Entries with annotations'
# filtered_tags: 'Filtered by tags:'
# filtered_search: 'Filtered by search:'
# untagged: 'Untagged entries'
# all: 'All entries'
>>>>>>> 4b997bc8 (Added route to list entries with annotations)
list:
number_on_the_page: '{0} هیج مقاله‌ای نیست.|{1} یک مقاله هست.|]1,Inf[ %count% مقاله هست.'
reading_time: زمان تخمینی برای خواندن

View file

@ -19,6 +19,7 @@ menu:
starred: Favoris
archive: Lus
all_articles: Tous les articles
with_annotations: Avec annotations
config: Configuration
tags: Étiquettes
internal_settings: Configuration interne
@ -220,6 +221,7 @@ entry:
starred: Articles favoris
archived: Articles lus
filtered: Articles filtrés
with_annotations: Articles avec annotations
filtered_tags: 'Articles filtrés par étiquettes :'
filtered_search: 'Articles filtrés par recherche :'
untagged: Article sans étiquette

View file

@ -15,10 +15,12 @@ security:
go_to_account: Vai al tuo account
menu:
left:
unread: Non letti
starred: Preferiti
archive: Archivio
all_articles: Tutti
# with_annotations: 'With annotations'
config: Configurazione
tags: Etichette
internal_settings: Strumenti
@ -175,10 +177,12 @@ config:
entry:
default_title: Titolo del contenuto
page_titles:
unread: Contenuti non letti
starred: Contenuti preferiti
archived: Contenuti archiviati
filtered: Contenuti filtrati
# with_annotations: 'Entries with annotations'
filtered_tags: 'Filtrati per etichetta:'
filtered_search: 'Filtrati per ricerca:'
untagged: Articoli non etichettati

View file

@ -19,6 +19,7 @@ menu:
starred: スター
archive: アーカイブ
all_articles: すべての記事
# with_annotations: 'With annotations'
config: 設定
tags: タグ
internal_settings: 内部設定
@ -235,6 +236,7 @@ entry:
starred: スター付きの記事
archived: アーカイブ済の記事
filtered: フィルターされた記事
# with_annotations: 'Entries with annotations'
filtered_tags: 'タグによるフィルター:'
untagged: タグがない記事
all: すべての記事

View file

@ -19,6 +19,7 @@ menu:
starred: Favorits
archive: Legits
all_articles: Totes los articles
# with_annotations: 'With annotations'
config: Configuracion
tags: Etiquetas
internal_settings: Configuracion intèrna
@ -180,6 +181,7 @@ entry:
starred: Articles favorits
archived: Articles legits
filtered: Articles filtrats
# with_annotations: 'Entries with annotations'
filtered_tags: 'Articles filtrats per etiquetas:'
filtered_search: 'Articles filtrats per recèrca:'
untagged: Articles sens etiqueta

View file

@ -19,6 +19,7 @@ menu:
starred: Oznaczone gwiazdką
archive: Archiwum
all_articles: Wszystkie
# with_annotations: 'With annotations'
config: Konfiguracja
tags: Tagi
internal_settings: Wewnętrzne ustawienia
@ -210,6 +211,7 @@ entry:
starred: Wpisy oznaczone gwiazdką
archived: Zarchiwizowane wpisy
filtered: Odfiltrowane wpisy
# with_annotations: 'Entries with annotations'
filtered_tags: 'Filtrowane po tagach:'
filtered_search: 'Filtrowanie po wyszukiwaniu:'
untagged: Odtaguj wpisy

View file

@ -19,6 +19,7 @@ menu:
starred: 'Destacado'
archive: 'Arquivo'
all_articles: 'Todas as entradas'
# with_annotations: 'With annotations'
config: 'Configurações'
tags: 'Tags'
internal_settings: 'Configurações Internas'
@ -148,6 +149,7 @@ entry:
starred: 'Entradas destacadas'
archived: 'Entradas arquivadas'
filtered: 'Entradas filtradas'
# with_annotations: 'Entries with annotations'
filtered_tags: 'Filtrar por tags:'
untagged: 'Entradas sem tags'
list:

View file

@ -13,6 +13,7 @@ menu:
starred: 'Cu steluță'
archive: 'Arhivă'
all_articles: 'Toate'
# with_annotations: 'With annotations'
config: 'Configurație'
tags: 'Tag-uri'
howto: 'Cum să'
@ -64,6 +65,17 @@ config:
new_password_label: 'Parola nouă'
repeat_new_password_label: ''
entry:
# default_title: 'Title of the entry'
page_titles:
# unread: 'Unread entries'
# starred: 'Starred entries'
# archived: 'Archived entries'
# filtered: 'Filtered entries'
# with_annotations: 'Entries with annotations'
# filtered_tags: 'Filtered by tags:'
# filtered_search: 'Filtered by search:'
# untagged: 'Untagged entries'
# all: 'All entries'
list:
reading_time: 'timp estimat de citire'
reading_time_minutes: 'timp estimat de citire: %readingTime% min'

View file

@ -19,6 +19,7 @@ menu:
starred: 'Помеченные'
archive: 'Архивные'
all_articles: 'Все записи'
# with_annotations: 'With annotations'
config: 'Настройки'
tags: 'Теги'
internal_settings: 'Внутренние настройки'
@ -236,6 +237,7 @@ entry:
starred: 'Помеченные записи'
archived: 'Архивные записи'
filtered: 'Отфильтрованные записи'
# with_annotations: 'Entries with annotations'
filtered_tags: 'Отфильтрованные по тегу:'
filtered_search: 'Отфильтрованные по поиску:'
untagged: 'Записи без тегов'

View file

@ -19,6 +19,7 @@ menu:
starred: 'ทำการแสดง'
archive: 'เอกสาร'
all_articles: 'รายการทั้งหมด'
# with_annotations: 'With annotations'
config: 'กำหนดค่า'
tags: 'แท็ก'
internal_settings: 'ตั้งค่าภายใน'
@ -158,6 +159,7 @@ entry:
starred: 'รายการที่แสดง'
archived: 'รายการเอกสาร'
filtered: 'รายการที่กลั่นกรอง'
# with_annotations: 'Entries with annotations'
filtered_tags: 'แท็กทีกลั่นกรอง่:'
filtered_search: 'การค้นหาที่กลั่นกรอง:'
untagged: 'รายการที่ไม่ได้แท็ก'

View file

@ -19,6 +19,7 @@ menu:
starred: Favoriler
archive: Arşiv
all_articles: Hepsi
# with_annotations: 'With annotations'
config: Yapılandırma
tags: Etiketler
import: İçe Aktar
@ -315,6 +316,7 @@ entry:
starred: Favorilenmiş makaleler
archived: Arşivlenmiş makaleler
filtered: Fitrelenmiş makaleler
# with_annotations: 'Entries with annotations'
filtered_tags: 'Etiket ile filtrele:'
filtered_search: 'Arama kriteri ile filtrele:'
untagged: Etiketlenmemiş makaleler

View file

@ -19,6 +19,7 @@ menu:
starred: '收藏'
archive: '存档'
all_articles: '所有项目'
# with_annotations: 'With annotations'
config: '配置'
tags: '标签'
internal_settings: '内部设置'
@ -236,6 +237,7 @@ entry:
starred: '收藏项目'
archived: '存档项目'
filtered: '筛选后项目'
# with_annotations: 'Entries with annotations'
filtered_tags: '根据标签筛选:'
filtered_search: '根据搜索筛选:'
untagged: '无标签项目'

View file

@ -14,6 +14,8 @@
{{ 'entry.page_titles.untagged'|trans }}
{% elseif currentRoute == 'same_domain' %}
{{ 'entry.page_titles.same_domain'|trans }}
{% elseif currentRoute == 'with_annotations' %}
{{ 'entry.page_titles.with_annotations'|trans }}
{% else %}
{{ 'entry.page_titles.unread'|trans }}
{% endif %}

View file

@ -40,6 +40,8 @@
{% set activeRoute = null %}
{% if currentRoute == 'all' or currentRouteFromQueryParams == 'all' %}
{% set activeRoute = 'all' %}
{% elseif currentRoute == 'with_annotations' or currentRouteFromQueryParams == 'with_annotations' %}
{% set activeRoute = 'with_annotations' %}
{% elseif currentRoute == 'archive' or currentRouteFromQueryParams == 'archive' %}
{% set activeRoute = 'archive' %}
{% elseif currentRoute == 'starred' or currentRouteFromQueryParams == 'starred' %}
@ -59,6 +61,9 @@
<li class="bold {% if activeRoute == 'archive' %}active{% endif %}">
<a class="waves-effect" href="{{ path('archive') }}">{{ 'menu.left.archive'|trans }} <span class="numberItems grey-text">{{ count_entries('archive') }}</span></a>
</li>
<li class="bold {% if activeRoute == 'with_annotations' %}active{% endif %}">
<a class="waves-effect" href="{{ path('with_annotations') }}">{{ 'menu.left.with_annotations'|trans }} <span class="numberItems grey-text">{{ count_entries('with_annotations') }}</span></a>
</li>
<li class="bold {% if activeRoute == 'all' %}active{% endif %}">
<a class="waves-effect" href="{{ path('all') }}">{{ 'menu.left.all_articles'|trans }} <span class="numberItems grey-text">{{ count_entries('all') }}</span></a>
</li>

View file

@ -95,6 +95,9 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface
case 'unread':
$qb = $this->entryRepository->getBuilderForUnreadByUser($user->getId());
break;
case 'with_annotations':
$qb = $this->entryRepository->getBuilderForAnnotationsByUser($user->getId());
break;
case 'all':
$qb = $this->entryRepository->getBuilderForAllByUser($user->getId());
break;