2015-09-07 23:53:43 +02:00
|
|
|
/*
|
|
|
|
* vim: ts=4:sw=4:expandtab
|
2015-02-18 03:03:05 +01:00
|
|
|
*/
|
|
|
|
(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() {
|
2015-07-20 23:15:38 +02:00
|
|
|
this.trigger('verify', {identityKey: this.model.identityKey});
|
2015-02-18 03:03:05 +01:00
|
|
|
},
|
|
|
|
clickOut: function(e) {
|
|
|
|
if (!$(e.target).closest('.content').length) {
|
|
|
|
this.remove();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
resolve: function() {
|
2015-04-15 21:24:29 +02:00
|
|
|
new Promise(function(resolve) {
|
2015-07-31 20:14:43 +02:00
|
|
|
this.conversation.resolveConflicts(this.model).then(resolve);
|
2015-02-18 03:03:05 +01:00
|
|
|
}.bind(this));
|
|
|
|
this.trigger('resolve');
|
|
|
|
this.remove();
|
|
|
|
},
|
|
|
|
render: function() {
|
|
|
|
this.$el.html(Mustache.render(this.template, this.model));
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
})();
|