diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-10-01 12:10:50 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-10-01 17:06:24 +0200 |
commit | b6114ba2b6fc7c7f40478c1fcde5fa4cae5bf726 (patch) | |
tree | c739ed246aabc1f0cf99d7af461bf28f1a5eaf62 /apps/files_versions | |
parent | eeac6e2ab17bb9bfd94c51e8e026daa25ef3a033 (diff) | |
download | nextcloud-server-b6114ba2b6fc7c7f40478c1fcde5fa4cae5bf726.tar.gz nextcloud-server-b6114ba2b6fc7c7f40478c1fcde5fa4cae5bf726.zip |
Reload versions list after revert
Diffstat (limited to 'apps/files_versions')
-rw-r--r-- | apps/files_versions/js/versioncollection.js | 5 | ||||
-rw-r--r-- | apps/files_versions/js/versionstabview.js | 10 |
2 files changed, 13 insertions, 2 deletions
diff --git a/apps/files_versions/js/versioncollection.js b/apps/files_versions/js/versioncollection.js index 3f8214cde8c..176f8e7529c 100644 --- a/apps/files_versions/js/versioncollection.js +++ b/apps/files_versions/js/versioncollection.js @@ -67,6 +67,11 @@ return this.fetch({remove: false}); }, + reset: function() { + this._currentIndex = 0; + OC.Backbone.Collection.prototype.reset.apply(this, arguments); + }, + parse: function(result) { var results = _.map(result.data.versions, function(version) { var revision = parseInt(version.version, 10); diff --git a/apps/files_versions/js/versionstabview.js b/apps/files_versions/js/versionstabview.js index 55f24868196..f2b1c18bd37 100644 --- a/apps/files_versions/js/versionstabview.js +++ b/apps/files_versions/js/versionstabview.js @@ -85,12 +85,18 @@ ev.preventDefault(); revision = $target.attr('data-revision'); + this.$el.find('.versions, .showMoreVersions').addClass('hidden'); + var versionModel = this.collection.get(revision); versionModel.revert({ success: function() { // reset and re-fetch the updated collection + self.$versionsContainer.empty(); self.collection.setFileInfo(fileInfoModel); - self.collection.fetch(); + self.collection.reset([], {silent: true}); + self.collection.fetchNext(); + + self.$el.find('.versions').removeClass('hidden'); // update original model fileInfoModel.trigger('busy', fileInfoModel, false); @@ -157,7 +163,7 @@ if (fileInfo) { this.render(); this.collection.setFileInfo(fileInfo); - this.collection.reset({silent: true}); + this.collection.reset([], {silent: true}); this.nextPage(); } else { this.render(); |