1
0
mirror of https://github.com/flarum/core.git synced 2025-08-03 06:57:54 +02:00

Update admin's page.tsx

This commit is contained in:
Alexander Skvortsov
2020-04-29 18:16:46 -04:00
committed by David Sevilla Martín
parent c6062019c5
commit a344319dde

View File

@@ -2,31 +2,33 @@ import Component from '../../common/Component';
/**
* The `Page` component
*
* @abstract
*/
export default class Page extends Component {
init() {
export default abstract class Page extends Component {
/**
* A class name to apply to the body while the route is active.
*/
bodyClass: string = '';
oninit(vnode) {
super.oninit(vnode);
if (this.bodyClass) {
$('#app').addClass(this.bodyClass);
}
}
oncreate(vnode) {
super.oncreate(vnode);
app.previous = app.current;
app.current = this;
app.modal.close();
/**
* A class name to apply to the body while the route is active.
*
* @type {String}
*/
this.bodyClass = '';
}
config(isInitialized, context) {
if (isInitialized) return;
onremove(vnode) {
super.onremove(vnode);
if (this.bodyClass) {
$('#app').addClass(this.bodyClass);
context.onunload = () => $('#app').removeClass(this.bodyClass);
}
$('#app').removeClass(this.bodyClass);
}
}