mirror of
https://github.com/flarum/core.git
synced 2025-08-16 13:24:11 +02:00
comment routes and components and states in forum application
This commit is contained in:
committed by
Franz Liedke
parent
873f489fec
commit
392fe98c02
@@ -189,12 +189,13 @@ export default class Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mount(basePath = '') {
|
mount(basePath = '') {
|
||||||
m.mount(document.getElementById('modal'), <ModalManager state={this.modal} />);
|
// TODO stuff
|
||||||
m.mount(document.getElementById('alerts'), <AlertManager state={this.alerts} />);
|
// m.mount(document.getElementById('modal'), <ModalManager state={this.modal} />);
|
||||||
|
// m.mount(document.getElementById('alerts'), <AlertManager state={this.alerts} />);
|
||||||
|
|
||||||
this.drawer = new Drawer();
|
// this.drawer = new Drawer();
|
||||||
|
|
||||||
m.route(document.getElementById('content'), basePath + '/', mapRoutes(this.routes, basePath));
|
// m.route(document.getElementById('content'), basePath + '/', mapRoutes(this.routes, basePath));
|
||||||
|
|
||||||
// Add a class to the body which indicates that the page has been scrolled
|
// Add a class to the body which indicates that the page has been scrolled
|
||||||
// down.
|
// down.
|
||||||
|
@@ -13,7 +13,7 @@ export default function mapRoutes(routes, basePath = '') {
|
|||||||
for (const key in routes) {
|
for (const key in routes) {
|
||||||
const route = routes[key];
|
const route = routes[key];
|
||||||
|
|
||||||
if (route.component) route.component.props.routeName = key;
|
// if (route.component) route.component.props.routeName = key;
|
||||||
|
|
||||||
map[basePath + route.path] = route.component;
|
map[basePath + route.path] = route.component;
|
||||||
}
|
}
|
||||||
|
@@ -63,7 +63,7 @@ export default class ForumApplication extends Application {
|
|||||||
*
|
*
|
||||||
* @type {NotificationListState}
|
* @type {NotificationListState}
|
||||||
*/
|
*/
|
||||||
notifications = new NotificationListState(this);
|
// notifications = new NotificationListState(this);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* An object which stores previously searched queries and provides convenient
|
* An object which stores previously searched queries and provides convenient
|
||||||
@@ -71,12 +71,12 @@ export default class ForumApplication extends Application {
|
|||||||
*
|
*
|
||||||
* @type {GlobalSearchState}
|
* @type {GlobalSearchState}
|
||||||
*/
|
*/
|
||||||
search = new GlobalSearchState();
|
// search = new GlobalSearchState();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* An object which controls the state of the composer.
|
* An object which controls the state of the composer.
|
||||||
*/
|
*/
|
||||||
composer = new ComposerState();
|
// composer = new ComposerState();
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@@ -105,28 +105,29 @@ export default class ForumApplication extends Application {
|
|||||||
// Push the homepage as the first route, so that the user will always be
|
// Push the homepage as the first route, so that the user will always be
|
||||||
// able to click on the 'back' button to go home, regardless of which page
|
// able to click on the 'back' button to go home, regardless of which page
|
||||||
// they started on.
|
// they started on.
|
||||||
const defaultRoute = this.forum.attribute('defaultRoute');
|
// TODO routes
|
||||||
let defaultAction = 'index';
|
// const defaultRoute = this.forum.attribute('defaultRoute');
|
||||||
|
// let defaultAction = 'index';
|
||||||
|
|
||||||
for (const i in this.routes) {
|
// for (const i in this.routes) {
|
||||||
if (this.routes[i].path === defaultRoute) defaultAction = i;
|
// if (this.routes[i].path === defaultRoute) defaultAction = i;
|
||||||
}
|
// }
|
||||||
|
|
||||||
this.routes[defaultAction].path = '/';
|
// this.routes[defaultAction].path = '/';
|
||||||
this.history.push(defaultAction, this.translator.trans('core.forum.header.back_to_index_tooltip'), '/');
|
// this.history.push(defaultAction, this.translator.trans('core.forum.header.back_to_index_tooltip'), '/');
|
||||||
|
|
||||||
m.mount(document.getElementById('app-navigation'), Navigation.component({ className: 'App-backControl', drawer: true }));
|
// m.mount(document.getElementById('app-navigation'), Navigation.component({ className: 'App-backControl', drawer: true }));
|
||||||
m.mount(document.getElementById('header-navigation'), Navigation.component());
|
// m.mount(document.getElementById('header-navigation'), Navigation.component());
|
||||||
m.mount(document.getElementById('header-primary'), HeaderPrimary.component());
|
m.mount(document.getElementById('header-primary'), HeaderPrimary);
|
||||||
m.mount(document.getElementById('header-secondary'), HeaderSecondary.component());
|
m.mount(document.getElementById('header-secondary'), HeaderSecondary);
|
||||||
m.mount(document.getElementById('composer'), Composer.component({ state: this.composer }));
|
// m.mount(document.getElementById('composer'), Composer.component({ state: this.composer }));
|
||||||
|
|
||||||
this.pane = new Pane(document.getElementById('app'));
|
// this.pane = new Pane(document.getElementById('app'));
|
||||||
|
|
||||||
m.route.mode = 'pathname';
|
m.route.prefix = '';
|
||||||
super.mount(this.forum.attribute('basePath'));
|
super.mount(this.forum.attribute('basePath'));
|
||||||
|
|
||||||
alertEmailConfirmation(this);
|
// alertEmailConfirmation(this);
|
||||||
|
|
||||||
// Route the home link back home when clicked. We do not want it to register
|
// Route the home link back home when clicked. We do not want it to register
|
||||||
// if the user is opening it in a new tab, however.
|
// if the user is opening it in a new tab, however.
|
||||||
|
Reference in New Issue
Block a user