mirror of
https://github.com/flarum/framework.git
synced 2025-01-19 05:52:49 +08:00
Fix class names, view namespace
This commit is contained in:
parent
7518578a13
commit
f19e24a377
|
@ -11,8 +11,11 @@
|
|||
|
||||
use Flarum\Embed\Listener;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
|
||||
return function (Dispatcher $events) {
|
||||
return function (Dispatcher $events, Factory $view) {
|
||||
$events->subscribe(Listener\AddEmbedRoute::class);
|
||||
$events->subscribe(Listener\FlushEmbedAssetsWhenSettingsAreChanged::class);
|
||||
|
||||
$view->addNamespace('flarum-embed', __DIR__.'/views');
|
||||
};
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
namespace Flarum\Embed;
|
||||
|
||||
use Flarum\Forum\WebApp;
|
||||
use Flarum\Forum\Frontend;
|
||||
|
||||
class EmbedWebApp extends WebApp
|
||||
class EmbedFrontend extends Frontend
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -25,7 +25,7 @@ class EmbedWebApp extends WebApp
|
|||
$view->getCss()->addFile(__DIR__.'/../less/forum/extension.less');
|
||||
|
||||
$view->loadModule('flarum/embed/main');
|
||||
$view->layout = __DIR__.'/../views/embed.blade.php';
|
||||
$view->layout = 'flarum-embed::embed';
|
||||
|
||||
return $view;
|
||||
}
|
|
@ -12,7 +12,6 @@ namespace Flarum\Embed;
|
|||
|
||||
use Flarum\Api\Client;
|
||||
use Flarum\Forum\Controller\DiscussionController;
|
||||
use Flarum\Forum\Frontend;
|
||||
use Flarum\Http\UrlGenerator;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
|
@ -21,7 +20,7 @@ class EmbeddedDiscussionController extends DiscussionController
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct(Frontend $frontend, Dispatcher $events, Client $api, UrlGenerator $url)
|
||||
public function __construct(EmbedFrontend $frontend, Dispatcher $events, Client $api, UrlGenerator $url)
|
||||
{
|
||||
parent::__construct($frontend, $events, $api, $url);
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
|
||||
namespace Flarum\Embed\Listener;
|
||||
|
||||
use Flarum\Embed\DiscussionController;
|
||||
use Flarum\Embed\EmbedWebApp;
|
||||
use Flarum\Embed\EmbedFrontend;
|
||||
use Flarum\Extension\Event\Disabled;
|
||||
use Flarum\Extension\Event\Enabled;
|
||||
use Flarum\Settings\Event\Saved;
|
||||
|
@ -20,16 +19,16 @@ use Illuminate\Contracts\Events\Dispatcher;
|
|||
class FlushEmbedAssetsWhenSettingsAreChanged
|
||||
{
|
||||
/**
|
||||
* @var DiscussionController
|
||||
* @var EmbedFrontend
|
||||
*/
|
||||
protected $webApp;
|
||||
protected $frontend;
|
||||
|
||||
/**
|
||||
* @param EmbedWebApp $webApp
|
||||
* @param EmbedFrontend $frontend
|
||||
*/
|
||||
public function __construct(EmbedWebApp $webApp)
|
||||
public function __construct(EmbedFrontend $frontend)
|
||||
{
|
||||
$this->webApp = $webApp;
|
||||
$this->frontend = $frontend;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,12 +47,12 @@ class FlushEmbedAssetsWhenSettingsAreChanged
|
|||
public function flushCss(Saved $event)
|
||||
{
|
||||
if (preg_match('/^theme_|^custom_less$/i', $event->key)) {
|
||||
$this->webApp->getAssets()->flushCss();
|
||||
$this->frontend->getAssets()->flushCss();
|
||||
}
|
||||
}
|
||||
|
||||
public function flushAssets()
|
||||
{
|
||||
$this->webApp->getAssets()->flush();
|
||||
$this->frontend->getAssets()->flush();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user