1
0
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:
Toby Zerner
2015-04-25 22:28:39 +09:30
parent 6f67b8c247
commit b68a4711dc
377 changed files with 5641 additions and 7330 deletions

View 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();
}

View 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()]
};
}