wip PHRAS-681

This commit is contained in:
Florian BLOUET
2016-02-16 18:50:24 +01:00
parent 8eeec9c885
commit cfac4d7ecd
3 changed files with 22 additions and 7 deletions

View File

@@ -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>