Commit d502f1bd authored by lilia's avatar lilia
Browse files

i18n KeyConflictView

Also refactor generic error view to make this simpler.

// FREEBIE
parent ccdbfc3e
{
"outgoingKeyConflict": {
"message": "This contact's identity key has changed. Click to process and display."
},
"incomingKeyConflict": {
"message": "Received message with unknown identity key. Click to process and display."
},
"unsupportedAttachment": {
"message": "Unsupported attachment type. Click to save.",
"description": "Displayed for incoming unsupported attachment"
......
......@@ -269,18 +269,6 @@
<div class='contacts'></div>
</div>
</script>
<script type='text/x-tmpl-mustache' id='incoming-key-conflict'>
<p>
Received message with unknown identity key.
Click to process and display.
</p>
</script>
<script type='text/x-tmpl-mustache' id='outgoing-key-conflict'>
<p>
This contact's identity key has changed.
Click to process and display.
</p>
</script>
<script type='text/x-tmpl-mustache' id='generic-error'>
<p>{{ message }}</p>
</script>
......
......@@ -6,32 +6,32 @@
window.Whisper = window.Whisper || {};
var ErrorView = Backbone.View.extend({
var ErrorView = Whisper.View.extend({
className: 'error',
initialize: function() {
this.template = $('#generic-error').html();
Mustache.parse(this.template);
},
render: function() {
this.$el.html(Mustache.render(this.template, this.model));
return this;
templateName: 'generic-error',
render_attributes: function() {
return this.model;
}
});
var KeyConflictView = ErrorView.extend({
className: 'key-conflict',
templateName: 'key-conflict',
initialize: function(options) {
this.message = options.message;
if (this.message.isIncoming()) {
this.template = $('#incoming-key-conflict').html();
} else if (this.message.isOutgoing()) {
this.template = $('#outgoing-key-conflict').html();
}
Mustache.parse(this.template);
},
events: {
'click': 'select'
},
render_attributes: function() {
var errorMessage;
if (this.message.isIncoming()) {
errorMessage = 'incomingKeyConflict';
} else {
errorMessage = 'outgoingKeyConflict';
}
return { message: i18n(errorMessage) };
},
select: function() {
this.$el.trigger('select', {message: this.message});
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment