From 0a7d05c0e57bc96831d0f6821d6ef7e27f4f3dd5 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Sat, 30 Aug 2014 13:34:48 +0200 Subject: [PATCH] Handle contact selection. update #215 --- converse.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/converse.js b/converse.js index 8c846cfda..595fe3267 100644 --- a/converse.js +++ b/converse.js @@ -2011,7 +2011,8 @@ }, initTypeAheadInviteWidget: function () { - this.$('input.invited-contact').typeahead({ + var $el = this.$('input.invited-contact'); + $el.typeahead({ minLength: 1, highlight: true }, { @@ -2027,6 +2028,16 @@ suggestion: _.template('

{{value}}

') } }); + + $el.on('typeahead:selected', function (ev, suggestion, dname) { + var result = confirm(__("Do you want to invite "+ suggestion.value +" to this chat room?")); + if (result === true) { + alert(suggestion.jid); + } else { + $(this).val(''); + } + }); + return this; },