mirror of
https://github.com/flarum/core.git
synced 2025-10-12 23:44:27 +02:00
Replace Ember app with Mithril app
This commit is contained in:
43
js/forum/src/initializers/boot.js
Normal file
43
js/forum/src/initializers/boot.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import ScrollListener from 'flarum/utils/scroll-listener';
|
||||
import History from 'flarum/utils/history';
|
||||
import Pane from 'flarum/utils/pane';
|
||||
import mapRoutes from 'flarum/utils/map-routes';
|
||||
|
||||
import BackButton from 'flarum/components/back-button';
|
||||
import HeaderPrimary from 'flarum/components/header-primary';
|
||||
import HeaderSecondary from 'flarum/components/header-secondary';
|
||||
import FooterPrimary from 'flarum/components/footer-primary';
|
||||
import FooterSecondary from 'flarum/components/footer-secondary';
|
||||
import Composer from 'flarum/components/composer';
|
||||
import Modal from 'flarum/components/modal';
|
||||
import Alerts from 'flarum/components/alerts';
|
||||
import SignupModal from 'flarum/components/signup-modal';
|
||||
import LoginModal from 'flarum/components/login-modal';
|
||||
|
||||
export default function(app) {
|
||||
var id = id => document.getElementById(id);
|
||||
|
||||
app.history = new History();
|
||||
app.pane = new Pane(id('page'));
|
||||
app.cache = {};
|
||||
|
||||
app.signup = () => app.modal.show(new SignupModal());
|
||||
app.login = () => app.modal.show(new LoginModal());
|
||||
|
||||
m.mount(id('back-control'), BackButton.component({ className: 'back-control', drawer: true }));
|
||||
m.mount(id('back-button'), BackButton.component());
|
||||
|
||||
m.mount(id('header-primary'), HeaderPrimary.component());
|
||||
m.mount(id('header-secondary'), HeaderSecondary.component());
|
||||
m.mount(id('footer-primary'), FooterPrimary.component());
|
||||
m.mount(id('footer-secondary'), FooterSecondary.component());
|
||||
|
||||
app.composer = m.mount(id('composer'), Composer.component());
|
||||
app.modal = m.mount(id('modal'), Modal.component());
|
||||
app.alerts = m.mount(id('alerts'), Alerts.component());
|
||||
|
||||
m.route.mode = 'hash';
|
||||
m.route(id('content'), '/', mapRoutes(app.routes));
|
||||
|
||||
new ScrollListener(top => $('body').toggleClass('scrolled', top > 0)).start();
|
||||
}
|
Reference in New Issue
Block a user