summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js/app.js
blob: 887575193d075e7b9be8ee75bd7d9cf73a008b27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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));
	});
});