mirror of
https://github.com/flarum/core.git
synced 2025-08-03 15:07:53 +02:00
Update admin's page.tsx
This commit is contained in:
committed by
David Sevilla Martín
parent
c6062019c5
commit
a344319dde
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user