2015-07-15 17:09:00 +03:00
|
|
|
/*
|
|
|
|
* 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 =
|
2015-08-14 16:54:27 +03:00
|
|
|
'<div><ul>{{#if owner}}<li>Owner: {{owner}}</li>{{/if}}</ul></div>';
|
2015-07-15 17:09:00 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @memberof OCA.Sharing
|
|
|
|
*/
|
2015-08-12 18:30:20 +03:00
|
|
|
var ShareTabView = OCA.Files.DetailTabView.extend(
|
2015-07-15 17:09:00 +03:00
|
|
|
/** @lends OCA.Sharing.ShareTabView.prototype */ {
|
2015-08-12 18:30:20 +03:00
|
|
|
id: 'shareTabView',
|
|
|
|
className: 'tab shareTabView',
|
2015-07-15 17:09:00 +03:00
|
|
|
|
2015-08-12 18:30:20 +03:00
|
|
|
_template: null,
|
2015-07-15 17:09:00 +03:00
|
|
|
|
|
|
|
getLabel: function() {
|
|
|
|
return t('files_sharing', 'Sharing');
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders this details view
|
|
|
|
*/
|
|
|
|
render: function() {
|
|
|
|
this.$el.empty();
|
|
|
|
|
|
|
|
if (!this._template) {
|
|
|
|
this._template = Handlebars.compile(TEMPLATE);
|
|
|
|
}
|
|
|
|
|
2015-08-12 18:30:20 +03:00
|
|
|
if (this.model) {
|
2015-08-14 16:54:27 +03:00
|
|
|
console.log(this.model);
|
|
|
|
var owner = this.model.get('shareOwner');
|
|
|
|
if (owner === OC.currentUser) {
|
|
|
|
owner = null;
|
|
|
|
}
|
2015-07-15 18:05:25 +03:00
|
|
|
this.$el.append(this._template({
|
2015-08-14 16:54:27 +03:00
|
|
|
owner: owner
|
2015-07-15 18:05:25 +03:00
|
|
|
}));
|
2015-07-15 18:35:35 +03:00
|
|
|
|
2015-07-15 17:09:00 +03:00
|
|
|
} else {
|
|
|
|
// TODO: render placeholder text?
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
OCA.Sharing.ShareTabView = ShareTabView;
|
|
|
|
})();
|
|
|
|
|