aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2018-01-03 20:37:57 +0100
committerGitHub <noreply@github.com>2018-01-03 20:37:57 +0100
commit410216f435bd9594f37e861d0a0fea8205956a67 (patch)
tree48ee28d0ca14b8297e6b61d3eb53b9be0602a81b
parent2679eb9d844379b65cd126975ef2d3625d39081f (diff)
parentb8568662bdb5f118f7382e7b30bff886d6a185a7 (diff)
downloadwallabag-410216f435bd9594f37e861d0a0fea8205956a67.tar.gz
wallabag-410216f435bd9594f37e861d0a0fea8205956a67.tar.zst
wallabag-410216f435bd9594f37e861d0a0fea8205956a67.zip
Merge pull request #3536 from wallabag/tag-link-3534
Fix broken link to remove tags from entries
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/Card/_content.html.twig2
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_tags.html.twig2
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig2
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php20
4 files changed, 23 insertions, 3 deletions
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/Card/_content.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/Card/_content.html.twig
index ab7295d5..1c898f0f 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/Card/_content.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/Card/_content.html.twig
@@ -9,7 +9,7 @@
9 <div class="{{ subClass|default('original grey-text') }}"> 9 <div class="{{ subClass|default('original grey-text') }}">
10 <a href="{{ entry.url|e }}" target="_blank" title="{{ entry.domainName|removeWww }}" class="tool grey-text">{{ entry.domainName|removeWww }}</a> 10 <a href="{{ entry.url|e }}" target="_blank" title="{{ entry.domainName|removeWww }}" class="tool grey-text">{{ entry.domainName|removeWww }}</a>
11 {% if withTags is defined %} 11 {% if withTags is defined %}
12 {% include "@WallabagCore/themes/material/Entry/_tags.html.twig" with {'tags': entry.tags | slice(0, 3), 'listClass': ' hide-on-med-and-down'} only %} 12 {% include "@WallabagCore/themes/material/Entry/_tags.html.twig" with {'tags': entry.tags | slice(0, 3), 'entryId': entry.id, 'listClass': ' hide-on-med-and-down'} only %}
13 {% endif %} 13 {% endif %}
14 </div> 14 </div>
15</div> 15</div>
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_tags.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_tags.html.twig
index 144a105e..1317b129 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_tags.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_tags.html.twig
@@ -4,7 +4,7 @@
4 <li class="chip"> 4 <li class="chip">
5 <a href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{ tag.label }}</a> 5 <a href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{ tag.label }}</a>
6 {% if withRemove %} 6 {% if withRemove %}
7 <a href="{{ path('remove_tag', { 'entry': entry.id, 'tag': tag.id }) }}" onclick="return confirm('{{ 'entry.confirm.delete_tag'|trans|escape('js') }}')"> 7 <a href="{{ path('remove_tag', { 'entry': entryId, 'tag': tag.id }) }}" onclick="return confirm('{{ 'entry.confirm.delete_tag'|trans|escape('js') }}')">
8 <i class="material-icons vertical-align-middle">delete</i> 8 <i class="material-icons vertical-align-middle">delete</i>
9 </a> 9 </a>
10 {% endif %} 10 {% endif %}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig
index bebe29a2..54066e95 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig
@@ -268,7 +268,7 @@
268 </li> 268 </li>
269 {% endif %} 269 {% endif %}
270 </ul> 270 </ul>
271 {% include "@WallabagCore/themes/material/Entry/_tags.html.twig" with {'tags': entry.tags, 'withRemove': true} only %} 271 {% include "@WallabagCore/themes/material/Entry/_tags.html.twig" with {'tags': entry.tags, 'entryId': entry.id, 'withRemove': true} only %}
272 </div> 272 </div>
273 273
274 <div class="input-field nav-panel-add-tag" style="display: none"> 274 <div class="input-field nav-panel-add-tag" style="display: none">
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index 0e7e1576..e424f152 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -6,6 +6,7 @@ use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6use Wallabag\CoreBundle\Entity\Config; 6use Wallabag\CoreBundle\Entity\Config;
7use Wallabag\CoreBundle\Entity\Entry; 7use Wallabag\CoreBundle\Entity\Entry;
8use Wallabag\CoreBundle\Entity\SiteCredential; 8use Wallabag\CoreBundle\Entity\SiteCredential;
9use Wallabag\CoreBundle\Entity\Tag;
9use Wallabag\CoreBundle\Helper\ContentProxy; 10use Wallabag\CoreBundle\Helper\ContentProxy;
10 11
11class EntryControllerTest extends WallabagCoreTestCase 12class EntryControllerTest extends WallabagCoreTestCase
@@ -1478,4 +1479,23 @@ class EntryControllerTest extends WallabagCoreTestCase
1478 $this->assertSame('email_tracking.pdf', $content->getTitle()); 1479 $this->assertSame('email_tracking.pdf', $content->getTitle());
1479 $this->assertSame('example.com', $content->getDomainName()); 1480 $this->assertSame('example.com', $content->getDomainName());
1480 } 1481 }
1482
1483 public function testEntryDeleteTagLink()
1484 {
1485 $this->logInAs('admin');
1486 $client = $this->getClient();
1487
1488 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
1489 $entry = $em->getRepository('WallabagCoreBundle:Entry')->findByUrlAndUserId('http://0.0.0.0/entry1', $this->getLoggedInUserId());
1490 $tag = $entry->getTags()[0];
1491
1492 $crawler = $client->request('GET', '/view/' . $entry->getId());
1493
1494 // As long as the deletion link of a tag is following
1495 // a link to the tag view, we take the second one to retrieve
1496 // the deletion link of the first tag
1497 $link = $crawler->filter('body div#article div.tools ul.tags li.chip a')->extract('href')[1];
1498
1499 $this->assertSame(sprintf('/remove-tag/%s/%s', $entry->getId(), $tag->getId()), $link);
1500 }
1481} 1501}