diff options
Diffstat (limited to 'apps/files/js/filelist.js')
-rw-r--r-- | apps/files/js/filelist.js | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index a8daeadfd26..3a59da53517 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -442,7 +442,9 @@ // In the future the FileList should work with Backbone.Collection // and contain existing models that can be used. // This method would in the future simply retrieve the matching model from the collection. - var model = new OCA.Files.FileInfoModel(this.elementToFile($tr)); + var model = new OCA.Files.FileInfoModel(this.elementToFile($tr), { + filesClient: this.filesClient + }); if (!model.get('path')) { model.set('path', this.getCurrentDirectory(), {silent: true}); } @@ -891,11 +893,14 @@ mimetype: $el.attr('data-mime'), mtime: parseInt($el.attr('data-mtime'), 10), type: $el.attr('data-type'), - size: parseInt($el.attr('data-size'), 10), etag: $el.attr('data-etag'), permissions: parseInt($el.attr('data-permissions'), 10), hasPreview: $el.attr('data-has-preview') === 'true' }; + var size = $el.attr('data-size'); + if (size) { + data.size = parseInt(size, 10); + } var icon = $el.attr('data-icon'); if (icon) { data.icon = icon; @@ -1029,7 +1034,7 @@ * Returns whether the given file info must be hidden * * @param {OC.Files.FileInfo} fileInfo file info - * + * * @return {boolean} true if the file is a hidden file, false otherwise */ _isHiddenFile: function(file) { @@ -1175,7 +1180,7 @@ var innernameSpan = $('<span></span>').addClass('innernametext').text(basename); if (path && path !== '/') { - var conflictingItems = this.$fileList.find('tr[data-file="' + name.replace( /(:|\.|\[|\]|,|=)/g, "\\$1") + '"]'); + var conflictingItems = this.$fileList.find('tr[data-file="' + this._jqSelEscape(name) + '"]'); if (conflictingItems.length !== 0) { if (conflictingItems.length === 1) { // Update the path on the first conflicting item @@ -1261,6 +1266,14 @@ return tr; }, + /* escape a selector expression for jQuery */ + _jqSelEscape: function (expression) { + if (expression) { + return expression.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]^`{|}~]/g, '\\$&'); + } + return null; + }, + /** * Adds an entry to the files array and also into the DOM * in a sorted manner. @@ -2465,6 +2478,11 @@ if (!_.isArray(file)) { file = [file]; } + if (file.length === 1) { + _.defer(function() { + this.showDetailsView(file[0]); + }.bind(this)); + } this.highlightFiles(file, function($tr) { $tr.addClass('searchresult'); $tr.one('hover', function() { @@ -2828,7 +2846,6 @@ }); uploader.on('fail', function(e, data) { self._uploader.log('filelist handle fileuploadfail', e, data); - self._uploads = []; //if user pressed cancel hide upload chrome @@ -2939,7 +2956,7 @@ this._newFileMenu = new OCA.Files.NewFileMenu({ fileList: this }); - $('body').append(this._newFileMenu.$el); + $('.actions').append(this._newFileMenu.$el); } this._newFileMenu.showAt($target); |