Cable-Desktop/js/views/key_conflict_dialogue_view.js
2016-01-02 02:51:25 -08:00

43 lines
1.2 KiB
JavaScript

/*
* vim: ts=4:sw=4:expandtab
*/
(function () {
'use strict';
window.Whisper = window.Whisper || {};
Whisper.KeyConflictDialogueView = Whisper.View.extend({
className: 'key-conflict-dialogue',
templateName: 'key-conflict-dialogue',
initialize: function(options) {
this.conversation = options.conversation;
},
events: {
'click .verify': 'triggerVerify',
'click .resolve': 'resolve',
'click .cancel': 'remove',
'click': 'clickOut'
},
triggerVerify: function() {
this.trigger('verify', {identityKey: this.model.identityKey});
},
clickOut: function(e) {
if (!$(e.target).closest('.content').length) {
this.remove();
}
},
resolve: function() {
this.trigger('resolve');
this.remove();
this.conversation.resolveConflicts(this.model);
},
render_attributes: function() {
return {
message: this.model.message,
cancel: i18n('cancel'),
resolve: i18n('acceptNewKey'),
verifyContact: i18n('verifyContact')
};
}
});
})();