Selaa lähdekoodia

Move render method below initialize

JC Brand 10 vuotta sitten
vanhempi
commit
6b88513f1d
1 muutettua tiedostoa jossa 48 lisäystä ja 48 poistoa
  1. 48 48
      converse.js

+ 48 - 48
converse.js

@@ -3326,54 +3326,6 @@
                 this.model.on("open", this.openChat, this);
             },
 
-            openChat: function (ev) {
-                if (ev && ev.preventDefault) { ev.preventDefault(); }
-                // XXX: Can this.model.attributes be used here, instead of
-                // manually specifying all attributes?
-                return converse.chatboxviews.showChat({
-                    'id': this.model.get('jid'),
-                    'jid': this.model.get('jid'),
-                    'fullname': this.model.get('fullname'),
-                    'image_type': this.model.get('image_type'),
-                    'image': this.model.get('image'),
-                    'url': this.model.get('url'),
-                    'status': this.model.get('status')
-                });
-            },
-
-            removeContact: function (ev) {
-                if (ev && ev.preventDefault) { ev.preventDefault(); }
-                var result = confirm(__("Are you sure you want to remove this contact?"));
-                if (result === true) {
-                    var bare_jid = this.model.get('jid');
-                    converse.connection.roster.remove(bare_jid, $.proxy(function (iq) {
-                        converse.connection.roster.unauthorize(bare_jid);
-                        converse.rosterview.model.remove(bare_jid);
-                        this.model.destroy();
-                        this.remove();
-                    }, this));
-                }
-            },
-
-            acceptRequest: function (ev) {
-                if (ev && ev.preventDefault) { ev.preventDefault(); }
-                var jid = this.model.get('jid');
-                converse.connection.roster.authorize(jid);
-                converse.connection.roster.add(jid, this.model.get('fullname'), [], function (iq) {
-                    converse.connection.roster.subscribe(jid, null, converse.xmppstatus.get('fullname'));
-                });
-            },
-
-            declineRequest: function (ev) {
-                if (ev && ev.preventDefault) { ev.preventDefault(); }
-                var result = confirm(__("Are you sure you want to decline this contact request?"));
-                if (result === true) {
-                    converse.connection.roster.unauthorize(this.model.get('jid'));
-                    this.model.destroy();
-                }
-                return this;
-            },
-
             render: function () {
                 if (!this.model.showInRoster()) {
                     this.$el.hide();
@@ -3439,6 +3391,54 @@
                     ));
                 }
                 return this;
+            },
+
+            openChat: function (ev) {
+                if (ev && ev.preventDefault) { ev.preventDefault(); }
+                // XXX: Can this.model.attributes be used here, instead of
+                // manually specifying all attributes?
+                return converse.chatboxviews.showChat({
+                    'id': this.model.get('jid'),
+                    'jid': this.model.get('jid'),
+                    'fullname': this.model.get('fullname'),
+                    'image_type': this.model.get('image_type'),
+                    'image': this.model.get('image'),
+                    'url': this.model.get('url'),
+                    'status': this.model.get('status')
+                });
+            },
+
+            removeContact: function (ev) {
+                if (ev && ev.preventDefault) { ev.preventDefault(); }
+                var result = confirm(__("Are you sure you want to remove this contact?"));
+                if (result === true) {
+                    var bare_jid = this.model.get('jid');
+                    converse.connection.roster.remove(bare_jid, $.proxy(function (iq) {
+                        converse.connection.roster.unauthorize(bare_jid);
+                        converse.rosterview.model.remove(bare_jid);
+                        this.model.destroy();
+                        this.remove();
+                    }, this));
+                }
+            },
+
+            acceptRequest: function (ev) {
+                if (ev && ev.preventDefault) { ev.preventDefault(); }
+                var jid = this.model.get('jid');
+                converse.connection.roster.authorize(jid);
+                converse.connection.roster.add(jid, this.model.get('fullname'), [], function (iq) {
+                    converse.connection.roster.subscribe(jid, null, converse.xmppstatus.get('fullname'));
+                });
+            },
+
+            declineRequest: function (ev) {
+                if (ev && ev.preventDefault) { ev.preventDefault(); }
+                var result = confirm(__("Are you sure you want to decline this contact request?"));
+                if (result === true) {
+                    converse.connection.roster.unauthorize(this.model.get('jid'));
+                    this.model.destroy();
+                }
+                return this;
             }
         });