mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-16 18:30:17 +01:00
Merge remote-tracking branch 'origin/v2' into v2_fix_material
# Conflicts: # src/Wallabag/CoreBundle/Resources/views/themes/material/base.html.twig
This commit is contained in:
commit
4919584b87
31
src/Wallabag/CoreBundle/Controller/TagController.php
Normal file
31
src/Wallabag/CoreBundle/Controller/TagController.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
|
||||
class TagController extends Controller
|
||||
{
|
||||
/**
|
||||
* Shows tags for current user.
|
||||
*
|
||||
* @Route("/tag/list", name="tag")
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function showTagAction()
|
||||
{
|
||||
$tags = $this->getDoctrine()
|
||||
->getRepository('WallabagCoreBundle:Tag')
|
||||
->findTags($this->getUser()->getId());
|
||||
|
||||
return $this->render(
|
||||
'WallabagCoreBundle:Tag:tags.html.twig',
|
||||
array(
|
||||
'tags' => $tags
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -3,7 +3,25 @@
|
||||
namespace Wallabag\CoreBundle\Repository;
|
||||
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Pagerfanta\Adapter\DoctrineORMAdapter;
|
||||
use Pagerfanta\Pagerfanta;
|
||||
|
||||
class TagRepository extends EntityRepository
|
||||
{
|
||||
/**
|
||||
* Find Tags.
|
||||
*
|
||||
* @param int $userId
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function findTags($userId)
|
||||
{
|
||||
$qb = $this->createQueryBuilder('t')
|
||||
->where('t.user =:userId')->setParameter('userId', $userId);
|
||||
|
||||
$pagerAdapter = new DoctrineORMAdapter($qb);
|
||||
|
||||
return new Pagerfanta($pagerAdapter);
|
||||
}
|
||||
}
|
||||
|
13
src/Wallabag/CoreBundle/Resources/views/Tag/tags.html.twig
Normal file
13
src/Wallabag/CoreBundle/Resources/views/Tag/tags.html.twig
Normal file
@ -0,0 +1,13 @@
|
||||
{% extends "WallabagCoreBundle::layout.html.twig" %}
|
||||
|
||||
{% block title "Tags" %}
|
||||
|
||||
{% block content %}
|
||||
{% if tags is empty %}
|
||||
<div class="messages warning"><p>{% trans %}No tags found.{% endtrans %}</p></div>
|
||||
{% else %}
|
||||
{% for tag in tags %}
|
||||
{{tag.label}}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
@ -71,7 +71,7 @@
|
||||
<li><a href="{{ path('unread') }}">{% trans %}unread{% endtrans %}</a></li>
|
||||
<li><a href="{{ path('starred') }}">{% trans %}favorites{% endtrans %}</a></li>
|
||||
<li><a href="{{ path('archive') }}"}>{% trans %}archive{% endtrans %}</a></li>
|
||||
<li><a href="?view=tags">{% trans %}tags{% endtrans %}</a></li>
|
||||
<li><a href="{{ path ('tag') }}">{% trans %}tags{% endtrans %}</a></li>
|
||||
<li><a href="{{ path('new_entry') }}">{% trans %}save a link{% endtrans %}</a></li>
|
||||
<li style="position: relative;"><a href="javascript: void(null);" id="search">{% trans %}search{% endtrans %}</a>
|
||||
<div id="search-form" class="messages info popup-form">
|
||||
|
@ -10,7 +10,7 @@ final class Extractor
|
||||
public static function extract($url)
|
||||
{
|
||||
$pageContent = self::getPageContent(new Url(base64_encode($url)));
|
||||
$title = $pageContent['rss']['channel']['item']['title'] ?: 'Untitled';
|
||||
$title = $pageContent['rss']['channel']['item']['title'] ?: parse_url($url, PHP_URL_HOST);
|
||||
$body = $pageContent['rss']['channel']['item']['description'];
|
||||
|
||||
$content = new Content();
|
||||
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\Tests\Controller;
|
||||
|
||||
use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
|
||||
use Doctrine\ORM\AbstractQuery;
|
||||
|
||||
class TagControllerTest extends WallabagCoreTestCase
|
||||
{
|
||||
public function testList()
|
||||
{
|
||||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$client->request('GET', '/tag/list');
|
||||
|
||||
$this->assertEquals(200, $client->getResponse()->getStatusCode());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user