Show 'Message not sent' only if 'Some recipients failed' not showing

Also switch up the visual style for 'Some recipients failed' text to
match the more-visible 'Message not sent' text and the 'Resend' link.

FREEBIE
This commit is contained in:
Scott Nonnenberg 2017-07-10 17:53:31 -07:00
parent 25243ad9de
commit 4124d5cb9b
3 changed files with 23 additions and 13 deletions

View file

@ -20,9 +20,17 @@
tagName: 'span',
className: 'hasRetry',
templateName: 'hasRetry',
render_attributes: {
messageNotSent: i18n('messageNotSent'),
resend: i18n('resend')
render_attributes: function() {
var messageNotSent;
if (!this.model.someRecipientsFailed()) {
messageNotSent = i18n('messageNotSent');
}
return {
messageNotSent: messageNotSent,
resend: i18n('resend')
};
}
});
var SomeFailedView = Whisper.View.extend({
@ -248,11 +256,13 @@
}
this.$('.meta .hasRetry').remove();
if (this.model.hasNetworkError()) {
this.$('.meta').prepend(new NetworkErrorView().render().el);
var networkErrorView = new NetworkErrorView({model: this.model});
this.$('.meta').prepend(networkErrorView.render().el);
}
this.$('.meta .some-failed').remove();
if (this.model.someRecipientsFailed()) {
this.$('.meta').prepend(new SomeFailedView().render().el);
var someFailedView = new SomeFailedView();
this.$('.meta').prepend(someFailedView.render().el);
}
},
renderControl: function() {