aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/js/app.js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-05-16 13:00:35 +0200
committerVincent Petry <pvince81@owncloud.com>2014-05-16 13:00:35 +0200
commit1fb0d5412c7a4a3b888098e492342699d05fe55e (patch)
tree436bab2e329cf0e3ff2080a4227338c131f85b57 /apps/files_trashbin/js/app.js
parent43d6650d194105dac30b11fb2ba4a3b3c7805650 (diff)
parent6fd084243b65a556d4775209ba3916145ef5912a (diff)
downloadnextcloud-server-1fb0d5412c7a4a3b888098e492342699d05fe55e.tar.gz
nextcloud-server-1fb0d5412c7a4a3b888098e492342699d05fe55e.zip
Merge pull request #6260 from owncloud/jan-navigation-filesidebar
Files app navigation sidebar
Diffstat (limited to 'apps/files_trashbin/js/app.js')
-rw-r--r--apps/files_trashbin/js/app.js82
1 files changed, 82 insertions, 0 deletions
diff --git a/apps/files_trashbin/js/app.js b/apps/files_trashbin/js/app.js
new file mode 100644
index 00000000000..aa499ae1791
--- /dev/null
+++ b/apps/files_trashbin/js/app.js
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2014
+ *
+ * This file is licensed under the Affero General Public License version 3
+ * or later.
+ *
+ * See the COPYING-README file.
+ *
+ */
+
+OCA.Trashbin = {};
+OCA.Trashbin.App = {
+ _initialized: false,
+
+ initialize: function($el) {
+ if (this._initialized) {
+ return;
+ }
+ this._initialized = true;
+ this.fileList = new OCA.Trashbin.FileList(
+ $('#app-content-trashbin'), {
+ scrollContainer: $('#app-content')
+ }
+ );
+ this.registerFileActions(this.fileList);
+ },
+
+ registerFileActions: function(fileList) {
+ var self = this;
+ var fileActions = _.extend({}, OCA.Files.FileActions);
+ fileActions.clear();
+ fileActions.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename) {
+ var dir = fileList.getCurrentDirectory();
+ if (dir !== '/') {
+ dir = dir + '/';
+ }
+ fileList.changeDirectory(dir + filename);
+ });
+
+ fileActions.setDefault('dir', 'Open');
+
+ fileActions.register('all', 'Restore', OC.PERMISSION_READ, OC.imagePath('core', 'actions/history'), function(filename) {
+ var tr = fileList.findFileEl(filename);
+ var deleteAction = tr.children("td.date").children(".action.delete");
+ deleteAction.removeClass('delete-icon').addClass('progress-icon');
+ fileList.disableActions();
+ $.post(OC.filePath('files_trashbin', 'ajax', 'undelete.php'), {
+ files: JSON.stringify([filename]),
+ dir: fileList.getCurrentDirectory()
+ },
+ _.bind(fileList._removeCallback, fileList)
+ );
+ }, t('files_trashbin', 'Restore'));
+
+ fileActions.register('all', 'Delete', OC.PERMISSION_READ, function() {
+ return OC.imagePath('core', 'actions/delete');
+ }, function(filename) {
+ $('.tipsy').remove();
+ var tr = fileList.findFileEl(filename);
+ var deleteAction = tr.children("td.date").children(".action.delete");
+ deleteAction.removeClass('delete-icon').addClass('progress-icon');
+ fileList.disableActions();
+ $.post(OC.filePath('files_trashbin', 'ajax', 'delete.php'), {
+ files: JSON.stringify([filename]),
+ dir: fileList.getCurrentDirectory()
+ },
+ _.bind(fileList._removeCallback, fileList)
+ );
+ });
+ fileList.setFileActions(fileActions);
+ }
+};
+
+$(document).ready(function() {
+ $('#app-content-trashbin').one('show', function() {
+ var App = OCA.Trashbin.App;
+ App.initialize($('#app-content-trashbin'));
+ // force breadcrumb init
+ // App.fileList.changeDirectory(App.fileList.getCurrentDirectory(), false, true);
+ });
+});
+