1
0
mirror of https://github.com/flarum/core.git synced 2025-07-30 21:20:24 +02:00

Refactor the web app bootstrapping code

- All custom JS variables are now preloaded into the `app.data` object, rather than directly on the `app` object. This means that admin settings are available in `app.data.settings` rather than `app.settings`, etc.
- Cleaner route handler generation
- Renamed ConfigureClientView to ConfigureWebApp, though the former still exists and is deprecated
- Partial fix for #881 (strips ?nojs=1 from URL if possible, so that refreshing will attempt to load JS version again)
This commit is contained in:
Toby Zerner
2016-05-26 19:04:24 +09:30
parent 2525e3e7ad
commit 9bfb797fdc
49 changed files with 1575 additions and 1254 deletions

View File

@@ -39,14 +39,14 @@ export default class HeaderSecondary extends Component {
items.add('search', app.search.render(), 30);
if (Object.keys(app.locales).length > 1) {
if (Object.keys(app.data.locales).length > 1) {
const locales = [];
for (const locale in app.locales) {
for (const locale in app.data.locales) {
locales.push(Button.component({
active: app.locale === locale,
children: app.locales[locale],
icon: app.locale === locale ? 'check' : true,
active: app.data.locale === locale,
children: app.data.locales[locale],
icon: app.data.locale === locale ? 'check' : true,
onclick: () => {
if (app.session.user) {
app.session.user.savePreferences({locale}).then(() => window.location.reload());