Commit 57cdae74 authored by Jonny Bradley's avatar Jonny Bradley

[ENH] search: Add basic sort mode dropdown to standard search (filter) form....

[ENH] search: Add basic sort mode dropdown to standard search (filter) form. Descending mode and param control to come.
parent 7ee645a2
......@@ -58,5 +58,10 @@ function prefs_search_list()
'type' => 'flag',
'default' => 'n',
),
'search_show_sort_order' => array(
'name' => tra('Sort Order'),
'type' => 'flag',
'default' => 'n',
),
);
}
......@@ -45,6 +45,16 @@ function smarty_block_filter($params, $content, $smarty, &$repeat)
$smarty->assign('filter_type', isset($filter['type']) ? $filter['type'] : $prefs['search_default_where']);
$smarty->assign('filter_types', $types);
$sort_mode = isset($_REQUEST['sort_mode']) ? $_REQUEST['sort_mode'] : 'score_ndesc';
$sort_modes = array(
'score_ndesc' => tra('Relevance'),
'object_type_asc' => tra('Type'),
'title_asc' => tra('Title'),
'modification_date_ndesc' => tra('Modified date'),
);
$smarty->assign('sort_mode', $sort_mode );
$smarty->assign('sort_modes', $sort_modes);
// Categories
if ($prefs['feature_categories'] == 'y') {
$smarty->assign('filter_deep', isset($filter['deep']));
......
......@@ -2253,6 +2253,10 @@ div.aclabel, span.aclabel, label.aclabel {
list-style: none;
}
.filter label {
display:inline-block;
}
/* Locator module */
.minimap {
......
......@@ -146,6 +146,7 @@ $("#log-rebuild").click(function(){
{preference name=search_show_category_filter}
{preference name=search_show_tag_filter}
{preference name=feature_search_show_object_filter}
{preference name=search_show_sort_order}
{preference name=feature_search_show_search_box}
{tr}Select the information to display for each result:{/tr}
{preference name=feature_search_show_visit_count}
......
......@@ -7,6 +7,18 @@
{include file='unified_search_help.tpl'}
{/add_help}
</label>
{if $prefs.search_show_sort_order eq 'y'}
<label>
{tr}Sort By{/tr}
<select name="sort_mode">
{foreach from=$sort_modes key=k item=t}
<option value="{$k|escape}"{if $k eq $sort_mode} selected="selected"{/if}>{$t|escape}</option>
{/foreach}
</select>
</label>
{else}
<input type="hidden" name="sort_mode" value="{$sort_mode}" />
{/if}
{if $prefs.feature_search_show_object_filter eq 'y'}
<label>
{tr}Type{/tr}
......
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