Merge pull request #2243 from wallabag/feature-untagged-entries

Add untagged entries
This commit is contained in:
Jeremy Benoist 2016-08-28 15:56:17 +02:00 committed by GitHub
commit 13d44ca766
18 changed files with 78 additions and 1 deletions

View File

@ -226,6 +226,10 @@ class EntryController extends Controller
$repository = $this->get('wallabag_core.entry_repository');
switch ($type) {
case 'untagged':
$qb = $repository->getBuilderForUntaggedByUser($this->getUser()->getId());
break;
case 'starred':
$qb = $repository->getBuilderForStarredByUser($this->getUser()->getId());
break;
@ -523,4 +527,19 @@ class EntryController extends Controller
['entry' => $entry]
);
}
/**
* Shows untagged articles for current user.
*
* @param Request $request
* @param int $page
*
* @Route("/untagged/list/{page}", name="untagged", defaults={"page" = "1"})
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function showUntaggedEntriesAction(Request $request, $page)
{
return $this->showEntries('untagged', $request, $page);
}
}

View File

@ -46,7 +46,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"
* "category": "all|unread|starred|archive|tag_entries|untagged"
* })
*
* @return \Symfony\Component\HttpFoundation\Response

View File

@ -84,6 +84,22 @@ class EntryRepository extends EntityRepository
;
}
/**
* Retrieves untagged entries for a user.
*
* @param int $userId
*
* @return QueryBuilder
*/
public function getBuilderForUntaggedByUser($userId)
{
return $this
->getBuilderByUser($userId)
->leftJoin('e.tags', 't')
->groupBy('e.id')
->having('count(t.id) = 0');
}
/**
* Find Entries.
*

View File

@ -140,6 +140,7 @@ entry:
# archived: 'Archived entries'
# filtered: 'Filtered entries'
# filtered_tags: 'Filtered by tags'
# untagged: 'Untagged entries'
list:
# number_on_the_page: '{0} There is no entry.|{1} There is one entry.|]1,Inf[ There are %count% entries.'
reading_time: 'estimeret læsetid'
@ -312,6 +313,7 @@ tag:
page_title: 'Tags'
list:
# number_on_the_page: '{0} There is no tag.|{1} There is one tag.|]1,Inf[ There are %count% tags.'
# see_untagged_entries: 'See untagged entries'
import:
# page_title: 'Import'

View File

@ -140,6 +140,7 @@ entry:
archived: 'Archivierte Einträge'
filtered: 'Gefilterte Einträge'
# filtered_tags: 'Filtered by tags'
# untagged: 'Untagged entries'
list:
number_on_the_page: '{0} Es gibt keine Einträge.|{1} Es gibt einen Eintrag.|]1,Inf[ Es gibt %count% Einträge.'
reading_time: 'geschätzte Lesezeit'
@ -312,6 +313,7 @@ tag:
page_title: 'Tags'
list:
number_on_the_page: '{0} Es gibt keine Tags.|{1} Es gibt einen Tag.|]1,Inf[ Es gibt %count% Tags.'
# see_untagged_entries: 'See untagged entries'
import:
page_title: 'Importieren'

View File

@ -140,6 +140,7 @@ entry:
archived: 'Archived entries'
filtered: 'Filtered entries'
filtered_tags: 'Filtered by tags'
untagged: 'Untagged entries'
list:
number_on_the_page: '{0} There are no entries.|{1} There is one entry.|]1,Inf[ There are %count% entries.'
reading_time: 'estimated reading time'
@ -312,6 +313,7 @@ tag:
page_title: 'Tags'
list:
number_on_the_page: '{0} There are no tags.|{1} There is one tag.|]1,Inf[ There are %count% tags.'
see_untagged_entries: 'See untagged entries'
import:
page_title: 'Import'

View File

@ -140,6 +140,7 @@ entry:
archived: 'Artículos archivados'
filtered: 'Artículos filtrados'
# filtered_tags: 'Filtered by tags'
# untagged: 'Untagged entries'
list:
number_on_the_page: '{0} No hay artículos.|{1} Hay un artículo.|]1,Inf[ Hay %count% artículos.'
reading_time: 'tiempo estimado de lectura'
@ -312,6 +313,7 @@ tag:
page_title: 'Etiquetas'
list:
number_on_the_page: '{0} No hay ninguna etiqueta.|{1} Hay una etiqueta.|]1,Inf[ Hay %count% etiquetas.'
# see_untagged_entries: 'See untagged entries'
import:
page_title: 'Importar'

View File

@ -140,6 +140,7 @@ entry:
archived: 'مقاله‌های بایگانی‌شده'
filtered: 'مقاله‌های فیلترشده'
# filtered_tags: 'Filtered by tags'
# untagged: 'Untagged entries'
list:
number_on_the_page: '{0} هیج مقاله‌ای نیست.|{1} یک مقاله هست.|]1,Inf[ %count% مقاله هست.'
reading_time: 'زمان تخمینی برای خواندن'
@ -312,6 +313,7 @@ tag:
page_title: 'برچسب‌ها'
list:
number_on_the_page: '{0} هیچ برچسبی نیست.|{1} یک برچسب هست.|]1,Inf[ %count% برچسب هست.'
# see_untagged_entries: 'See untagged entries'
import:
page_title: 'درون‌ریزی'

View File

@ -140,6 +140,7 @@ entry:
archived: 'Articles lus'
filtered: 'Articles filtrés'
filtered_tags: 'Articles filtrés par tags'
untagged: 'Article sans tag'
list:
number_on_the_page: "{0} Il n'y a pas d'articles.|{1} Il y a un article.|]1,Inf[ Il y a %count% articles."
reading_time: 'durée de lecture'
@ -312,6 +313,7 @@ tag:
page_title: 'Tags'
list:
number_on_the_page: "{0} Il n'y a pas de tag.|{1} Il y a un tag.|]1,Inf[ Il y a %count% tags."
see_untagged_entries: 'Voir les articles sans tag'
import:
page_title: 'Importer'

View File

@ -139,6 +139,8 @@ entry:
starred: 'Contenuti preferiti'
archived: 'Contenuti archiviati'
filtered: 'Contenuti filtrati'
# filtered_tags: 'Filtered by tags'
# untagged: 'Untagged entries'
list:
number_on_the_page: "{0} Non ci sono contenuti.|{1} C'è un contenuto.|]1,Inf[ Ci sono %count% contenuti."
reading_time: 'tempo di lettura stimato'
@ -310,6 +312,7 @@ tag:
page_title: 'Tags'
list:
number_on_the_page: "{0} Non ci sono tag.|{1} C'è un tag.|]1,Inf[ ci sono %count% tag."
# see_untagged_entries: 'See untagged entries'
import:
page_title: 'Importa'

View File

@ -140,6 +140,7 @@ entry:
archived: 'Articles legits'
filtered: 'Articles filtrats'
# filtered_tags: 'Filtered by tags'
# untagged: 'Untagged entries'
list:
number_on_the_page: "{0} I a pas cap d'article.|{1} I a un article.|]1,Inf[ I a %count% articles."
reading_time: 'durada de lectura'
@ -312,6 +313,7 @@ tag:
page_title: 'Etiquetas'
list:
number_on_the_page: "{0} I a pas cap d'etiquetas.|{1} I a una etiqueta.|]1,Inf[ I a %count% etiquetas."
# see_untagged_entries: 'See untagged entries'
import:
page_title: 'Importar'

View File

@ -140,6 +140,7 @@ entry:
archived: 'Zarchiwizowane wpisy'
filtered: 'Odfiltrowane wpisy'
# filtered_tags: 'Filtered by tags'
# untagged: 'Untagged entries'
list:
number_on_the_page: '{0} Nie ma wpisów.|{1} Jest jeden wpis.|]1,Inf[ Są %count% wpisy.'
reading_time: 'szacunkowy czas czytania'
@ -312,6 +313,7 @@ tag:
page_title: 'Tagi'
list:
number_on_the_page: '{0} Nie ma tagów.|{1} Jest jeden tag.|]1,Inf[ Są %count% tagi.'
# see_untagged_entries: 'See untagged entries'
import:
page_title: 'Import'

View File

@ -140,6 +140,7 @@ entry:
# archived: 'Archived entries'
# filtered: 'Filtered entries'
# filtered_tags: 'Filtered by tags'
# untagged: 'Untagged entries'
list:
# number_on_the_page: '{0} There is no entry.|{1} There is one entry.|]1,Inf[ There are %count% entries.'
reading_time: 'timp estimat de citire'
@ -312,6 +313,7 @@ tag:
page_title: 'Tag-uri'
list:
# number_on_the_page: '{0} There is no tag.|{1} There is one tag.|]1,Inf[ There are %count% tags.'
# see_untagged_entries: 'See untagged entries'
import:
# page_title: 'Import'

View File

@ -140,6 +140,7 @@ entry:
# archived: 'Archived entries'
# filtered: 'Filtered entries'
# filtered_tags: 'Filtered by tags'
# untagged: 'Untagged entries'
list:
number_on_the_page: '{0} Herhangi bir makale yok.|{1} Burada bir adet makale var.|]1,Inf[ Burada %count% adet makale var.'
reading_time: 'tahmini okuma süresi'
@ -312,6 +313,7 @@ tag:
page_title: 'Etiketler'
list:
number_on_the_page: '{0} Herhangi bir etiket yok.|{1} Burada bir adet etiket var.|]1,Inf[ Burada %count% adet etiket var.'
# see_untagged_entries: 'See untagged entries'
import:
page_title: 'İçe Aktar'

View File

@ -8,6 +8,8 @@
{{ 'entry.page_titles.filtered'|trans }}
{% elseif currentRoute == 'tag_entries' %}
{{ 'entry.page_titles.filtered_tags'|trans }}
{% elseif currentRoute == 'untagged' %}
{{ 'entry.page_titles.untagged'|trans }}
{% else %}
{{ 'entry.page_titles.unread'|trans }}
{% endif %}

View File

@ -12,4 +12,8 @@
<li id="tag-{{ tag.id|e }}"><a href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{tag.label}} ({{ tag.entries.getValues | length }})</a></li>
{% endfor %}
</ul>
<div>
<a href="{{ path('untagged') }}">{{ 'tag.list.see_untagged_entries'|trans }}</a>
</div>
{% endblock %}

View File

@ -12,4 +12,7 @@
<li id="tag-{{ tag.id|e }}" class="col l4 m6 s12"><a href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{tag.label}} ({{ tag.entries.getValues | length }})</a></li>
{% endfor %}
</ul>
<div>
<a href="{{ path('untagged') }}">{{ 'tag.list.see_untagged_entries'|trans }}</a>
</div>
{% endblock %}

View File

@ -236,6 +236,16 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertEquals(200, $client->getResponse()->getStatusCode());
}
public function testUntagged()
{
$this->logInAs('admin');
$client = $this->getClient();
$client->request('GET', '/untagged/list');
$this->assertEquals(200, $client->getResponse()->getStatusCode());
}
public function testStarred()
{
$this->logInAs('admin');