mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-29 12:31:02 +00:00
Added button to show entries with the same domain
This commit is contained in:
parent
84dcaaaea9
commit
890c7d0bfa
11 changed files with 64 additions and 5 deletions
|
@ -285,7 +285,7 @@ a.original:not(.waves-effect) {
|
||||||
flex-basis: 5em;
|
flex-basis: 5em;
|
||||||
align-self: flex-end;
|
align-self: flex-end;
|
||||||
float: right;
|
float: right;
|
||||||
max-width: 6em;
|
max-width: 8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tags {
|
.tags {
|
||||||
|
|
|
@ -517,6 +517,20 @@ class EntryController extends Controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List the entries with the same domain as the current one.
|
||||||
|
*
|
||||||
|
* @param int $page
|
||||||
|
*
|
||||||
|
* @Route("/domain/{id}/{page}", requirements={"id" = ".+"}, defaults={"page" = 1}, name="same_domain")
|
||||||
|
*
|
||||||
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
|
*/
|
||||||
|
public function getSameDomainEntries(Request $request, $page = 1)
|
||||||
|
{
|
||||||
|
return $this->showEntries('same-domain', $request, $page);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Global method to retrieve entries depending on the given type
|
* Global method to retrieve entries depending on the given type
|
||||||
* It returns the response to be send.
|
* It returns the response to be send.
|
||||||
|
@ -553,6 +567,9 @@ class EntryController extends Controller
|
||||||
$qb = $repository->getBuilderForUnreadByUser($this->getUser()->getId());
|
$qb = $repository->getBuilderForUnreadByUser($this->getUser()->getId());
|
||||||
$formOptions['filter_unread'] = true;
|
$formOptions['filter_unread'] = true;
|
||||||
break;
|
break;
|
||||||
|
case 'same-domain':
|
||||||
|
$qb = $repository->getBuilderForSameDomainByUser($this->getUser()->getId(), $request->get('id'));
|
||||||
|
break;
|
||||||
case 'all':
|
case 'all':
|
||||||
$qb = $repository->getBuilderForAllByUser($this->getUser()->getId());
|
$qb = $repository->getBuilderForAllByUser($this->getUser()->getId());
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -47,7 +47,7 @@ class ExportController extends Controller
|
||||||
*
|
*
|
||||||
* @Route("/export/{category}.{format}", name="export_entries", requirements={
|
* @Route("/export/{category}.{format}", name="export_entries", requirements={
|
||||||
* "format": "epub|mobi|pdf|json|xml|txt|csv",
|
* "format": "epub|mobi|pdf|json|xml|txt|csv",
|
||||||
* "category": "all|unread|starred|archive|tag_entries|untagged|search"
|
* "category": "all|unread|starred|archive|tag_entries|untagged|search|same_domain"
|
||||||
* })
|
* })
|
||||||
*
|
*
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
* @return \Symfony\Component\HttpFoundation\Response
|
||||||
|
|
|
@ -42,6 +42,33 @@ class EntryRepository extends EntityRepository
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves entries with the same domain.
|
||||||
|
*
|
||||||
|
* @param int $userId
|
||||||
|
* @param int $entryId
|
||||||
|
*
|
||||||
|
* @return QueryBuilder
|
||||||
|
*/
|
||||||
|
public function getBuilderForSameDomainByUser($userId, $entryId)
|
||||||
|
{
|
||||||
|
$queryBuilder = $this->createQueryBuilder('e');
|
||||||
|
|
||||||
|
return $this
|
||||||
|
->getSortedQueryBuilderByUser($userId)
|
||||||
|
->andWhere('e.id <> :entryId')->setParameter('entryId', $entryId)
|
||||||
|
->andWhere(
|
||||||
|
$queryBuilder->expr()->in(
|
||||||
|
'e.domainName',
|
||||||
|
$this
|
||||||
|
->createQueryBuilder('e2')
|
||||||
|
->select('e2.domainName')
|
||||||
|
->where('e2.id = :entryId')->setParameter('entryId', $entryId)
|
||||||
|
->getDQL()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves read entries for a user.
|
* Retrieves read entries for a user.
|
||||||
*
|
*
|
||||||
|
|
|
@ -224,6 +224,7 @@ entry:
|
||||||
filtered_search: 'Filtered by search:'
|
filtered_search: 'Filtered by search:'
|
||||||
untagged: Untagged entries
|
untagged: Untagged entries
|
||||||
all: All entries
|
all: All entries
|
||||||
|
same_domain: Same domain
|
||||||
list:
|
list:
|
||||||
number_on_the_page: '{0} There are no entries.|{1} There is one entry.|]1,Inf[ There are %count% entries.'
|
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
|
reading_time: estimated reading time
|
||||||
|
@ -237,6 +238,7 @@ entry:
|
||||||
toogle_as_star: Toggle starred
|
toogle_as_star: Toggle starred
|
||||||
delete: Delete
|
delete: Delete
|
||||||
export_title: Export
|
export_title: Export
|
||||||
|
show_same_domain: Show articles with the same domain
|
||||||
filters:
|
filters:
|
||||||
title: Filters
|
title: Filters
|
||||||
status_label: Status
|
status_label: Status
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
{{ 'entry.page_titles.filtered_tags'|trans }} {{ filter }}
|
{{ 'entry.page_titles.filtered_tags'|trans }} {{ filter }}
|
||||||
{% elseif currentRoute == 'untagged' %}
|
{% elseif currentRoute == 'untagged' %}
|
||||||
{{ 'entry.page_titles.untagged'|trans }}
|
{{ 'entry.page_titles.untagged'|trans }}
|
||||||
|
{% elseif currentRoute == 'same_domain' %}
|
||||||
|
{{ 'entry.page_titles.same_domain'|trans }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ 'entry.page_titles.unread'|trans }}
|
{{ 'entry.page_titles.unread'|trans }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
<ul class="tools right">
|
<ul class="tools right">
|
||||||
<li>
|
<li>
|
||||||
|
<a title="{{ 'entry.list.show_same_domain'|trans }}" class="tool grey-text" href="{{ path('same_domain', { 'id': entry.id }) }}"><i class="material-icons">language</i></a>
|
||||||
<a title="{{ 'entry.list.toogle_as_read'|trans }}" class="tool grey-text" href="{{ path('archive_entry', { 'id': entry.id }) }}"><i class="material-icons">{% if entry.isArchived == 0 %}done{% else %}unarchive{% endif %}</i></a>
|
<a title="{{ 'entry.list.toogle_as_read'|trans }}" class="tool grey-text" href="{{ path('archive_entry', { 'id': entry.id }) }}"><i class="material-icons">{% if entry.isArchived == 0 %}done{% else %}unarchive{% endif %}</i></a>
|
||||||
<a title="{{ 'entry.list.toogle_as_star'|trans }}" class="tool grey-text" href="{{ path('star_entry', { 'id': entry.id }) }}"><i class="material-icons">{% if entry.isStarred == 0 %}star_border{% else %}star{% endif %}</i></a>
|
<a title="{{ 'entry.list.toogle_as_star'|trans }}" class="tool grey-text" href="{{ path('star_entry', { 'id': entry.id }) }}"><i class="material-icons">{% if entry.isStarred == 0 %}star_border{% else %}star{% endif %}</i></a>
|
||||||
<a title="{{ 'entry.list.delete'|trans }}" onclick="return confirm('{{ 'entry.confirm.delete'|trans|escape('js') }}')" class="tool grey-text delete" href="{{ path('delete_entry', { 'id': entry.id }) }}"><i class="material-icons">delete</i></a>
|
<a title="{{ 'entry.list.delete'|trans }}" onclick="return confirm('{{ 'entry.confirm.delete'|trans|escape('js') }}')" class="tool grey-text delete" href="{{ path('delete_entry', { 'id': entry.id }) }}"><i class="material-icons">delete</i></a>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
{% include "@WallabagCore/themes/material/Entry/Card/_content.html.twig" with {'entry': entry, 'withMetadata': true, 'subClass': 'metadata'} only %}
|
{% include "@WallabagCore/themes/material/Entry/Card/_content.html.twig" with {'entry': entry, 'withMetadata': true, 'subClass': 'metadata'} only %}
|
||||||
<ul class="tools-list hide-on-small-only">
|
<ul class="tools-list hide-on-small-only">
|
||||||
<li>
|
<li>
|
||||||
|
<a title="{{ 'entry.list.show_same_domain'|trans }}" class="tool grey-text" href="{{ path('same_domain', { 'id': entry.id }) }}"><i class="material-icons">language</i></a>
|
||||||
<a title="{{ 'entry.list.toogle_as_read'|trans }}" class="tool grey-text" href="{{ path('archive_entry', { 'id': entry.id }) }}"><i class="material-icons">{% if entry.isArchived == 0 %}done{% else %}unarchive{% endif %}</i></a>
|
<a title="{{ 'entry.list.toogle_as_read'|trans }}" class="tool grey-text" href="{{ path('archive_entry', { 'id': entry.id }) }}"><i class="material-icons">{% if entry.isArchived == 0 %}done{% else %}unarchive{% endif %}</i></a>
|
||||||
<a title="{{ 'entry.list.toogle_as_star'|trans }}" class="tool grey-text" href="{{ path('star_entry', { 'id': entry.id }) }}"><i class="material-icons">{% if entry.isStarred == 0 %}star_border{% else %}star{% endif %}</i></a>
|
<a title="{{ 'entry.list.toogle_as_star'|trans }}" class="tool grey-text" href="{{ path('star_entry', { 'id': entry.id }) }}"><i class="material-icons">{% if entry.isStarred == 0 %}star_border{% else %}star{% endif %}</i></a>
|
||||||
<a title="{{ 'entry.list.delete'|trans }}" onclick="return confirm('{{ 'entry.confirm.delete'|trans|escape('js') }}')" class="tool grey-text delete" href="{{ path('delete_entry', { 'id': entry.id }) }}"><i class="material-icons">delete</i></a>
|
<a title="{{ 'entry.list.delete'|trans }}" onclick="return confirm('{{ 'entry.confirm.delete'|trans|escape('js') }}')" class="tool grey-text delete" href="{{ path('delete_entry', { 'id': entry.id }) }}"><i class="material-icons">delete</i></a>
|
||||||
|
|
|
@ -1675,4 +1675,13 @@ class EntryControllerTest extends WallabagCoreTestCase
|
||||||
$client->request('GET', '/delete/' . $entry2->getId());
|
$client->request('GET', '/delete/' . $entry2->getId());
|
||||||
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testGetSameDomainEntries()
|
||||||
|
{
|
||||||
|
$this->logInAs('admin');
|
||||||
|
$client = $this->getClient();
|
||||||
|
|
||||||
|
$crawler = $client->request('GET', '/domain/1');
|
||||||
|
$this->assertCount(4, $crawler->filter('li.entry'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue