Remove unneeded ControlBoxPane view
This commit is contained in:
parent
bb7d1c5cba
commit
6ca2183e24
@ -7,7 +7,6 @@ import "../../components/brand-heading";
|
|||||||
import "../chatview/index.js";
|
import "../chatview/index.js";
|
||||||
import './loginpanel.js';
|
import './loginpanel.js';
|
||||||
import ControlBoxMixin from './model.js';
|
import ControlBoxMixin from './model.js';
|
||||||
import ControlBoxPane from './pane.js';
|
|
||||||
import ControlBoxToggle from './toggle.js';
|
import ControlBoxToggle from './toggle.js';
|
||||||
import ControlBoxView from './view.js';
|
import ControlBoxView from './view.js';
|
||||||
import controlbox_api from './api.js';
|
import controlbox_api from './api.js';
|
||||||
@ -96,7 +95,6 @@ converse.plugins.add('converse-controlbox', {
|
|||||||
|
|
||||||
_converse.ControlBoxView = ControlBoxView;
|
_converse.ControlBoxView = ControlBoxView;
|
||||||
_converse.ControlBox = _converse.ChatBox.extend(ControlBoxMixin);
|
_converse.ControlBox = _converse.ChatBox.extend(ControlBoxMixin);
|
||||||
_converse.ControlBoxPane = ControlBoxPane;
|
|
||||||
_converse.ControlBoxToggle = ControlBoxToggle;
|
_converse.ControlBoxToggle = ControlBoxToggle;
|
||||||
|
|
||||||
/******************** Event Handlers ********************/
|
/******************** Event Handlers ********************/
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
import { View } from '@converse/skeletor/src/view';
|
|
||||||
import { api } from '@converse/headless/core';
|
|
||||||
|
|
||||||
const ControlBoxPane = View.extend({
|
|
||||||
tagName: 'div',
|
|
||||||
className: 'controlbox-pane',
|
|
||||||
|
|
||||||
initialize () {
|
|
||||||
/**
|
|
||||||
* Triggered once the {@link _converse.ControlBoxPane} has been initialized
|
|
||||||
* @event _converse#controlBoxPaneInitialized
|
|
||||||
* @type { _converse.ControlBoxPane }
|
|
||||||
* @example _converse.api.listen.on('controlBoxPaneInitialized', view => { ... });
|
|
||||||
*/
|
|
||||||
api.trigger('controlBoxPaneInitialized', this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default ControlBoxPane;
|
|
@ -9,9 +9,11 @@ export default (o) => html`
|
|||||||
<div class="controlbox-panes">
|
<div class="controlbox-panes">
|
||||||
${ o.connected
|
${ o.connected
|
||||||
? html`
|
? html`
|
||||||
|
<div class="controlbox-pane">
|
||||||
<converse-headlines-panel></converse-headlines-panel>
|
<converse-headlines-panel></converse-headlines-panel>
|
||||||
<converse-rooms-list></converse-rooms-list>
|
<converse-rooms-list></converse-rooms-list>
|
||||||
<converse-bookmarks></converse-bookmarks>`
|
<converse-bookmarks></converse-bookmarks>
|
||||||
|
</div>`
|
||||||
: (
|
: (
|
||||||
o['active-form'] === 'register'
|
o['active-form'] === 'register'
|
||||||
? html`<converse-login-panel></converse-login-panel>`
|
? html`<converse-login-panel></converse-login-panel>`
|
||||||
|
@ -48,8 +48,6 @@ class ControlBoxView extends ElementView {
|
|||||||
const connection = _converse?.connection;
|
const connection = _converse?.connection;
|
||||||
if (!connection?.connected || !connection?.authenticated || connection?.disconnecting) {
|
if (!connection?.connected || !connection?.authenticated || connection?.disconnecting) {
|
||||||
this.classList.add('logged-out');
|
this.classList.add('logged-out');
|
||||||
} else if (this.model.get('connected')) {
|
|
||||||
this.renderControlBoxPane();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,27 +55,6 @@ class ControlBoxView extends ElementView {
|
|||||||
this.model.get('connected') && this.render();
|
this.model.get('connected') && this.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Renders the "Contacts" panel of the controlbox.
|
|
||||||
* This will only be called after the user has already been logged in.
|
|
||||||
* @private
|
|
||||||
* @method _converse.ControlBoxView.renderControlBoxPane
|
|
||||||
*/
|
|
||||||
renderControlBoxPane () {
|
|
||||||
if (this.loginpanel) {
|
|
||||||
this.loginpanel.remove();
|
|
||||||
delete this.loginpanel;
|
|
||||||
}
|
|
||||||
if (this.controlbox_pane && u.isVisible(this.controlbox_pane.el)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.classList.remove('logged-out');
|
|
||||||
this.controlbox_pane = new _converse.ControlBoxPane();
|
|
||||||
this
|
|
||||||
.querySelector('.controlbox-panes')
|
|
||||||
.insertAdjacentElement('afterBegin', this.controlbox_pane.el);
|
|
||||||
}
|
|
||||||
|
|
||||||
async close (ev) {
|
async close (ev) {
|
||||||
if (ev && ev.preventDefault) {
|
if (ev && ev.preventDefault) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
Loading…
Reference in New Issue
Block a user