mirror of
https://github.com/flarum/framework.git
synced 2024-11-25 01:36:53 +08:00
Merge branch 'master' into composer
This commit is contained in:
commit
296b822636
|
@ -20,7 +20,7 @@ export default class EditCustomCssModal extends Modal {
|
||||||
content() {
|
content() {
|
||||||
return (
|
return (
|
||||||
<div className="Modal-body">
|
<div className="Modal-body">
|
||||||
<p>Customize your forum's appearance by adding your own LESS/CSS code to be applied on top of Flarum's default styles. <a href="">Read the documentation</a> for more information.</p>
|
<p>Customize your forum's appearance by adding your own LESS/CSS code to be applied on top of Flarum's default styles. <a href="http://flarum.org/docs/extend/themes/">Read the documentation</a> for more information.</p>
|
||||||
|
|
||||||
<div className="Form">
|
<div className="Form">
|
||||||
<div className="Form-group">
|
<div className="Form-group">
|
||||||
|
|
|
@ -18,7 +18,6 @@ use Flarum\Api\Client;
|
||||||
use Flarum\Core\Settings\SettingsRepository;
|
use Flarum\Core\Settings\SettingsRepository;
|
||||||
use Flarum\Locale\LocaleManager;
|
use Flarum\Locale\LocaleManager;
|
||||||
use Flarum\Events\UnserializeConfig;
|
use Flarum\Events\UnserializeConfig;
|
||||||
use Flarum\Events\BuildAdminClientView;
|
|
||||||
|
|
||||||
class ClientAction extends BaseClientAction
|
class ClientAction extends BaseClientAction
|
||||||
{
|
{
|
||||||
|
@ -42,14 +41,6 @@ class ClientAction extends BaseClientAction
|
||||||
$this->layout = __DIR__.'/../../../views/admin.blade.php';
|
$this->layout = __DIR__.'/../../../views/admin.blade.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
protected function fireEvent(ClientView $view, array &$keys)
|
|
||||||
{
|
|
||||||
event(new BuildAdminClientView($this, $view, $keys));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
<?php
|
|
||||||
/*
|
|
||||||
* This file is part of Flarum.
|
|
||||||
*
|
|
||||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Flarum\Events;
|
|
||||||
|
|
||||||
use Flarum\Support\ClientView;
|
|
||||||
use Flarum\Admin\Actions\ClientAction;
|
|
||||||
|
|
||||||
class BuildAdminClientView extends BuildClientView
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var ClientAction
|
|
||||||
*/
|
|
||||||
public $action;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ClientAction $action
|
|
||||||
* @param ClientView $view
|
|
||||||
* @param array $keys
|
|
||||||
*/
|
|
||||||
public function __construct(ClientAction $action, ClientView $view, array &$keys)
|
|
||||||
{
|
|
||||||
$this->action = $action;
|
|
||||||
$this->view = $view;
|
|
||||||
$this->keys = &$keys;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -12,8 +12,10 @@ namespace Flarum\Events;
|
||||||
|
|
||||||
use Flarum\Support\ClientAction;
|
use Flarum\Support\ClientAction;
|
||||||
use Flarum\Support\ClientView;
|
use Flarum\Support\ClientView;
|
||||||
|
use Flarum\Admin\Actions\ClientAction as AdminClientAction;
|
||||||
|
use Flarum\Forum\Actions\ClientAction as ForumClientAction;
|
||||||
|
|
||||||
abstract class BuildClientView
|
class BuildClientView
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var ClientAction
|
* @var ClientAction
|
||||||
|
@ -30,17 +32,39 @@ abstract class BuildClientView
|
||||||
*/
|
*/
|
||||||
public $keys;
|
public $keys;
|
||||||
|
|
||||||
public function assets($files)
|
/**
|
||||||
|
* @param ClientAction $action
|
||||||
|
* @param ClientView $view
|
||||||
|
* @param array $keys
|
||||||
|
*/
|
||||||
|
public function __construct(ClientAction $action, ClientView $view, array &$keys)
|
||||||
|
{
|
||||||
|
$this->action = $action;
|
||||||
|
$this->view = $view;
|
||||||
|
$this->keys = &$keys;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isForum()
|
||||||
|
{
|
||||||
|
return $this->action instanceof ForumClientAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isAdmin()
|
||||||
|
{
|
||||||
|
return $this->action instanceof AdminClientAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addAssets($files)
|
||||||
{
|
{
|
||||||
$this->view->getAssets()->addFiles((array) $files);
|
$this->view->getAssets()->addFiles((array) $files);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function bootstrapper($bootstrapper)
|
public function addBootstrapper($bootstrapper)
|
||||||
{
|
{
|
||||||
$this->view->addBootstrapper($bootstrapper);
|
$this->view->addBootstrapper($bootstrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function translations(array $keys)
|
public function addTranslations(array $keys)
|
||||||
{
|
{
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
$this->keys[] = $key;
|
$this->keys[] = $key;
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
<?php
|
|
||||||
/*
|
|
||||||
* This file is part of Flarum.
|
|
||||||
*
|
|
||||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Flarum\Events;
|
|
||||||
|
|
||||||
use Flarum\Support\ClientView;
|
|
||||||
use Flarum\Forum\Actions\ClientAction;
|
|
||||||
|
|
||||||
class BuildForumClientView extends BuildClientView
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var ClientAction
|
|
||||||
*/
|
|
||||||
public $action;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ClientAction $action
|
|
||||||
* @param ClientView $view
|
|
||||||
* @param array $keys
|
|
||||||
*/
|
|
||||||
public function __construct(ClientAction $action, ClientView $view, array &$keys)
|
|
||||||
{
|
|
||||||
$this->action = $action;
|
|
||||||
$this->view = $view;
|
|
||||||
$this->keys = &$keys;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -15,7 +15,6 @@ use Flarum\Support\ClientView;
|
||||||
use Flarum\Api\Client;
|
use Flarum\Api\Client;
|
||||||
use Flarum\Core\Settings\SettingsRepository;
|
use Flarum\Core\Settings\SettingsRepository;
|
||||||
use Flarum\Locale\LocaleManager;
|
use Flarum\Locale\LocaleManager;
|
||||||
use Flarum\Events\BuildForumClientView;
|
|
||||||
|
|
||||||
class ClientAction extends BaseClientAction
|
class ClientAction extends BaseClientAction
|
||||||
{
|
{
|
||||||
|
@ -39,14 +38,6 @@ class ClientAction extends BaseClientAction
|
||||||
$this->layout = __DIR__.'/../../../views/forum.blade.php';
|
$this->layout = __DIR__.'/../../../views/forum.blade.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
protected function fireEvent(ClientView $view, array &$keys)
|
|
||||||
{
|
|
||||||
event(new BuildForumClientView($this, $view, $keys));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -19,6 +19,7 @@ use Flarum\Core\Settings\SettingsRepository;
|
||||||
use Flarum\Core\Users\User;
|
use Flarum\Core\Users\User;
|
||||||
use Flarum\Locale\JsCompiler as LocaleJsCompiler;
|
use Flarum\Locale\JsCompiler as LocaleJsCompiler;
|
||||||
use Flarum\Locale\LocaleManager;
|
use Flarum\Locale\LocaleManager;
|
||||||
|
use Flarum\Events\BuildClientView;
|
||||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,7 +122,7 @@ abstract class ClientAction extends HtmlAction
|
||||||
// compile only the ones we need.
|
// compile only the ones we need.
|
||||||
$keys = $this->translationKeys;
|
$keys = $this->translationKeys;
|
||||||
|
|
||||||
$this->fireEvent($view, $keys);
|
event(new BuildClientView($this, $view, $keys));
|
||||||
|
|
||||||
if ($localeCompiler) {
|
if ($localeCompiler) {
|
||||||
$translations = $this->locales->getTranslations($locale);
|
$translations = $this->locales->getTranslations($locale);
|
||||||
|
@ -134,13 +135,6 @@ abstract class ClientAction extends HtmlAction
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ClientView $view
|
|
||||||
* @param array &$keys
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
abstract protected function fireEvent(ClientView $view, array &$keys);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flush the client's assets so that they will be regenerated from scratch
|
* Flush the client's assets so that they will be regenerated from scratch
|
||||||
* on the next render.
|
* on the next render.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user