summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/js/app.js')
-rw-r--r--apps/files_sharing/js/app.js61
1 files changed, 61 insertions, 0 deletions
diff --git a/apps/files_sharing/js/app.js b/apps/files_sharing/js/app.js
new file mode 100644
index 00000000000..887575193d0
--- /dev/null
+++ b/apps/files_sharing/js/app.js
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2014 Vincent Petry <pvince81@owncloud.com>
+ *
+ * This file is licensed under the Affero General Public License version 3
+ * or later.
+ *
+ * See the COPYING-README file.
+ *
+ */
+
+OCA.Sharing = {};
+OCA.Sharing.App = {
+
+ _inFileList: null,
+ _outFileList: null,
+
+ initSharingIn: function($el) {
+ if (this._inFileList) {
+ return;
+ }
+
+ this._inFileList = new OCA.Sharing.FileList(
+ $el,
+ {
+ scrollContainer: $('#app-content'),
+ sharedWithUser: true
+ }
+ );
+
+ var fileActions = _.extend({}, OCA.Files.FileActions);
+ fileActions.registerDefaultActions(this._inFileList);
+ this._inFileList.setFileActions(fileActions);
+ },
+
+ initSharingOut: function($el) {
+ if (this._outFileList) {
+ return;
+ }
+ this._outFileList = new OCA.Sharing.FileList(
+ $el,
+ {
+ scrollContainer: $('#app-content'),
+ sharedWithUser: false
+ }
+ );
+
+ var fileActions = _.extend({}, OCA.Files.FileActions);
+ fileActions.registerDefaultActions(this._outFileList);
+ this._outFileList.setFileActions(fileActions);
+ }
+};
+
+$(document).ready(function() {
+ $('#app-content-sharingin').one('show', function(e) {
+ OCA.Sharing.App.initSharingIn($(e.target));
+ });
+ $('#app-content-sharingout').one('show', function(e) {
+ OCA.Sharing.App.initSharingOut($(e.target));
+ });
+});
+