Add share dialog into share tab
This commit is contained in:
parent
6af6024e17
commit
018d07b3e5
3 changed files with 42 additions and 13 deletions
|
@ -54,9 +54,16 @@ $application->setupPropagation();
|
|||
\OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
|
||||
\OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
|
||||
|
||||
\OCP\Util::addScript('files_sharing', 'share');
|
||||
\OCP\Util::addScript('files_sharing', 'sharetabview');
|
||||
\OCP\Util::addScript('files_sharing', 'external');
|
||||
$eventDispatcher = \OC::$server->getEventDispatcher();
|
||||
$eventDispatcher->addListener(
|
||||
'OCA\Files::loadAdditionalScripts',
|
||||
function() {
|
||||
\OCP\Util::addScript('files_sharing', 'share');
|
||||
\OCP\Util::addScript('files_sharing', 'sharetabview');
|
||||
\OCP\Util::addScript('files_sharing', 'external');
|
||||
}
|
||||
);
|
||||
|
||||
// \OCP\Util::addStyle('files_sharing', 'sharetabview');
|
||||
|
||||
\OC::$server->getActivityManager()->registerExtension(function() {
|
||||
|
|
|
@ -151,9 +151,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
OC.addScript('files_sharing', 'sharetabview').done(function() {
|
||||
fileList.registerTabView(new OCA.Sharing.ShareTabView('shareTabView'));
|
||||
});
|
||||
fileList.registerTabView(new OCA.Sharing.ShareTabView('shareTabView'));
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,7 +10,10 @@
|
|||
|
||||
(function() {
|
||||
var TEMPLATE =
|
||||
'<div><ul>{{#if owner}}<li>Owner: {{owner}}</li>{{/if}}</ul></div>';
|
||||
'<div>' +
|
||||
'<ul>{{#if owner}}<li>Owner: {{owner}}</li>{{/if}}</ul>' +
|
||||
'<div class="dialogContainer"></div>' +
|
||||
'</div>';
|
||||
|
||||
/**
|
||||
* @memberof OCA.Sharing
|
||||
|
@ -20,7 +23,12 @@
|
|||
id: 'shareTabView',
|
||||
className: 'tab shareTabView',
|
||||
|
||||
_template: null,
|
||||
template: function(params) {
|
||||
if (!this._template) {
|
||||
this._template = Handlebars.compile(TEMPLATE);
|
||||
}
|
||||
return this._template(params);
|
||||
},
|
||||
|
||||
getLabel: function() {
|
||||
return t('files_sharing', 'Sharing');
|
||||
|
@ -30,10 +38,10 @@
|
|||
* Renders this details view
|
||||
*/
|
||||
render: function() {
|
||||
this.$el.empty();
|
||||
|
||||
if (!this._template) {
|
||||
this._template = Handlebars.compile(TEMPLATE);
|
||||
if (this._dialog) {
|
||||
// remove/destroy older instance
|
||||
this._dialog.remove();
|
||||
this._dialog = null;
|
||||
}
|
||||
|
||||
if (this.model) {
|
||||
|
@ -42,11 +50,27 @@
|
|||
if (owner === OC.currentUser) {
|
||||
owner = null;
|
||||
}
|
||||
this.$el.append(this._template({
|
||||
this.$el.html(this.template({
|
||||
owner: owner
|
||||
}));
|
||||
|
||||
var attributes = {
|
||||
itemType: 'file',
|
||||
itemSource: this.model.get('id'),
|
||||
// TODO: make these available
|
||||
possiblePermissions: this.model.get('sharingPossiblePermissions')
|
||||
};
|
||||
var shareModel = new OC.Share.ShareItemModel(attributes, {configModel: configModel});
|
||||
var configModel = new OC.Share.ShareConfigModel();
|
||||
this._dialog = new OC.Share.ShareDialogView({
|
||||
configModel: configModel,
|
||||
model: shareModel
|
||||
});
|
||||
this.$el.find('.dialogContainer').append(this._dialog.$el);
|
||||
this._dialog.render();
|
||||
shareModel.fetch();
|
||||
} else {
|
||||
this.$el.empty();
|
||||
// TODO: render placeholder text?
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue