Fixed links in related tags view

This commit is contained in:
Marcin Kurczewski 2014-06-13 11:46:18 +02:00
parent 37fdc3057f
commit 8a2e6948bc
2 changed files with 6 additions and 1 deletions

View file

@ -346,7 +346,7 @@ function attachTagIt(target)
$.each(data.tags, function(i, tag) $.each(data.tags, function(i, tag)
{ {
var link = $('<a>'); var link = $('<a>');
link.attr('href', '/posts/' + tag.name + '/'); link.attr('href', tag['search-link']);
link.text('#' + tag.name); link.text('#' + tag.name);
link.click(function(e) link.click(function(e)
{ {

View file

@ -64,8 +64,13 @@ class TagController extends AbstractController
array_values(array_map( array_values(array_map(
function($tag) function($tag)
{ {
$searchLink = Core::getRouter()->linkTo(
['PostController', 'listView'],
['query' => $tag->getName(), 'page' => 1]);
return [ return [
'name' => $tag->getName(), 'name' => $tag->getName(),
'search-link' => $searchLink,
'count' => $tag->getPostCount(), 'count' => $tag->getPostCount(),
]; ];
}, $ret->entities)); }, $ret->entities));