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

FileManager: added menu button for sort order changing

parent 2aeac57b
......@@ -71,6 +71,39 @@ define([
}
}
},
sortType: {
label: "Sort",
iconClass: "fa fa-sort",
buttonClass: "btn-default",
position: 5,
fastmenu: "dropdown",
items: {
name: {
label: "Name",
iconClass: "fa-sort-alpha-asc",
buttonClass: "btn-default",
callback: function () {
this.$root.instance.vue.content.sortMod("name");
},
},
size: {
label: "Size",
iconClass: "fa-sort-amount-asc",
buttonClass: "btn-default",
callback: function () {
this.$root.instance.vue.content.sortMod("size");
},
},
modified: {
label: "Modified date",
iconClass: "fa-sort-numeric-asc",
buttonClass: "btn-default",
callback: function () {
this.$root.instance.vue.content.sortMod("modified");
},
},
},
},
};
return menu;
......
......@@ -22,23 +22,7 @@ define([
this.$dispatch("openMenu", {}, ev);
},
sortMod: function(col) {
var so = this.$root.pref("sortOrder");
var plop = function(n, m) {
var i = so.indexOf(n);
switch(i) {
case -1:
return true;
case 0:
so.$set(0, m);
return false;
default:
so.splice(i, 1);
so.splice(0, 0, n);
return false;
}
};
if (plop(col, "-"+col) && plop("-"+col, col))
so.splice(0, 0, col);
this.$parent.sortMod(col);
},
sortCurr: function(col) {
var so = this.$root.pref("sortOrder")[0];
......
......@@ -83,6 +83,25 @@ define([
}
},
methods: {
sortMod: function(col) {
var so = this.pref("sortOrder");
var plop = function(n, m) {
var i = so.indexOf(n);
switch(i) {
case -1:
return true;
case 0:
so.$set(0, m);
return false;
default:
so.splice(i, 1);
so.splice(0, 0, n);
return false;
}
};
if (plop(col, "-"+col) && plop("-"+col, col))
so.splice(0, 0, col);
},
filterStart: function() {
this.filterActive = true;
this.filterFocus();
......
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