aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js/sharetabview.js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-08-24 13:00:03 +0200
committerVincent Petry <pvince81@owncloud.com>2015-09-16 07:23:26 +0200
commit018d07b3e55fd7234008c51d0a124b7b681a1a4f (patch)
tree9df1d49f9cb1b3277bfc81cae6319c796df993b0 /apps/files_sharing/js/sharetabview.js
parent6af6024e172bc4810691f54ccaa2da6912395962 (diff)
downloadnextcloud-server-018d07b3e55fd7234008c51d0a124b7b681a1a4f.tar.gz
nextcloud-server-018d07b3e55fd7234008c51d0a124b7b681a1a4f.zip
Add share dialog into share tab
Diffstat (limited to 'apps/files_sharing/js/sharetabview.js')
-rw-r--r--apps/files_sharing/js/sharetabview.js38
1 files changed, 31 insertions, 7 deletions
diff --git a/apps/files_sharing/js/sharetabview.js b/apps/files_sharing/js/sharetabview.js
index ee572b747ea..99a5a0fb1db 100644
--- a/apps/files_sharing/js/sharetabview.js
+++ b/apps/files_sharing/js/sharetabview.js
@@ -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?
}
}