summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-05-12 19:54:20 +0200
committerVincent Petry <pvince81@owncloud.com>2014-05-15 17:51:04 +0200
commit6fd084243b65a556d4775209ba3916145ef5912a (patch)
tree6162c2af1861d8e3b8bbf1340ac55c4affc5ad61 /apps/files_trashbin/js
parent9d38e3602b2faf37d861729c52690ce51b8fee97 (diff)
downloadnextcloud-server-6fd084243b65a556d4775209ba3916145ef5912a.tar.gz
nextcloud-server-6fd084243b65a556d4775209ba3916145ef5912a.zip
Fixed many issues, clean up
- fixed upload and storage statistics - fixed infinite scroll to use the correct contain for scroll detection - fixed unit test that sometimes fail for rename case - controls are now sticky again - fixed selection overlay to be aligned with the table - fixed "select all" checkbox that had id conflicts - fixed public page - fixed global actions permissions detection - fix when URL contains an invalid view id - viewer mode now hides the sidebar (ex: text editor) - added unit tests for trashbin - clean up storage info in template (most is retrieved via ajax call now)
Diffstat (limited to 'apps/files_trashbin/js')
-rw-r--r--apps/files_trashbin/js/app.js8
-rw-r--r--apps/files_trashbin/js/filelist.js30
-rw-r--r--apps/files_trashbin/js/files.js23
3 files changed, 27 insertions, 34 deletions
diff --git a/apps/files_trashbin/js/app.js b/apps/files_trashbin/js/app.js
index 9ab78e7cbb3..aa499ae1791 100644
--- a/apps/files_trashbin/js/app.js
+++ b/apps/files_trashbin/js/app.js
@@ -17,7 +17,11 @@ OCA.Trashbin.App = {
return;
}
this._initialized = true;
- this.fileList = new OCA.Trashbin.FileList($el);
+ this.fileList = new OCA.Trashbin.FileList(
+ $('#app-content-trashbin'), {
+ scrollContainer: $('#app-content')
+ }
+ );
this.registerFileActions(this.fileList);
},
@@ -68,7 +72,7 @@ OCA.Trashbin.App = {
};
$(document).ready(function() {
- $('#app-content-trashbin').on('show', function() {
+ $('#app-content-trashbin').one('show', function() {
var App = OCA.Trashbin.App;
App.initialize($('#app-content-trashbin'));
// force breadcrumb init
diff --git a/apps/files_trashbin/js/filelist.js b/apps/files_trashbin/js/filelist.js
index d3206958e8b..205f879f335 100644
--- a/apps/files_trashbin/js/filelist.js
+++ b/apps/files_trashbin/js/filelist.js
@@ -30,6 +30,7 @@
this.initialize($el);
};
FileList.prototype = _.extend({}, OCA.Files.FileList.prototype, {
+ id: 'trashbin',
appName: t('files_trashbin', 'Deleted files'),
initialize: function() {
@@ -37,11 +38,6 @@
this.$el.find('.undelete').click('click', _.bind(this._onClickRestoreSelected, this));
this.setSort('mtime', 'desc');
-
- // override crumb URL maker
- this.breadcrumb.getCrumbUrl = function(part, index) {
- return OC.linkTo('files_trashbin', 'index.php')+"?view=trashbin&dir=" + encodeURIComponent(part.dir);
- };
/**
* Override crumb making to add "Deleted Files" entry
* and convert files with ".d" extensions to a more
@@ -58,6 +54,13 @@
return result;
},
+ /**
+ * Override to only return read permissions
+ */
+ getDirectoryPermissions: function() {
+ return OC.PERMISSION_READ | OC.PERMISSION_DELETE;
+ },
+
_setCurrentDir: function(targetDir) {
OCA.Files.FileList.prototype._setCurrentDir.apply(this, arguments);
@@ -97,8 +100,12 @@
return OC.filePath('files_trashbin', 'ajax', action + '.php') + q;
},
+ setupUploadEvents: function() {
+ // override and do nothing
+ },
+
linkTo: function(dir){
- return OC.linkTo('files_trashbin', 'index.php')+"?dir="+ encodeURIComponent(dir).replace(/%2F/g, '/');
+ return OC.linkTo('files', 'index.php')+"?view=trashbin&dir="+ encodeURIComponent(dir).replace(/%2F/g, '/');
},
updateEmptyContent: function(){
@@ -126,7 +133,7 @@
_onClickRestoreSelected: function(event) {
event.preventDefault();
var self = this;
- var allFiles = this.$el.find('#select_all').is(':checked');
+ var allFiles = this.$el.find('.select-all').is(':checked');
var files = [];
var params = {};
this.disableActions();
@@ -171,7 +178,7 @@
_onClickDeleteSelected: function(event) {
event.preventDefault();
var self = this;
- var allFiles = this.$el.find('#select_all').is(':checked');
+ var allFiles = this.$el.find('.select-all').is(':checked');
var files = [];
var params = {};
if (allFiles) {
@@ -230,7 +237,7 @@
return OC.generateUrl('/apps/files_trashbin/ajax/preview.php?') + $.param(urlSpec);
},
- getDownloadUrl: function(action, params) {
+ getDownloadUrl: function() {
// no downloads
return '#';
},
@@ -243,6 +250,11 @@
disableActions: function() {
this.$el.find('.action').css('display', 'none');
this.$el.find(':input:checkbox').css('display', 'none');
+ },
+
+ updateStorageStatistics: function() {
+ // no op because the trashbin doesn't have
+ // storage info like free space / used space
}
});
diff --git a/apps/files_trashbin/js/files.js b/apps/files_trashbin/js/files.js
deleted file mode 100644
index f46b96a40b3..00000000000
--- a/apps/files_trashbin/js/files.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2014
- *
- * This file is licensed under the Affero General Public License version 3
- * or later.
- *
- * See the COPYING-README file.
- *
- */
-
-(function() {
-
- var Files = _.extend({}, OCA.Files.Files, {
- updateStorageStatistics: function() {
- // no op because the trashbin doesn't have
- // storage info like free space / used space
- }
-
- });
-
- OCA.Trashbin.Files = Files;
-})();
-