Commit a306e1a7 authored by JC Brand's avatar JC Brand

Clear the chatroom input when form was submitted

parent 9b445f84
...@@ -710,11 +710,13 @@ ...@@ -710,11 +710,13 @@
createChatRoom: function (ev) { createChatRoom: function (ev) {
ev.preventDefault(); ev.preventDefault();
var name, jid; var name, jid, input;
if (ev.type === 'click') { if (ev.type === 'click') {
jid = $(ev.target).attr('data-room-jid'); jid = $(ev.target).attr('data-room-jid');
} else { } else {
name = $(ev.target).find('input.new-chatroom-name').val().trim().toLowerCase(); input = this.$el.find('input.new-chatroom-name');
name = input.val().trim().toLowerCase();
input.val(''); // Clear the input
if (name) { if (name) {
jid = Strophe.escapeNode(name) + '@' + xmppchat.muc_domain; jid = Strophe.escapeNode(name) + '@' + xmppchat.muc_domain;
} else { } else {
...@@ -882,11 +884,11 @@ ...@@ -882,11 +884,11 @@
initialize: function () { initialize: function () {
xmppchat.connection.muc.join( xmppchat.connection.muc.join(
this.model.get('jid'), this.model.get('jid'),
this.model.get('nick'), this.model.get('nick'),
$.proxy(this.onChatRoomMessage, this), $.proxy(this.onChatRoomMessage, this),
$.proxy(this.onChatRoomPresence, this), $.proxy(this.onChatRoomPresence, this),
$.proxy(this.onChatRoomRoster, this)); $.proxy(this.onChatRoomRoster, this));
this.model.messages.on('add', this.showMessage, this); this.model.messages.on('add', this.showMessage, this);
...@@ -983,7 +985,7 @@ ...@@ -983,7 +985,7 @@
}, },
onChatRoomRoster: function (roster, room) { onChatRoomRoster: function (roster, room) {
// underscore size is needed because roster is on object // underscore size is needed because roster is an object
var controlboxview = xmppchat.chatboxesview.views.controlbox, var controlboxview = xmppchat.chatboxesview.views.controlbox,
roster_size = _.size(roster), roster_size = _.size(roster),
$participant_list = this.$el.find('.participant-list'), $participant_list = this.$el.find('.participant-list'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment