Display key conflict dialog inline
One less modal. // FREEBIE
This commit is contained in:
parent
ad66da9fb5
commit
5340791868
6 changed files with 107 additions and 91 deletions
|
@ -7,25 +7,18 @@
|
|||
window.Whisper = window.Whisper || {};
|
||||
|
||||
Whisper.KeyConflictDialogueView = Whisper.View.extend({
|
||||
className: 'key-conflict-dialogue',
|
||||
className: 'key-conflict-dialogue clearfix',
|
||||
templateName: 'key-conflict-dialogue',
|
||||
initialize: function(options) {
|
||||
this.conversation = options.conversation;
|
||||
},
|
||||
events: {
|
||||
'click .verify': 'triggerVerify',
|
||||
'click .resolve': 'resolve',
|
||||
'click .cancel': 'remove',
|
||||
'click': 'clickOut'
|
||||
'click .resolve': 'resolve'
|
||||
},
|
||||
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();
|
||||
|
@ -33,8 +26,7 @@
|
|||
},
|
||||
render_attributes: function() {
|
||||
return {
|
||||
message: this.model.message,
|
||||
cancel: i18n('cancel'),
|
||||
message: i18n('identityChanged'),
|
||||
resolve: i18n('acceptNewKey'),
|
||||
verifyContact: i18n('verifyContact')
|
||||
};
|
||||
|
|
|
@ -14,12 +14,21 @@
|
|||
return (e.name === 'IncomingIdentityKeyError' ||
|
||||
e.name === 'OutgoingIdentityKeyError');
|
||||
});
|
||||
|
||||
},
|
||||
events: {
|
||||
'click .conflict': 'triggerConflict'
|
||||
'click .conflict': 'triggerConflict',
|
||||
'click .cancel' : 'cancel'
|
||||
},
|
||||
triggerConflict: function() {
|
||||
this.$el.trigger('conflict', {conflict: this.conflict});
|
||||
this.$el.trigger('conflict', {conflict: this.conflict, el: this.el});
|
||||
this.$('.cancel').show();
|
||||
this.$('.conflict').hide();
|
||||
},
|
||||
cancel: function() {
|
||||
this.$('.key-conflict-dialogue').remove();
|
||||
this.$('.cancel').hide();
|
||||
this.$('.conflict').show();
|
||||
},
|
||||
render_attributes: function() {
|
||||
return {
|
||||
|
@ -27,7 +36,8 @@
|
|||
avatar : this.model.getAvatar(),
|
||||
conflict : this.conflict,
|
||||
errors : this.errors,
|
||||
verify : i18n('verify')
|
||||
verify : i18n('verify'),
|
||||
cancel : i18n('cancel')
|
||||
};
|
||||
}
|
||||
});
|
||||
|
@ -76,7 +86,7 @@
|
|||
model: data.conflict,
|
||||
conversation: this.conversation
|
||||
});
|
||||
view.render().$el.appendTo(this.$el);
|
||||
view.render().$el.appendTo(data.el);
|
||||
this.listenTo(view, 'verify', function(data) {
|
||||
this.verify(data.identityKey);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue