ShareDialogResharerInfoView improvements

This commit is contained in:
Arthur Schiwon 2015-08-21 15:00:15 +02:00 committed by Vincent Petry
parent dcb084a617
commit 277b786886
3 changed files with 10 additions and 9 deletions

View File

@ -51,8 +51,7 @@
initialize: function(options) { initialize: function(options) {
var view = this; var view = this;
//FIXME: specific to reshares stuff this.model.on('change:reshare', function() {
this.model.on('change', function() {
view.render(); view.render();
}); });
@ -67,7 +66,7 @@
if ( !this.model.hasReshare() if ( !this.model.hasReshare()
|| !this.model.getReshareOwner() !== OC.currentUser) || !this.model.getReshareOwner() !== OC.currentUser)
{ {
this.$el.html(''); this.$el.empty();
return this; return this;
} }
@ -91,7 +90,8 @@
); );
} }
this.$el.html(reshareTemplate({ this.$el.empty();
this.$el.append(reshareTemplate({
avatarEnabled: this.configModel.areAvatarsEnabled(), avatarEnabled: this.configModel.areAvatarsEnabled(),
sharedByText: sharedByText sharedByText: sharedByText
})); }));

View File

@ -14,7 +14,7 @@
} }
var TEMPLATE_BASE = var TEMPLATE_BASE =
'{{{resharerInfo}}}' + '<div class="resharerInfo"></div>' +
'<label for="shareWith" class="hidden-visually">{{shareLabel}}</label>' + '<label for="shareWith" class="hidden-visually">{{shareLabel}}</label>' +
'<div class="oneline">' + '<div class="oneline">' +
' <input id="shareWith" type="text" placeholder="{{sharePlaceholder}}" />' + ' <input id="shareWith" type="text" placeholder="{{sharePlaceholder}}" />' +
@ -135,11 +135,8 @@
render: function() { render: function() {
var baseTemplate = this._getTemplate('base', TEMPLATE_BASE); var baseTemplate = this._getTemplate('base', TEMPLATE_BASE);
this.resharerInfoView.render();
this.$el.html(baseTemplate({ this.$el.html(baseTemplate({
shareLabel: t('core', 'Share'), shareLabel: t('core', 'Share'),
resharerInfo: this.resharerInfoView.el.innerHTML,
sharePlaceholder: this._renderSharePlaceholderPart(), sharePlaceholder: this._renderSharePlaceholderPart(),
remoteShareInfo: this._renderRemoteShareInfoPart(), remoteShareInfo: this._renderRemoteShareInfoPart(),
linkShare: this._renderLinkSharePart(), linkShare: this._renderLinkSharePart(),
@ -148,6 +145,9 @@
expiration: this._renderExpirationPart() expiration: this._renderExpirationPart()
})); }));
this.resharerInfoView.$el = this.$el.find('.resharerInfo');
this.resharerInfoView.render();
this.$el.find('.hasTooltip').tooltip(); this.$el.find('.hasTooltip').tooltip();
if(this.configModel.areAvatarsEnabled()) { if(this.configModel.areAvatarsEnabled()) {
this.$el.find('.avatar').avatar(this.model.getReshareOwner, 32); this.$el.find('.avatar').avatar(this.model.getReshareOwner, 32);

View File

@ -90,7 +90,8 @@
* @returns {boolean} * @returns {boolean}
*/ */
hasReshare: function() { hasReshare: function() {
return _.isObject(this.get('reshare')) && !_.isUndefined(this.get('reshare').uid_owner); var reshare = this.get('reshare');
return _.isObject(reshare) && !_.isUndefined(reshare.uid_owner);
}, },
/** /**