Commit 649ff55a authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Don't try to ajaxify the tags when there aren't any tags

parent 26d770f0
...@@ -36,21 +36,17 @@ if ($tags && is_null($tag)) { ...@@ -36,21 +36,17 @@ if ($tags && is_null($tag)) {
$tag = $tags[0]->tag; $tag = $tags[0]->tag;
} }
$js = '';
if ($tag) { if ($tag) {
$limit = param_integer('limit', 10); $limit = param_integer('limit', 10);
$offset = param_integer('offset', 0); $offset = param_integer('offset', 0);
$owner = (object) array('type' => 'user', 'id' => $USER->get('id')); $owner = (object) array('type' => 'user', 'id' => $USER->get('id'));
$data = get_portfolio_items_by_tag($tag, $owner, $limit, $offset); $data = get_portfolio_items_by_tag($tag, $owner, $limit, $offset);
build_portfolio_search_html($data); build_portfolio_search_html($data);
$pagerjs = $data->pagination_js;
}
else {
$pagerjs = 'var results_pager = new Paginator("portfoliosearch_pagination", "results", "json\\/tagsearch.php", null);';
}
$js .= <<<EOF $js = <<<EOF
addLoadEvent(function() { addLoadEvent(function() {
{$pagerjs} {$data->pagination_js}
forEach(getElementsByTagAndClassName('a', 'tag', 'main-column-container'), function(elem) { forEach(getElementsByTagAndClassName('a', 'tag', 'main-column-container'), function(elem) {
disconnectAll(elem); disconnectAll(elem);
connect(elem, 'onclick', function(e) { connect(elem, 'onclick', function(e) {
...@@ -70,6 +66,8 @@ addLoadEvent(function() { ...@@ -70,6 +66,8 @@ addLoadEvent(function() {
}); });
EOF; EOF;
}
$smarty = smarty(array('paginator')); $smarty = smarty(array('paginator'));
$smarty->assign('PAGEHEADING', hsc(TITLE)); $smarty->assign('PAGEHEADING', hsc(TITLE));
$smarty->assign('tags', $tags); $smarty->assign('tags', $tags);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment