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

Adapt new bootstrap format, use Asset extender

This commit is contained in:
Franz Liedke
2018-01-16 23:20:02 +01:00
parent 36f409d3e9
commit 9c6ef9e043
2 changed files with 15 additions and 52 deletions

View File

@@ -9,15 +9,23 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
use Flarum\Extend;
use Flarum\Suspend\Access; use Flarum\Suspend\Access;
use Flarum\Suspend\Listener; use Flarum\Suspend\Listener;
use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Events\Dispatcher;
return function (Dispatcher $events) { return [
$events->subscribe(Listener\AddClientAssets::class); (new Extend\Assets('forum'))
$events->subscribe(Listener\AddUserSuspendAttributes::class); ->defaultAssets(__DIR__)
$events->subscribe(Listener\RevokeAccessFromSuspendedUsers::class); ->bootstrapper('flarum/suspend/main'),
$events->subscribe(Listener\SaveSuspensionToDatabase::class); (new Extend\Assets('admin'))
->defaultAssets(__DIR__)
->bootstrapper('flarum/suspend/main'),
function (Dispatcher $events) {
$events->subscribe(Listener\AddUserSuspendAttributes::class);
$events->subscribe(Listener\RevokeAccessFromSuspendedUsers::class);
$events->subscribe(Listener\SaveSuspensionToDatabase::class);
$events->subscribe(Access\UserPolicy::class); $events->subscribe(Access\UserPolicy::class);
}; }
];

View File

@@ -1,45 +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\Suspend\Listener;
use Flarum\Frontend\Event\Rendering;
use Illuminate\Contracts\Events\Dispatcher;
class AddClientAssets
{
/**
* @param Dispatcher $events
*/
public function subscribe(Dispatcher $events)
{
$events->listen(Rendering::class, [$this, 'addAssets']);
}
public function addAssets(Rendering $event)
{
if ($event->isForum()) {
$event->addAssets([
__DIR__.'/../../js/forum/dist/extension.js',
__DIR__.'/../../less/forum/extension.less'
]);
$event->addBootstrapper('flarum/suspend/main');
}
if ($event->isAdmin()) {
$event->addAssets([
__DIR__.'/../../js/admin/dist/extension.js',
__DIR__.'/../../less/admin/extension.less'
]);
$event->addBootstrapper('flarum/suspend/main');
}
}
}