started to implement sharee list view. not completed yet, do not cry please.

This commit is contained in:
Arthur Schiwon 2015-08-25 16:07:14 +02:00 committed by Vincent Petry
parent f62a3be590
commit c17d022ca4
4 changed files with 125 additions and 3 deletions

View file

@ -55,6 +55,13 @@
return oc_appconfig.core.remoteShareAllowed;
},
/**
* @returns {boolean}
*/
isResharingAllowed: function() {
return oc_appconfig.core.resharingAllowed
},
/**
* @returns {boolean}
*/

View file

@ -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;
})();

View file

@ -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);

View file

@ -88,6 +88,7 @@ class Share extends Constants {
\OC_Util::addScript('core', 'sharedialogresharerinfoview');
\OC_Util::addScript('core', 'sharedialoglinkshareview');
\OC_Util::addScript('core', 'sharedialogexpirationview');
\OC_Util::addScript('core', 'sharedialogshareelistview');
\OC_Util::addScript('core', 'sharedialogview');
\OC_Util::addScript('core', 'share');
\OC_Util::addStyle('core', 'share');