Commit b3bfc5d6 authored by Benjamin Fischer's avatar Benjamin Fischer
Browse files

File2: migrated sortedItems to browser component

parent 2f9a079b
......@@ -12,7 +12,7 @@
:is="displayType"
:dims="dims"
:path="path"
:items="filterItems"
:items="sortedItems"
></component>
<div
v-show="filterActive"
......
......@@ -36,7 +36,7 @@
@contextmenu="openMenu"
>
<item
v-for="(i, d) in sortedItems"
v-for="(i, d) in items"
v-ref:items
:index="i"
:data="d"
......
......@@ -9,7 +9,7 @@
>
<div class="items">
<item
v-for="(i, d) in sortedItems"
v-for="(i, d) in items"
v-ref:items
:index="i"
:data="d"
......
......@@ -71,25 +71,6 @@ define([
downloadBase: function() {
return this.view.fileURL("");
},
sortedItems: function() {
var order = (this.$root.pref("dirFirst") ? ["type"] : []).concat(this.$root.pref("sortOrder"));
return this.items.slice().sort(function(a, b) {
var i=0, key, rev, va, vb;
while(key = order[i]) {
if (rev = (key[0] === "-"))
key = key.substring(1);
if ((va = a[key]) === (vb = b[key]))
i++;
else
return ((
(typeof va === "string") ?
(va.localeCompare(vb) == -1) :
(va < vb)
) === rev) ? 1 : -1;
}
return 0;
});
},
allSelected: {
get: function() {
var selAll;
......
......@@ -32,7 +32,7 @@ define([
this.$emit("nav", this.path);
},
computed: {
filterItems: function() {
filteredItems: function() {
var items = this.items;
if (this.filterActive && this.filterText) {
this.filterError = "";
......@@ -58,8 +58,27 @@ define([
}
return items;
},
sortedItems: function() {
var order = (this.pref("dirFirst") ? ["type"] : []).concat(this.pref("sortOrder"));
return this.filteredItems.slice().sort(function(a, b) {
var i=0, key, rev, va, vb;
while(key = order[i]) {
if (rev = (key[0] === "-"))
key = key.substring(1);
if ((va = a[key]) === (vb = b[key]))
i++;
else
return ((
(typeof va === "string") ?
(va.localeCompare(vb) == -1) :
(va < vb)
) === rev) ? 1 : -1;
}
return 0;
});
},
filterNum: function() {
return this.items.length - this.filterItems.length;
return this.items.length - this.filteredItems.length;
},
showHidden: function() {
return this.pref("showHidden");
......
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