From 6ca2183e2493ed03d5a16b07eb0f285db81ea2d2 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Fri, 22 Jan 2021 15:36:00 +0100 Subject: [PATCH] Remove unneeded ControlBoxPane view --- src/plugins/controlbox/index.js | 2 -- src/plugins/controlbox/pane.js | 19 --------------- .../controlbox/templates/controlbox.js | 12 ++++++---- src/plugins/controlbox/view.js | 23 ------------------- 4 files changed, 7 insertions(+), 49 deletions(-) delete mode 100644 src/plugins/controlbox/pane.js diff --git a/src/plugins/controlbox/index.js b/src/plugins/controlbox/index.js index 7df2b50b8..a466f8654 100644 --- a/src/plugins/controlbox/index.js +++ b/src/plugins/controlbox/index.js @@ -7,7 +7,6 @@ import "../../components/brand-heading"; import "../chatview/index.js"; import './loginpanel.js'; import ControlBoxMixin from './model.js'; -import ControlBoxPane from './pane.js'; import ControlBoxToggle from './toggle.js'; import ControlBoxView from './view.js'; import controlbox_api from './api.js'; @@ -96,7 +95,6 @@ converse.plugins.add('converse-controlbox', { _converse.ControlBoxView = ControlBoxView; _converse.ControlBox = _converse.ChatBox.extend(ControlBoxMixin); - _converse.ControlBoxPane = ControlBoxPane; _converse.ControlBoxToggle = ControlBoxToggle; /******************** Event Handlers ********************/ diff --git a/src/plugins/controlbox/pane.js b/src/plugins/controlbox/pane.js deleted file mode 100644 index 09311dc02..000000000 --- a/src/plugins/controlbox/pane.js +++ /dev/null @@ -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; diff --git a/src/plugins/controlbox/templates/controlbox.js b/src/plugins/controlbox/templates/controlbox.js index 9176ad259..a98094c15 100644 --- a/src/plugins/controlbox/templates/controlbox.js +++ b/src/plugins/controlbox/templates/controlbox.js @@ -9,13 +9,15 @@ export default (o) => html`
${ o.connected ? html` - - - ` +
+ + + +
` : ( o['active-form'] === 'register' - ? html`` - : html`` + ? html`` + : html`` ) }
diff --git a/src/plugins/controlbox/view.js b/src/plugins/controlbox/view.js index 06468592e..634557aac 100644 --- a/src/plugins/controlbox/view.js +++ b/src/plugins/controlbox/view.js @@ -48,8 +48,6 @@ class ControlBoxView extends ElementView { const connection = _converse?.connection; if (!connection?.connected || !connection?.authenticated || connection?.disconnecting) { 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(); } - /** - * 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) { if (ev && ev.preventDefault) { ev.preventDefault();