1
0
mirror of https://github.com/flarum/core.git synced 2025-10-12 07:24:27 +02:00

Extract base Page class

This commit is contained in:
Toby Zerner
2015-08-31 12:05:33 +09:30
parent 0474f410a4
commit 0ae2d18f28
5 changed files with 60 additions and 52 deletions

View File

@@ -0,0 +1,35 @@
import Component from 'flarum/Component';
/**
* The `Page` component
*
* @abstract
*/
export default class Page extends Component {
constructor(...args) {
super(...args);
app.previous = app.current;
app.current = this;
app.drawer.hide();
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;
if (this.bodyClass) {
$('#app').addClass(this.bodyClass);
context.onunload = () => $('#app').removeClass(this.bodyClass);
}
}
}