Commit 86ba08a0 by Dányi Bence

one: sort files by size

parent 664f1793
...@@ -200,7 +200,16 @@ $(function() { ...@@ -200,7 +200,16 @@ $(function() {
return 1; return 1;
} }
return -1; return -1;
},
size: function(a, b) {
if(a.type === b.type) {
return b.originalSize-a.originalSize;
} }
if(a.type === 'fájl') {
return 1;
}
return -1;
},
}[self.sortBy()]); }[self.sortBy()]);
} }
...@@ -258,6 +267,7 @@ $(function() { ...@@ -258,6 +267,7 @@ $(function() {
if(d.TYPE === 'D') { if(d.TYPE === 'D') {
viewData = { viewData = {
originalName: d.NAME, originalName: d.NAME,
originalSize: 0,
name: d.NAME.length > 30 ? (d.NAME.substr(0, 27) + '...') : d.NAME, name: d.NAME.length > 30 ? (d.NAME.substr(0, 27) + '...') : d.NAME,
size: 'katalógus', size: 'katalógus',
type: 'katalógus', type: 'katalógus',
...@@ -288,6 +298,7 @@ $(function() { ...@@ -288,6 +298,7 @@ $(function() {
} }
viewData = { viewData = {
originalName: d.NAME, originalName: d.NAME,
originalSize: d.SIZE,
name: d.NAME.length > 30 ? (d.NAME.substr(0, 27) + '...') : d.NAME, name: d.NAME.length > 30 ? (d.NAME.substr(0, 27) + '...') : d.NAME,
size: convert(d.SIZE), size: convert(d.SIZE),
type: 'fájl', type: 'fájl',
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<select data-bind="value: sortBy"> <select data-bind="value: sortBy">
<option value="name">Név szerint</option> <option value="name">Név szerint</option>
<option value="date">Dátum szerint</option> <option value="date">Dátum szerint</option>
<option value="size">Méret szerint</option>
</select> </select>
</div> </div>
<div class="name"><small>Jelenlegi hely: <span data-bind="text: currentPath"></span></small></div> <div class="name"><small>Jelenlegi hely: <span data-bind="text: currentPath"></span></small></div>
......
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 sign in to comment