Let the RosterView render and populate itself
instead of having the ControlBoxView do it. This provides for cleaner separation between the two plugins.
This commit is contained in:
parent
7030495275
commit
d8d1c283a7
@ -216,7 +216,7 @@
|
|||||||
this.model.on('change:closed', this.ensureClosedState, this);
|
this.model.on('change:closed', this.ensureClosedState, this);
|
||||||
this.render();
|
this.render();
|
||||||
if (this.model.get('connected')) {
|
if (this.model.get('connected')) {
|
||||||
this.initRoster();
|
this.insertRoster();
|
||||||
}
|
}
|
||||||
if (typeof this.model.get('closed')==='undefined') {
|
if (typeof this.model.get('closed')==='undefined') {
|
||||||
this.model.set('closed', !converse.show_controlbox_by_default);
|
this.model.set('closed', !converse.show_controlbox_by_default);
|
||||||
@ -252,20 +252,14 @@
|
|||||||
|
|
||||||
onConnected: function () {
|
onConnected: function () {
|
||||||
if (this.model.get('connected')) {
|
if (this.model.get('connected')) {
|
||||||
this.render().initRoster();
|
this.render().insertRoster();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
initRoster: function () {
|
insertRoster: function () {
|
||||||
/* We initialize the roster, which will appear inside the
|
/* Place the rosterview inside the "Contacts" panel.
|
||||||
* Contacts Panel.
|
|
||||||
*/
|
*/
|
||||||
converse.rosterview = new converse.RosterView({model: converse.rostergroups});
|
|
||||||
this.contactspanel.$el.append(converse.rosterview.$el);
|
this.contactspanel.$el.append(converse.rosterview.$el);
|
||||||
converse.rosterview.render().populate().then(function () {
|
|
||||||
converse.rosterview.update();
|
|
||||||
converse.sendInitialPresence();
|
|
||||||
});
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -31,6 +31,20 @@
|
|||||||
this.__super__.afterReconnected.apply(this, arguments);
|
this.__super__.afterReconnected.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
initRoster: function () {
|
||||||
|
/* Create an instance of RosterView once the RosterGroups
|
||||||
|
* collection has been created (in converse-core.js)
|
||||||
|
*/
|
||||||
|
this.__super__.initRoster.apply(this, arguments);
|
||||||
|
converse.rosterview = new converse.RosterView({
|
||||||
|
'model': converse.rostergroups
|
||||||
|
});
|
||||||
|
converse.rosterview.render().populate().then(function () {
|
||||||
|
converse.rosterview.update();
|
||||||
|
converse.sendInitialPresence();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
RosterGroups: {
|
RosterGroups: {
|
||||||
comparator: function () {
|
comparator: function () {
|
||||||
// RosterGroupsComparator only gets set later (once i18n is
|
// RosterGroupsComparator only gets set later (once i18n is
|
||||||
|
Loading…
Reference in New Issue
Block a user