Commit efa87768 authored by JC Brand's avatar JC Brand

By convention keep the render methods immediately after initialize

parent 61bee4c2
...@@ -365,29 +365,6 @@ ...@@ -365,29 +365,6 @@
}); });
}, },
createOccupantsView: function () {
/* Create the ChatRoomOccupantsView Backbone.View
*/
this.occupantsview = new _converse.ChatRoomOccupantsView({
model: new _converse.ChatRoomOccupants()
});
var id = b64_sha1('converse.occupants'+_converse.bare_jid+this.model.get('jid'));
this.occupantsview.model.browserStorage = new Backbone.BrowserStorage.session(id);
this.occupantsview.chatroomview = this;
this.occupantsview.render();
this.occupantsview.model.fetch({add:true});
},
insertIntoDOM: function () {
var view = _converse.chatboxviews.get("controlbox");
if (view) {
this.$el.insertAfter(view.$el);
} else {
$('#conversejs').prepend(this.$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()); .html(_converse.templates.chatroom());
...@@ -397,16 +374,6 @@ ...@@ -397,16 +374,6 @@
return this; return this;
}, },
generateHeadingHTML: function () {
/* Returns the heading HTML to be rendered.
*/
return _converse.templates.chatroom_head(
_.extend(this.model.toJSON(), {
info_close: __('Close and leave this room'),
info_configure: __('Configure this room'),
}));
},
renderHeading: function () { renderHeading: function () {
/* Render the heading UI of the chat room. */ /* Render the heading UI of the chat room. */
this.el.querySelector('.chat-head-chatroom').innerHTML = this.generateHeadingHTML(); this.el.querySelector('.chat-head-chatroom').innerHTML = this.generateHeadingHTML();
...@@ -432,6 +399,39 @@ ...@@ -432,6 +399,39 @@
return this; return this;
}, },
createOccupantsView: function () {
/* Create the ChatRoomOccupantsView Backbone.View
*/
this.occupantsview = new _converse.ChatRoomOccupantsView({
model: new _converse.ChatRoomOccupants()
});
var id = b64_sha1('converse.occupants'+_converse.bare_jid+this.model.get('jid'));
this.occupantsview.model.browserStorage = new Backbone.BrowserStorage.session(id);
this.occupantsview.chatroomview = this;
this.occupantsview.render();
this.occupantsview.model.fetch({add:true});
},
insertIntoDOM: function () {
var view = _converse.chatboxviews.get("controlbox");
if (view) {
this.$el.insertAfter(view.$el);
} else {
$('#conversejs').prepend(this.$el);
}
return this;
},
generateHeadingHTML: function () {
/* Returns the heading HTML to be rendered.
*/
return _converse.templates.chatroom_head(
_.extend(this.model.toJSON(), {
info_close: __('Close and leave this room'),
info_configure: __('Configure this room'),
}));
},
afterShown: function () { afterShown: function () {
/* Override from converse-chatview, specifically to avoid /* Override from converse-chatview, specifically to avoid
* the 'active' chat state from being sent out prematurely. * the 'active' chat state from being sent out prematurely.
......
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