Commit 02ccb9af by Dányi Bence

one: all files are displayed by default

parent 77a16324
...@@ -38,15 +38,6 @@ $(function() { ...@@ -38,15 +38,6 @@ $(function() {
} }
$('.wm .summary').unbind('click').click(toggleDetails); $('.wm .summary').unbind('click').click(toggleDetails);
$('#load-more-files').click(function() {
$('.actions', this).show();
var that = this;
setTimeout(function() {
$(that).prev('li').slideDown(500, function() {
$('.actions', that).hide();
});
}, 2000);
})
$('#new-wm-button').click(function() { $('#new-wm-button').click(function() {
$('#modal').show(); $('#modal').show();
$('#modal-container').html($('#new-wm').html()); $('#modal-container').html($('#new-wm').html());
...@@ -106,12 +97,8 @@ $(function() { ...@@ -106,12 +97,8 @@ $(function() {
var uploadURLRequestInProgress = false; var uploadURLRequestInProgress = false;
//currently displayed files //currently displayed files
self.files = ko.observableArray(); self.files = ko.observableArray();
//all fetched files
self.allFiles = [];
//false, if you are in / //false, if you are in /
self.notInRoot = ko.observable(false); self.notInRoot = ko.observable(false);
//default file limit
self.fileLimit = 5;
//defalut path to display //defalut path to display
self.currentPath = ko.observable('/'); self.currentPath = ko.observable('/');
//default upload url (invalid) //default upload url (invalid)
...@@ -142,7 +129,6 @@ $(function() { ...@@ -142,7 +129,6 @@ $(function() {
$('#current-location select').on('change', function() { $('#current-location select').on('change', function() {
self.sortBy($('#current-location select').val()); self.sortBy($('#current-location select').val());
sortOriginalFiles();
sortFiles(); sortFiles();
}) })
...@@ -217,28 +203,6 @@ $(function() { ...@@ -217,28 +203,6 @@ $(function() {
} }
}[self.sortBy()]); }[self.sortBy()]);
} }
var sortOriginalFiles = function() {
self.allFiles.sort({
name: function(a, b) {
if(a.TYPE === b.TYPE) {
return a.NAME.localeCompare(b.NAME);
}
if(a.TYPE === 'F') {
return 1;
}
return -1;
},
date: function(a, b) {
if(a.TYPE === b.TYPE) {
return new Date(b.MTIME).getTime() - new Date(a.MTIME).getTime();
}
if(a.TYPE === 'F') {
return 1;
}
return -1;
}
}[self.sortBy()]);
}
/** /**
* Loads the specified folder * Loads the specified folder
...@@ -279,11 +243,8 @@ $(function() { ...@@ -279,11 +243,8 @@ $(function() {
var added = 0; var added = 0;
self.notInRoot(self.currentPath().lastIndexOf('/') !== 0); self.notInRoot(self.currentPath().lastIndexOf('/') !== 0);
self.files([]); self.files([]);
self.allFiles = data; for(var i in data) {
sortOriginalFiles(); addFile(data[i]);
for(var i in self.allFiles) {
added++;
if(added < 6) addFile(self.allFiles[i]);
} }
sortFiles(); sortFiles();
} }
...@@ -330,18 +291,6 @@ $(function() { ...@@ -330,18 +291,6 @@ $(function() {
} }
/** /**
* Shows 5 more files (in the current folder)
*/
self.showMore = function() {
for(var i = self.fileLimit; i < self.fileLimit + 5; i++) {
if(self.allFiles[i] === undefined) break;
addFile(self.allFiles[i]);
}
self.fileLimit += 5;
sortFiles();
}
/**
* Downloads the specified file (or folder zipped) * Downloads the specified file (or folder zipped)
*/ */
self.download = function(item) { self.download = function(item) {
......
...@@ -65,14 +65,6 @@ ...@@ -65,14 +65,6 @@
<!-- /ko --> <!-- /ko -->
</ul> </ul>
<ul class="file-list"> <ul class="file-list">
<li class="file-details wm small-row" id="load-more-files" data-bind="visible: (files().length>0 && files().length != allFiles.length)">
<div class="summary" data-bind="click: showMore">
<div class="name filetype-more">
{% trans "Show more files…" %} (<span data-bind="text: allFiles.length-files().length"></span> {% trans "hidden" context "is" %})
</div>
<div class="clear"></div>
</div>
</li>
<li class="wm small-row"> <li class="wm small-row">
<div class="summary" id="new-folder"> <div class="summary" id="new-folder">
<div class="name filetype-new-folder">{% trans "Create folder" %}</div> <div class="name filetype-new-folder">{% trans "Create folder" %}</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