mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
wip PHRAS-681
This commit is contained in:
@@ -133,7 +133,7 @@ class ElasticSearchEngine implements SearchEngineInterface
|
||||
*/
|
||||
public function getDefaultSort()
|
||||
{
|
||||
return SearchEngineOptions::SORT_RELEVANCE;
|
||||
return SearchEngineOptions::SORT_CREATED_ON;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -132,7 +132,8 @@ function checkFilters(save) {
|
||||
bases: {},
|
||||
fields: [],
|
||||
dates: {},
|
||||
status: []
|
||||
status: [],
|
||||
sort: {}
|
||||
};
|
||||
|
||||
var adv_box = $('form.phrasea_query .adv_options');
|
||||
@@ -220,6 +221,8 @@ function checkFilters(save) {
|
||||
$("option.default-selection", fieldsSort).prop("selected", true);
|
||||
$("option.default-selection", fieldsSortOrd).prop("selected", true);
|
||||
}
|
||||
search.sort.by = $("option:selected:enabled", fieldsSort).val();
|
||||
search.sort.order = $("option:selected:enabled", fieldsSortOrd).val();
|
||||
|
||||
//--------- from fields filter ---------
|
||||
|
||||
|
@@ -237,15 +237,27 @@
|
||||
</div>
|
||||
<div id="ADVSRCH_OPTIONS_ZONE">
|
||||
<div id="ADVSRCH_SORT_ZONE">
|
||||
{% set sortByDefault = app['phraseanet.SE'].getDefaultSort()%}
|
||||
{% set sortOrderDefault = app['phraseanet.SE'].getDefaultSortDirection()%}
|
||||
|
||||
{#{% set sortByPreference = constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_CREATED_ON') %}#}
|
||||
{% if sortByPreference is not defined %}
|
||||
{% set sortByPreference = sortByDefault %}
|
||||
{% endif %}
|
||||
|
||||
{% if sortOrderPreference is not defined %}
|
||||
{% set sortOrderPreference = sortOrderDefault %}
|
||||
{% endif %}
|
||||
|
||||
<span>{{ 'Trier par' | trans }}</span>
|
||||
<select name="sort" class="input-medium">
|
||||
{% set b = (app['phraseanet.SE'].getDefaultSort() == constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_CREATED_ON')) %}
|
||||
<select name="sort" class="input-medium" onchange="checkFilters(true);">
|
||||
{% set b = (sortByPreference == constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_CREATED_ON')) %}
|
||||
<option value="{{ constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_CREATED_ON') }}" {% if b %}selected="selected" class="default-selection"{% endif %}>{{ "Date Added"|trans }}</option>
|
||||
{% set b = (app['phraseanet.SE'].getDefaultSort() == constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_RELEVANCE')) %}
|
||||
{% set b = (sortByPreference == constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_RELEVANCE')) %}
|
||||
<option value="{{ constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_RELEVANCE') }}" {% if b %}selected="selected" class="default-selection"{% endif %}>{{ "Relevance"|trans }}</option>
|
||||
<optgroup label="{{ 'By field'|trans }}">
|
||||
{% for fieldname, sort in search_datas['sort'] %}
|
||||
{% set b = (app['phraseanet.SE'].getDefaultSort() == fieldname) %}
|
||||
{% set b = (sortOrderPreference == fieldname) %}
|
||||
<option value="{{ fieldname }}"
|
||||
{% if b %}selected="selected"{% endif %}
|
||||
class="{% if b %}default-selection {% endif %}dbx db_{{sort['sbas']|join(' db_')}}"
|
||||
@@ -253,7 +265,7 @@
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
</select>
|
||||
<select name="ord" class="input-medium">
|
||||
<select name="ord" class="input-medium" onchange="checkFilters(true);">
|
||||
{% for ord, ord_name in app['phraseanet.SE'].getAvailableOrder() %}
|
||||
{% set b = (app['phraseanet.SE'].getDefaultSortDirection() == ord) %}
|
||||
<option value="{{ ord }}" {% if b %}selected="selected" class="default-selection"{% endif %}>{{ ord_name }}</option>
|
||||
|
Reference in New Issue
Block a user