1
0
mirror of https://github.com/flarum/core.git synced 2025-08-11 10:55:47 +02:00

Frontend refactor (#1471)

Refactor Frontend + Asset code

- Use Laravel's Filesystem component for asset IO, meaning theoretically
  assets should be storable on S3 etc.

- More reliable checking for asset recompilation when debug mode is on,
  so you don't have to constantly delete the compiled assets to force
  a recompile. Should also fix issues with locale JS files being
  recompiled with the same name and cached.

- Remove JavaScript minification, because it will be done by Webpack
  (exception is for the TextFormatter JS).

- Add support for JS sourcemaps.

- Separate frontend view and assets completely. This is an important
  distinction because frontend assets are compiled independent of a
  request, whereas putting together a view depends on a request.

- Bind frontend view/asset factory instances to the container (in
  service providers) rather than subclassing. Asset and content
  populators can be added to these factories – these are simply objects
  that populate the asset compilers or the view with information.

- Add RouteHandlerFactory functions that make it easy to hook up a
  frontend controller with a frontend instance ± some content.

- Remove the need for "nojs"

- Fix cache:clear command

- Recompile assets when settings/enabled extensions change
This commit is contained in:
Toby Zerner
2018-06-30 12:31:12 +09:30
committed by GitHub
parent 0f5ddc1c43
commit 0e73785498
73 changed files with 2846 additions and 2176 deletions

View File

@@ -1,64 +1,42 @@
<?php
/**
* Forum Web App Template
*
* NOTE: You shouldn't edit this file directly. Your changes will be overwritten
* when you update Flarum. See flarum.org/docs/templates to learn how to
* customize your forum's layout.
*
* Flarum's JavaScript app mounts various components into key elements in
* this template. They are distinguished by their ID attributes:
*
* - #app
* - #app-navigation
* - #drawer
* - #header
* - #header-navigation
* - #home-link
* - #header-primary
* - #header-secondary
* - #content
* - #composer
*/
?>
{!! array_get($forum, 'attributes.headerHtml') !!}
{!! array_get($forum, 'headerHtml') !!}
<div id="app" class="App">
<div id="app-navigation" class="App-navigation"></div>
<div id="app-navigation" class="App-navigation"></div>
<div id="drawer" class="App-drawer">
<div id="drawer" class="App-drawer">
<header id="header" class="App-header">
<div id="header-navigation" class="Header-navigation"></div>
<div class="container">
<h1 class="Header-title">
<a href="{{ array_get($forum, 'attributes.baseUrl') }}" id="home-link">
<?php $title = array_get($forum, 'attributes.title'); ?>
@if ($logo = array_get($forum, 'attributes.logoUrl'))
<img src="{{ $logo }}" alt="{{ $title }}" class="Header-logo">
@else
{{ $title }}
@endif
</a>
</h1>
<div id="header-primary" class="Header-primary"></div>
<div id="header-secondary" class="Header-secondary"></div>
</div>
</header>
<header id="header" class="App-header">
<div id="header-navigation" class="Header-navigation"></div>
<div class="container">
<h1 class="Header-title">
<a href="{{ array_get($forum, 'baseUrl') }}" id="home-link">
@if ($logo = array_get($forum, 'logoUrl'))
<img src="{{ $logo }}" alt="{{ array_get($forum, 'title') }}" class="Header-logo">
@else
{{ array_get($forum, 'title') }}
@endif
</a>
</h1>
<div id="header-primary" class="Header-primary"></div>
<div id="header-secondary" class="Header-secondary"></div>
</div>
</header>
</div>
<main class="App-content">
<div id="content"></div>
{!! $content !!}
<div class="App-composer">
<div class="container">
<div id="composer"></div>
</div>
</div>
</main>
<main class="App-content">
<div id="content"></div>
{!! $content !!}
<div class="App-composer">
<div class="container">
<div id="composer"></div>
</div>
</div>
</main>
</div>
{!! array_get($forum, 'footerHtml') !!}