mirror of
https://github.com/flarum/core.git
synced 2025-10-09 14:06:26 +02:00
Replace Ember app with Mithril app
This commit is contained in:
38
js/admin/src/initializers/boot.js
Normal file
38
js/admin/src/initializers/boot.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import ScrollListener from 'flarum/utils/scroll-listener';
|
||||
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 Modal from 'flarum/components/modal';
|
||||
import Alerts from 'flarum/components/alerts';
|
||||
import AdminNav from 'flarum/components/admin-nav';
|
||||
|
||||
export default function(app) {
|
||||
var id = id => document.getElementById(id);
|
||||
|
||||
app.history = {
|
||||
back: function() {
|
||||
window.location = 'http://flarum.dev';
|
||||
},
|
||||
canGoBack: function() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
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('admin-nav'), AdminNav.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();
|
||||
}
|
15
js/admin/src/initializers/routes.js
Normal file
15
js/admin/src/initializers/routes.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import DashboardPage from 'flarum/components/dashboard-page';
|
||||
import BasicsPage from 'flarum/components/basics-page';
|
||||
import PermissionsPage from 'flarum/components/permissions-page';
|
||||
import AppearancePage from 'flarum/components/appearance-page';
|
||||
import ExtensionsPage from 'flarum/components/extensions-page';
|
||||
|
||||
export default function(app) {
|
||||
app.routes = {
|
||||
'dashboard': ['/', DashboardPage.component()],
|
||||
'basics': ['/basics', BasicsPage.component()],
|
||||
'permissions': ['/permissions', PermissionsPage.component()],
|
||||
'appearance': ['/appearance', AppearancePage.component()],
|
||||
'extensions': ['/extensions', ExtensionsPage.component()]
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user