Commit 6de8500f authored by Son Nguyen's avatar Son Nguyen Committed by Gerrit Code Review
Browse files

Merge "Have added 'sort by: ascending/descending (Bug #1285414)"

parents 2b49101a ac518f6c
......@@ -86,7 +86,7 @@ addLoadEvent(function() {
})
EOF;
$smarty = smarty(array('adminusersearch', 'paginator'));
$smarty = smarty(array('adminusersearch', 'paginator'), array(), array('ascending' => 'mahara', 'descending' => 'mahara'));
$smarty->assign('search', $search);
$smarty->assign('limit', $limit);
$smarty->assign('loggedintypes', $loggedintypes);
......
......@@ -52,6 +52,14 @@ function UserSearch(pager) {
$j(this).closest('thead').find('th').removeClass('asc').removeClass('desc');
$j(this).parent().addClass(sortdir);
var re1 = new RegExp(strings.descending);
var re2 = new RegExp(strings.ascending);
$j(this).closest('tr').find('span').each(function(i, el) {
el.innerHTML = el.innerHTML.replace(re1, strings.ascending);
});
if (sortdir == 'asc') {
$j(this).find('span').html($j(this).find('span').html().replace(re2, strings.descending));
}
sortdir = (sortdir == 'desc') ? 'asc' : 'desc';
pager.sendQuery();
......
......@@ -127,6 +127,7 @@ $string['sortalpha'] = 'Sort tags alphabetically';
$string['sortfreq'] = 'Sort tags by frequency';
$string['sortresultsby'] = 'Sort results by:';
$string['sortedby'] = 'sorted by:';
$string['sortby'] = 'Sort by:';
$string['adminfirst'] = 'Admin first';
$string['nameatoz'] = 'Name A to Z';
$string['nameztoa'] = 'Name Z to A';
......
......@@ -96,7 +96,10 @@
{foreach from=$columns key=f item=c}
<th class="{if $c.sort}search-results-sort-column{if $f == $sortby} {$sortdir}{/if}{/if}{if $c.class} {$c.class}{/if}">
{if $c.sort}
<a href="{$searchurl}&sortby={$f}&sortdir={if $f == $sortby && $sortdir == 'asc'}desc{else}asc{/if}">{$c.name}</a>
<a href="{$searchurl}&sortby={$f}&sortdir={if $f == $sortby && $sortdir == 'asc'}desc{else}asc{/if}">
{$c.name}
<span class="accessible-hidden">({str tag=sortby} {if $f == $sortby && $sortdir == 'asc'}{str tag=descending}{else}{str tag=ascending}{/if})</span>
</a>
{else}
{$c.name}
{/if}
......
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