summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkondou <kondou@ts.unde.re>2013-04-06 14:42:56 +0200
committerkondou <kondou@ts.unde.re>2013-04-06 14:42:56 +0200
commitfba6681f7197650934b1bf76c8ea71f832ccd226 (patch)
tree8d1b75a0fdb109707d869c2332f5091f343fdd56
parent6231e5be39b1939b8ec0d7ee96aaa7d48e71f0d1 (diff)
downloadnextcloud-server-fba6681f7197650934b1bf76c8ea71f832ccd226.tar.gz
nextcloud-server-fba6681f7197650934b1bf76c8ea71f832ccd226.zip
Make directories show at top.
-rw-r--r--core/js/oc-dialogs.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index 2a6f1ff1638..cd5412fdeda 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -296,10 +296,20 @@ var OCdialogs = {
fillFilePicker:function(request, dialog_content_id) {
var template = '<div data-entryname="*ENTRYNAME*" data-dcid="' + escapeHTML(dialog_content_id) + '" data="*ENTRYTYPE*"><img src="*MIMETYPEICON*" style="margin: 2px 1em 0 4px;"><span class="filename">*NAME*</span><div style="float:right;margin-right:1em;">*LASTMODDATE*</div></div>';
var files = '';
+ var dirs = [];
+ var others = [];
$.each(request.data, function(index, file) {
- files += template.replace('*LASTMODDATE*', OC.mtime2date(file.mtime)).replace('*NAME*', escapeHTML(file.name)).replace('*MIMETYPEICON*', file.mimetype_icon).replace('*ENTRYNAME*', escapeHTML(file.name)).replace('*ENTRYTYPE*', escapeHTML(file.type));
+ if (file.type === 'dir') {
+ dirs.push(file);
+ } else {
+ others.push(file);
+ }
});
-
+ var sorted = dirs.concat(others);
+ for (var i = 0; i < sorted.length; i++) {
+ files += template.replace('*LASTMODDATE*', OC.mtime2date(sorted[i].mtime)).replace('*NAME*', escapeHTML(sorted[i].name)).replace('*MIMETYPEICON*', sorted[i].mimetype_icon).replace('*ENTRYNAME*', escapeHTML(sorted[i].name)).replace('*ENTRYTYPE*', escapeHTML(sorted[i].type));
+ }
+
$(dialog_content_id + ' #filelist').html(files).on('click', '[data="file"]', function() {
OCdialogs.handlePickerClick(this, $(this).data('entryname'), $(this).data('dcid'));
});