Commit 1b8ab4c4 authored by JC Brand's avatar JC Brand

Refactor code into insertIntoDOM method

To make overridding it easier.
parent 6c99c51c
...@@ -193,8 +193,7 @@ ...@@ -193,8 +193,7 @@
this.render().$el.hide(); this.render().$el.hide();
this.occupantsview.model.fetch({add:true}); this.occupantsview.model.fetch({add:true});
this.join(null, {'maxstanzas': converse.muc_history_max_stanzas}); this.join(null, {'maxstanzas': converse.muc_history_max_stanzas});
this.fetchMessages(); this.fetchMessages().insertIntoDOM();
this.$el.insertAfter(converse.chatboxviews.get("controlbox").$el);
// XXX: adding the event below to the events map above doesn't work. // XXX: adding the event below to the events map above doesn't work.
// The code that gets executed because of that looks like this: // The code that gets executed because of that looks like this:
// this.$el.on('scroll', '.chat-content', this.markScrolled.bind(this)); // this.$el.on('scroll', '.chat-content', this.markScrolled.bind(this));
...@@ -204,6 +203,11 @@ ...@@ -204,6 +203,11 @@
converse.emit('chatRoomOpened', this); converse.emit('chatRoomOpened', this);
}, },
insertIntoDOM: function () {
this.$el.insertAfter(converse.chatboxviews.get("controlbox").$el);
return this;
},
render: function () { render: function () {
this.$el.attr('id', this.model.get('box_id')) this.$el.attr('id', this.model.get('box_id'))
.html(converse.templates.chatroom(this.model.toJSON())); .html(converse.templates.chatroom(this.model.toJSON()));
......
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