framework/views/app.blade.php
Toby Zerner 9bfb797fdc 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)
2016-05-26 19:04:24 +09:30

62 lines
1.6 KiB
PHP

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ $title }}</title>
<meta name="description" content="{{ $description }}">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
<meta name="theme-color" content="{{ array_get($forum, 'attributes.themePrimaryColor') }}">
@foreach ($cssUrls as $url)
<link rel="stylesheet" href="{{ $url }}">
@endforeach
{!! $head !!}
</head>
<body>
{!! $layout !!}
<div id="modal"></div>
<div id="alerts"></div>
@if ($allowJs)
<script>
document.getElementById('flarum-loading').style.display = 'block';
</script>
@foreach ($jsUrls as $url)
<script src="{{ $url }}"></script>
@endforeach
<script>
document.getElementById('flarum-loading').style.display = 'none';
@if (! $debug)
try {
@endif
var app = System.get('flarum/app').default;
var modules = {!! json_encode($modules) !!};
for (var i in modules) {
var module = System.get(modules[i]);
if (module.default) module.default(app);
}
app.boot({!! json_encode($payload) !!});
@if (! $debug)
} catch (e) {
window.location += (window.location.search ? '&' : '?') + 'nojs=1';
throw e;
}
@endif
</script>
@else
<script>
window.history.replaceState(null, null, window.location.toString().replace(/([&?]nojs=1$|nojs=1&)/, ''));
</script>
@endif
{!! $foot !!}
</body>
</html>