Explorar el Código

By convention keep the render methods immediately after initialize

JC Brand hace 8 años
padre
commit
efa8776881
Se han modificado 1 ficheros con 33 adiciones y 33 borrados
  1. 33 33
      src/converse-muc.js

+ 33 - 33
src/converse-muc.js

@@ -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 () {
                     this.$el.attr('id', this.model.get('box_id'))
                             .html(_converse.templates.chatroom());
@@ -397,16 +374,6 @@
                     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 () {
                     /* Render the heading UI of the chat room. */
                     this.el.querySelector('.chat-head-chatroom').innerHTML = this.generateHeadingHTML();
@@ -432,6 +399,39 @@
                     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 () {
                     /* Override from converse-chatview, specifically to avoid
                      * the 'active' chat state from being sent out prematurely.