瀏覽代碼

Moved assignment of template for RosterView out of the render method to avoid calling empty and readding items everytime the render method is called

ichim-david 12 年之前
父節點
當前提交
a875ba51a0
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      converse.js

+ 3 - 2
converse.js

@@ -523,7 +523,7 @@
                         '<a href="{{user_profile_url}}" class="user">' +
                             '<img src="{{portrait_url}}" alt="Avatar of {{fullname}}" class="avatar" />' +
                             '<div class="chat-title"> {{ fullname }} </div>' +
-		                '</a>' +
+                        '</a>' +
                         '<p class="user-custom-message"><p/>' +
                     '</div>' +
                     '<div class="chat-content"></div>' + 
@@ -1548,6 +1548,8 @@
                 delete this.rosteritemviews[item.id];
                 this.render();
             }, this);
+
+            this.$el.html(this.template());
         },
 
         template: _.template('<dt id="xmpp-contact-requests">Contact requests</dt>' +
@@ -1555,7 +1557,6 @@
                             '<dt id="pending-xmpp-contacts">Pending contacts</dt>'),
 
         render: function () {
-            this.$el.empty().html(this.template());
             var models = this.model.sort().models,
                 children = $(this.el).children(),
                 $my_contacts = this.$el.find('#xmpp-contacts').hide(),