Commit 5ccb86a6 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic
Browse files

Bug 1771473: tags search - filter and sort selectors update each other

makes it possible to select date sorting
for each artefact type

behatnotneeded

Change-Id: I7e74bdfbbe8b4df35028e1890833298e73516a45
(cherry picked from commit c51162a0)
parent f4b69cd9
......@@ -21,7 +21,7 @@ if ($tag = param_variable('tag', null)) {
$limit = param_integer('limit', 10);
$offset = param_integer('offset', 0);
$sort = param_alpha('sort', 'name');
$type = param_alpha('type', null);
$type = param_alpha('type', 'all');
$owner = (object) array('type' => 'user', 'id' => $USER->get('id'));
$data = get_portfolio_items_by_tag($tag, $owner, $limit, $offset, $sort, $type);
......
......@@ -154,6 +154,7 @@ jQuery(function($) {
$(this).addClass('selected');
}
});
$('#results_filter a').each(function () {rewriteTagLink(this, ['tag', 'sort'], ['type'])});
params.sort = data.data.sort;
}
......@@ -167,6 +168,7 @@ jQuery(function($) {
$(this).addClass('selected');
}
});
$('#results_sort a').each(function () {rewriteTagLink(this, ['tag', 'type'], [ 'sort'])});
params.type = data.data.type;
}
......
......@@ -26,7 +26,7 @@
<div id="results_sort" class="pull-right">
<strong>{str tag=sortresultsby}</strong>
{foreach from=$results->sortcols item=sortfield name=sortcols}
<a href="{$results->baseurl}{$results->queryprefix}type={$results->filter}&sort={$sortfield}"{if $results->sort == $sortfield} class="selected"{/if}>{str tag=$sortfield}</a>{if !$.foreach.sortcols.last} <span class="sep">|</span>{/if}
<a href="{$results->baseurl}{$results->queryprefix}sort={$sortfield}"{if $results->sort == $sortfield} class="selected"{/if}>{str tag=$sortfield}</a>{if !$.foreach.sortcols.last} <span class="sep">|</span>{/if}
{/foreach}
</div>
<div class="btn-group">
......@@ -41,7 +41,7 @@
<ul class="dropdown-menu" id="results_filter">
{foreach from=$results->filtercols key=filtername item=filterdisplay name=filtercols}
<li>
<a href="{$results->baseurl}{$results->queryprefix}sort={$results->sort}&type={$filtername}"{if $results->filter == $filtername} class="selected"{/if}>{$filterdisplay}</a>
<a href="{$results->baseurl}{$results->queryprefix}type={$filtername}"{if $results->filter == $filtername} class="selected"{/if}>{$filterdisplay}</a>
</li>
{/foreach}
</ul>
......
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