fixed search and filter

This commit is contained in:
Teja 2015-07-06 14:46:04 +02:00
parent 31f2cbb64b
commit f0c5173dd1
2 changed files with 5 additions and 5 deletions

View file

@ -18,7 +18,6 @@ $(function() {
self.searchQuery = ko.observable(undefined);
self.searchQuery.subscribe(function() {
console.log("searhc update");
self.performSearch();
});
@ -48,9 +47,10 @@ $(function() {
return 0;
},
"size": function(a, b) {
var k = 'size';
// sorts descending
if (b["bytes"] === undefined || a["bytes"] > b["bytes"]) return -1;
if (a["bytes"] < b["bytes"]) return 1;
if (b[k] === undefined || a[k] > b[k]) return -1;
if (a[k] < b[k]) return 1;
return 0;
}
},
@ -615,6 +615,6 @@ $(function() {
OCTOPRINT_VIEWMODELS.push([
GcodeFilesViewModel,
["printerStateViewModel", "loginStateViewModel", "slicingViewModel"],
["#files_wrapper", "#files_search"]
["#files_wrapper", "#files_search", "#files_filter"]
]);
});

View file

@ -431,7 +431,7 @@
<input type="text" style="width:90%;" class="input-block search-query" data-bind="value: searchQuery, valueUpdate: 'input'" placeholder="{{ _('Search...') }}">
</form>
</div>
<ul class="file_list_filter">
<ul class="file_list_filter" id="files_filter">
<li><a href="#" data-bind="click: function() { $root.listHelper.changeSorting('name'); }"><i class="icon-ok" data-bind="style: {visibility: listHelper.currentSorting() == 'name' ? 'visible' : 'hidden'}"></i> {{ _('Sort by name') }} ({{ _('ascending') }})</a></li>
<li><a href="#" data-bind="click: function() { $root.listHelper.changeSorting('upload'); }"><i class="icon-ok" data-bind="style: {visibility: listHelper.currentSorting() == 'upload' ? 'visible' : 'hidden'}"></i> {{ _('Sort by upload date') }} ({{ _('descending') }})</a></li>
<li><a href="#" data-bind="click: function() { $root.listHelper.changeSorting('size'); }"><i class="icon-ok" data-bind="style: {visibility: listHelper.currentSorting() == 'size' ? 'visible' : 'hidden'}"></i> {{ _('Sort by file size') }} ({{ _('descending') }})</a></li>