Cable-Desktop/js/views/key_conflict_dialogue_view.js
lilia f764445c86 Remove erroneous license file and headers
We only use GPLV3 around here.

// FREEBIE
2015-09-07 14:58:42 -07:00

42 lines
1.3 KiB
JavaScript

/*
* vim: ts=4:sw=4:expandtab
*/
(function () {
'use strict';
window.Whisper = window.Whisper || {};
Whisper.KeyConflictDialogueView = Backbone.View.extend({
className: 'key-conflict-dialogue',
initialize: function(options) {
this.template = $('#key-conflict-dialogue').html();
Mustache.parse(this.template);
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() {
new Promise(function(resolve) {
this.conversation.resolveConflicts(this.model).then(resolve);
}.bind(this));
this.trigger('resolve');
this.remove();
},
render: function() {
this.$el.html(Mustache.render(this.template, this.model));
return this;
}
});
})();