Remove closeChatRoom and reuse closeChat on ChatBoxView
This commit is contained in:
parent
2d08916ce7
commit
b49f21558c
33
converse.js
33
converse.js
@ -804,22 +804,10 @@
|
||||
tagName: 'div',
|
||||
className: 'chatroom',
|
||||
events: {
|
||||
'click .close-chatbox-button': 'closeChatRoom',
|
||||
'click a.close-chatbox-button': 'closeChat',
|
||||
'keypress textarea.chat-textarea': 'keyPressed'
|
||||
},
|
||||
|
||||
closeChatRoom: function () {
|
||||
this.closeChat();
|
||||
xmppchat.connection.muc.leave(
|
||||
this.model.get('jid'),
|
||||
this.model.get('nick'),
|
||||
this.onLeave,
|
||||
undefined);
|
||||
delete xmppchat.chatboxesview.views[this.model.get('jid')];
|
||||
xmppchat.chatboxesview.model.remove(this.model.get('jid'));
|
||||
this.remove();
|
||||
},
|
||||
|
||||
sendChatRoomMessage: function (body) {
|
||||
this.appendMessage(body);
|
||||
var match = body.replace(/^\s*/, "").match(/^\/(.*?)(?: (.*))?$/) || [false],
|
||||
@ -891,6 +879,18 @@
|
||||
$.proxy(this.onChatRoomMessage, this),
|
||||
$.proxy(this.onChatRoomPresence, this),
|
||||
$.proxy(this.onChatRoomRoster, this));
|
||||
|
||||
|
||||
this.model.on('destroy', function (model, response, options) {
|
||||
this.$el.hide('fast');
|
||||
xmppchat.connection.muc.leave(
|
||||
this.model.get('jid'),
|
||||
this.model.get('nick'),
|
||||
this.onLeave,
|
||||
undefined);
|
||||
},
|
||||
this);
|
||||
|
||||
this.$el.appendTo(xmppchat.chatboxesview.$el);
|
||||
this.render().show();
|
||||
},
|
||||
@ -990,13 +990,6 @@
|
||||
return true;
|
||||
},
|
||||
|
||||
show: function () {
|
||||
this.$el.css({'opacity': 0,
|
||||
'display': 'inline'})
|
||||
.animate({opacity: '1'}, 200);
|
||||
return this;
|
||||
},
|
||||
|
||||
render: function () {
|
||||
this.$el.attr('id', this.model.get('box_id'))
|
||||
.html(this.template(this.model.toJSON()));
|
||||
|
Loading…
Reference in New Issue
Block a user