summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js/sharedetailview.js
blob: a18a6d19d15f0f7d016ac993a1b435906f82d384 (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
62
63
/*
 * Copyright (c) 2015
 *
 * This file is licensed under the Affero General Public License version 3
 * or later.
 *
 * See the COPYING-README file.
 *
 */

(function() {
	var TEMPLATE =
		'<ul class="shareDetailList">' +
		'   <li>Owner: {{owner}}</li>' +
		'</ul>';

	/**
	 * @class OCA.Files.MainFileInfoDetailView
	 * @classdesc
	 *
	 * Displays main details about a file
	 *
	 */
	var ShareDetailView = function() {
		this.initialize();
	};
	/**
	 * @memberof OCA.Sharing
	 */
	ShareDetailView.prototype = _.extend({}, OCA.Files.DetailFileInfoView.prototype,
		/** @lends OCA.Sharing.ShareDetailView.prototype */ {
		_template: null,

		/**
		 * Initialize the details view
		 */
		initialize: function() {
			this.$el = $('<div class="shareDetailView"></div>');
		},

		/**
		 * Renders this details view
		 */
		render: function() {
			this.$el.empty();

			if (!this._template) {
				this._template = Handlebars.compile(TEMPLATE);
			}

			if (this._fileInfo) {
				this.$el.append(this._template({
					owner: this._fileInfo.shareOwner || OC.currentUser
				}));
			} else {
				// TODO: render placeholder text?
			}
		}
	});

	OCA.Sharing.ShareDetailView = ShareDetailView;
})();