|
|
@@ -50,7 +50,7 @@ ${ commonheader(_('Search'), "search", user, "40px") | n,unicode }
|
|
|
</div>
|
|
|
<h3>${_('Sorting')}</h3>
|
|
|
${_('Specify on which fields and order the results are sorted by default.')}
|
|
|
- ${_('The sorting is a combination of the fields, from left to right.')}
|
|
|
+ ${_('The sorting is a combination of the "Default sorting" fields, from left to right.')}
|
|
|
<span data-bind="visible: ! isEnabled()"><strong>${_('Sorting is currently disabled.')}</strong></span>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -59,11 +59,12 @@ ${ commonheader(_('Search'), "search", user, "40px") | n,unicode }
|
|
|
<div data-bind="visible: sortingFields().length == 0" style="padding-left: 10px;margin-bottom: 20px">
|
|
|
<em>${_('There are currently no fields defined.')}</em>
|
|
|
</div>
|
|
|
- <div data-bind="foreach: sortingFields">
|
|
|
- <div class="bubble">
|
|
|
+ <div data-bind="sortable: sortingFields">
|
|
|
+ <div class="bubble" style="cursor: move">
|
|
|
+ <i class="icon-move"></i>
|
|
|
<strong><span data-bind="editable: label"></span></strong>
|
|
|
<span style="color:#666;font-size: 12px">
|
|
|
- (<span data-bind="text: field"></span> <i class="icon-arrow-up" data-bind="visible: asc() == true"></i><i class="icon-arrow-down" data-bind="visible: asc() == false"></i> <span data-bind="editable: order"></span> )
|
|
|
+ (<span data-bind="text: field"></span> <i class="icon-arrow-up" data-bind="visible: asc() == true"></i><i class="icon-arrow-down" data-bind="visible: asc() == false"></i> <span data-bind="editable: order"></span>, <input type="checkbox" data-bind="checked: include" style="margin-top:0" /> ${_('Default sorting')} )
|
|
|
</span>
|
|
|
<a class="btn btn-small" data-bind="click: $root.removeSortingField"><i class="icon-trash"></i></a>
|
|
|
</div>
|
|
|
@@ -79,6 +80,9 @@ ${ commonheader(_('Search'), "search", user, "40px") | n,unicode }
|
|
|
<button id="newFieldAsc" type="button" data-bind="css: {'active': newFieldAscDesc() == 'asc', 'btn': true}"><i class="icon-arrow-up"></i></button>
|
|
|
<button id="newFieldDesc" type="button" data-bind="css: {'active': newFieldAscDesc() == 'desc', 'btn': true}"><i class="icon-arrow-down"></i></button>
|
|
|
</div>
|
|
|
+ <label class="checkbox" style="display: inline">
|
|
|
+ <input id="newFieldInclude" type="checkbox" style="float:none;margin-left:0;margin-top: -2px;margin-right: 4px" data-bind="checked: newFieldIncludeInSorting" /> ${_('Include in default sorting')}
|
|
|
+ </label>
|
|
|
<br/>
|
|
|
<br/>
|
|
|
<a class="btn" data-bind="click: $root.addSortingField"><i class="icon-plus-sign"></i> ${_('Add to Sorting')}</a>
|
|
|
@@ -115,20 +119,21 @@ ${ commonheader(_('Search'), "search", user, "40px") | n,unicode }
|
|
|
}
|
|
|
</style>
|
|
|
|
|
|
-
|
|
|
+<script src="/search/static/js/knockout-sortable.min.js" type="text/javascript" charset="utf-8"></script>
|
|
|
<script src="/static/ext/js/jquery/plugins/jquery-ui-draggable-droppable-sortable-1.8.23.min.js"></script>
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
- var SortingField = function (field, label, asc) {
|
|
|
+ var SortingField = function (field, label, asc, include) {
|
|
|
var _field = {
|
|
|
field: field,
|
|
|
label: ko.observable(label),
|
|
|
asc: ko.observable(asc),
|
|
|
- order: ko.observable(asc ? "ASC" : "DESC")
|
|
|
+ order: ko.observable(asc ? "ASC" : "DESC"),
|
|
|
+ include: ko.observable(include)
|
|
|
};
|
|
|
_field.label.subscribe(function (newValue) {
|
|
|
- if ($().trim(newValue) == "") {
|
|
|
+ if ($.trim(newValue) == "") {
|
|
|
_field.label(f.field);
|
|
|
}
|
|
|
});
|
|
|
@@ -140,6 +145,7 @@ ${ commonheader(_('Search'), "search", user, "40px") | n,unicode }
|
|
|
_field.asc(true);
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
return _field;
|
|
|
}
|
|
|
|
|
|
@@ -150,7 +156,7 @@ ${ commonheader(_('Search'), "search", user, "40px") | n,unicode }
|
|
|
self.isEnabled = ko.observable(${ hue_collection.sorting.data | n,unicode }.properties.is_enabled);
|
|
|
|
|
|
self.sortingFields = ko.observableArray(ko.utils.arrayMap(${ hue_collection.sorting.data | n,unicode }.fields, function (obj) {
|
|
|
- return new SortingField(obj.field, obj.label, obj.asc);
|
|
|
+ return new SortingField(obj.field, obj.label, obj.asc, obj.include);
|
|
|
}));
|
|
|
|
|
|
self.sortingFieldsList = ko.observableArray(${ hue_collection.fields(user) | n,unicode });
|
|
|
@@ -163,6 +169,8 @@ ${ commonheader(_('Search'), "search", user, "40px") | n,unicode }
|
|
|
self.newFieldLabel = ko.observable("");
|
|
|
self.newFieldAscDesc = ko.observable("asc");
|
|
|
|
|
|
+ self.newFieldIncludeInSorting = ko.observable(true);
|
|
|
+
|
|
|
self.removeSortingField = function (field) {
|
|
|
self.sortingFields.remove(field);
|
|
|
self.sortingFieldsList.sort();
|
|
|
@@ -175,9 +183,10 @@ ${ commonheader(_('Search'), "search", user, "40px") | n,unicode }
|
|
|
if (self.newFieldLabel() == ""){
|
|
|
self.newFieldLabel(self.newFieldSelect());
|
|
|
}
|
|
|
- self.sortingFields.push(new SortingField(self.newFieldSelect(), self.newFieldLabel(), self.newFieldAscDesc() == "asc"));
|
|
|
+ self.sortingFields.push(new SortingField(self.newFieldSelect(), self.newFieldLabel(), self.newFieldAscDesc() == "asc", self.newFieldIncludeInSorting()));
|
|
|
self.newFieldLabel("");
|
|
|
self.newFieldAscDesc("asc");
|
|
|
+ self.newFieldIncludeInSorting(true);
|
|
|
self.isEnabled(true);
|
|
|
};
|
|
|
|