summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2015-08-25 16:07:14 +0200
committerVincent Petry <pvince81@owncloud.com>2015-09-16 07:23:27 +0200
commitc17d022ca42dda31f321276f2c4973ca2e43c8a4 (patch)
tree1f6b396a40bda268ab609e263edf6c493325fc97 /core/js
parentf62a3be59069510f4afa479316a665011cd014f5 (diff)
downloadnextcloud-server-c17d022ca42dda31f321276f2c4973ca2e43c8a4.tar.gz
nextcloud-server-c17d022ca42dda31f321276f2c4973ca2e43c8a4.zip
started to implement sharee list view. not completed yet, do not cry please.
Diffstat (limited to 'core/js')
-rw-r--r--core/js/shareconfigmodel.js7
-rw-r--r--core/js/sharedialogshareelistview.js111
-rw-r--r--core/js/sharedialogview.js9
3 files changed, 124 insertions, 3 deletions
diff --git a/core/js/shareconfigmodel.js b/core/js/shareconfigmodel.js
index 857e356a351..e948c57cbac 100644
--- a/core/js/shareconfigmodel.js
+++ b/core/js/shareconfigmodel.js
@@ -58,6 +58,13 @@
/**
* @returns {boolean}
*/
+ isResharingAllowed: function() {
+ return oc_appconfig.core.resharingAllowed
+ },
+
+ /**
+ * @returns {boolean}
+ */
isShareWithLinkAllowed: function() {
return $('#allowShareWithLink').val() === 'yes';
},
diff --git a/core/js/sharedialogshareelistview.js b/core/js/sharedialogshareelistview.js
new file mode 100644
index 00000000000..177e0b4a899
--- /dev/null
+++ b/core/js/sharedialogshareelistview.js
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2015
+ *
+ * This file is licensed under the Affero General Public License version 3
+ * or later.
+ *
+ * See the COPYING-README file.
+ *
+ */
+
+(function() {
+ if (!OC.Share) {
+ OC.Share = {};
+ }
+
+ var TEMPLATE =
+ '<ul id="shareWithList">' +
+ '{{#each sharees}}' +
+ ' <li data-share-type="{{shareType}}" data-share-with="{{shareWith}}" title="{{shareWith}}">' +
+ ' <a href="#" class="unshare"><img class="svg" alt="{{unshareLabel}}" title="{{unshareLabel}}" src="{{unshareImage}}" /></a>' +
+ ' {{#if avatarEnabled}}' +
+ ' <div class="avatar"></div>' +
+ ' {{/if}}' +
+ ' <span class="username">{{shareWithDisplayName}}</span>' +
+ ' {{#if mailPublicNotificationEnabled}} {{#unless isRemoteShare}}' +
+ ' <label><input type="checkbox" name="mailNotification" class="mailNotification" {{isMailSent}} />{{notifyByMailLabel}}</label>' +
+ ' {{/unless}} {{/if}}' +
+ ' {{#if isResharingAllowed}} {{#if hasSharePermission}}' +
+ ' {{/if}} {{/if}}' +
+ ' </li>' +
+ '{{/each}}' +
+ '</ul>'
+ ;
+
+ /**
+ * @class OCA.Share.ShareDialogShareeListView
+ * @member {OC.Share.ShareItemModel} model
+ * @member {jQuery} $el
+ * @memberof OCA.Sharing
+ * @classdesc
+ *
+ * Represents the sharee list part in the GUI of the share dialogue
+ *
+ */
+ var ShareDialogShareeListView = OC.Backbone.View.extend({
+ /** @type {string} **/
+ id: 'shareDialogLinkShare',
+
+ /** @type {OC.Share.ShareConfigModel} **/
+ configModel: undefined,
+
+ /** @type {Function} **/
+ _template: undefined,
+
+ /** @type {boolean} **/
+ showLink: true,
+
+ initialize: function(options) {
+ if(!_.isUndefined(options.configModel)) {
+ this.configModel = options.configModel;
+ } else {
+ throw 'missing OC.Share.ShareConfigModel';
+ }
+ },
+
+ getShareeList: function() {
+ var universal = {
+ avatarEnabled: this.configModel.areAvatarsEnabled(),
+ mailPublicNotificationEnabled: this.configModel.isMailPublicNotificationEnabled(),
+ notifyByMailLabel: t('core', 'notify by email'),
+ unshareLabel: t('core', 'Unshare'),
+ unshareImage: OC.imagePath('core', 'actions/delete')
+ };
+
+ // TODO: sharess must have following attributes
+ // shareType
+ // shareWith
+ // shareWithDisplayName
+ // isRemoteShare
+ // isMailSent
+
+ var list = _.extend({}, universal);
+
+ return list;
+ },
+
+ render: function() {
+ var shareeListTemplate = this.template();
+ this.$el.html(shareeListTemplate({
+ sharees: this.getShareeList()
+ }));
+
+ return this;
+ },
+
+ /**
+ * @returns {Function} from Handlebars
+ * @private
+ */
+ template: function () {
+ if (!this._template) {
+ this._template = Handlebars.compile(TEMPLATE);
+ }
+ return this._template;
+ }
+
+ });
+
+ OC.Share.ShareDialogShareeListView = ShareDialogShareeListView;
+
+})();
diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js
index 8cd68962d42..2348c14bb88 100644
--- a/core/js/sharedialogview.js
+++ b/core/js/sharedialogview.js
@@ -22,8 +22,7 @@
'</div>' +
// FIXME: find a good position for remoteShareInfo
'{{{remoteShareInfo}}}' +
- '<ul id="shareWithList">' +
- '</ul>' +
+ '<div class="shareeListView"></div>' +
'<div class="linkShareView"></div>' +
'<div class="expirationView"></div>'
;
@@ -88,7 +87,8 @@
var subViews = {
resharerInfoView: 'ShareDialogResharerInfoView',
linkShareView: 'ShareDialogLinkShareView',
- expirationView: 'ShareDialogExpirationView'
+ expirationView: 'ShareDialogExpirationView',
+ shareeListView: 'ShareDialogShareeListView'
};
for(var name in subViews) {
@@ -117,6 +117,9 @@
this.expirationView.$el = this.$el.find('.expirationView');
this.expirationView.render();
+ this.shareeListView.$el = this.$el.find('.shareeListView');
+ this.shareeListView.redner();
+
this.$el.find('.hasTooltip').tooltip();
if(this.configModel.areAvatarsEnabled()) {
this.$el.find('.avatar').avatar(this.model.getReshareOwner, 32);