Render .row inside #conversejs element

This commit is contained in:
JC Brand 2018-02-15 15:50:11 +01:00
parent 5401998558
commit b6501bcf09
2 changed files with 22 additions and 2 deletions

View File

@ -7,11 +7,17 @@
/*global define */ /*global define */
(function (root, factory) { (function (root, factory) {
define(["converse-core", "backbone.overview"], factory); define([
}(this, function (converse) { "converse-core",
"tpl!chatboxes",
"backbone.overview"
], factory);
}(this, function (converse, tpl_chatboxes) {
"use strict"; "use strict";
const { Backbone, Promise, Strophe, b64_sha1, moment, utils, _ } = converse.env; const { Backbone, Promise, Strophe, b64_sha1, moment, utils, _ } = converse.env;
converse.plugins.add('converse-chatboxes', { converse.plugins.add('converse-chatboxes', {
overrides: { overrides: {
@ -411,6 +417,12 @@
initialize () { initialize () {
this.model.on("add", this.onChatBoxAdded, this); this.model.on("add", this.onChatBoxAdded, this);
this.model.on("destroy", this.removeChat, this); this.model.on("destroy", this.removeChat, this);
this.render();
},
render () {
this.el.innerHTML = tpl_chatboxes();
this.row_el = this.el.querySelector('.row');
}, },
_ensureElement () { _ensureElement () {
@ -440,6 +452,13 @@
} }
}, },
insertRowColumn (el) {
/* Add a new DOM element (likely a chat box) into the
* the row managed by this overview.
*/
this.row_el.insertAdjacentElement('afterBegin', el);
},
onChatBoxAdded (item) { onChatBoxAdded (item) {
// Views aren't created here, since the core code doesn't // Views aren't created here, since the core code doesn't
// contain any views. Instead, they're created in overrides in // contain any views. Instead, they're created in overrides in

View File

@ -0,0 +1 @@
<div class="row no-gutters"></div>