simplification, and throwing where throwing is needed

This commit is contained in:
Arthur Schiwon 2015-08-24 23:20:01 +02:00 committed by Vincent Petry
parent f709022559
commit fdb95613e9
4 changed files with 8 additions and 12 deletions

View File

@ -48,7 +48,7 @@
if(!_.isUndefined(options.configModel)) { if(!_.isUndefined(options.configModel)) {
this.configModel = options.configModel; this.configModel = options.configModel;
} else { } else {
console.warn('missing OC.Share.ShareConfigModel'); throw 'missing OC.Share.ShareConfigModel';
} }
}, },
@ -64,8 +64,7 @@
} }
var expirationTemplate = this.template(); var expirationTemplate = this.template();
this.$el.empty(); this.$el.html(expirationTemplate({
this.$el.append(expirationTemplate({
setExpirationLabel: t('core', 'Set expiration date'), setExpirationLabel: t('core', 'Set expiration date'),
expirationLabel: t('core', 'Expiration'), expirationLabel: t('core', 'Expiration'),
expirationDatePlaceholder: t('core', 'Expiration date'), expirationDatePlaceholder: t('core', 'Expiration date'),

View File

@ -85,7 +85,7 @@
if(!_.isUndefined(options.configModel)) { if(!_.isUndefined(options.configModel)) {
this.configModel = options.configModel; this.configModel = options.configModel;
} else { } else {
console.warn('missing OC.Share.ShareConfigModel'); throw 'missing OC.Share.ShareConfigModel';
} }
}, },
@ -96,8 +96,7 @@
|| !this.showLink || !this.showLink
|| !this.configModel.isShareWithLinkAllowed()) || !this.configModel.isShareWithLinkAllowed())
{ {
this.$el.empty(); this.$el.html(linkShareTemplate({
this.$el.append(linkShareTemplate({
shareAllowed: false, shareAllowed: false,
noSharingPlaceholder: t('core', 'Resharing is not allowed') noSharingPlaceholder: t('core', 'Resharing is not allowed')
})); }));
@ -114,8 +113,7 @@
publicUploadChecked = 'checked="checked"'; publicUploadChecked = 'checked="checked"';
} }
this.$el.empty(); this.$el.html(linkShareTemplate({
this.$el.append(linkShareTemplate({
shareAllowed: true, shareAllowed: true,
linkShareLabel: t('core', 'Share link'), linkShareLabel: t('core', 'Share link'),
urlLabel: t('core', 'Link'), urlLabel: t('core', 'Link'),

View File

@ -58,7 +58,7 @@
if(!_.isUndefined(options.configModel)) { if(!_.isUndefined(options.configModel)) {
this.configModel = options.configModel; this.configModel = options.configModel;
} else { } else {
console.warn('missing OC.Share.ShareConfigModel'); throw 'missing OC.Share.ShareConfigModel';
} }
}, },
@ -90,8 +90,7 @@
); );
} }
this.$el.empty(); this.$el.html(reshareTemplate({
this.$el.append(reshareTemplate({
avatarEnabled: this.configModel.areAvatarsEnabled(), avatarEnabled: this.configModel.areAvatarsEnabled(),
sharedByText: sharedByText sharedByText: sharedByText
})); }));

View File

@ -81,7 +81,7 @@
if(!_.isUndefined(options.configModel)) { if(!_.isUndefined(options.configModel)) {
this.configModel = options.configModel; this.configModel = options.configModel;
} else { } else {
console.warn('missing OC.Share.ShareConfigModel'); throw 'missing OC.Share.ShareConfigModel';
} }
var subViewOptions = { var subViewOptions = {