mirror of
https://github.com/flarum/framework.git
synced 2024-11-24 01:15:56 +08:00
Adapt new bootstrap format, use Asset extender
This commit is contained in:
parent
b0d247c5b8
commit
7435d18940
|
@ -11,14 +11,22 @@
|
|||
|
||||
use Flarum\Approval\Access;
|
||||
use Flarum\Approval\Listener;
|
||||
use Flarum\Extend;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
return function (Dispatcher $events) {
|
||||
$events->subscribe(Listener\AddClientAssets::class);
|
||||
$events->subscribe(Listener\AddPostApprovalAttributes::class);
|
||||
$events->subscribe(Listener\ApproveContent::class);
|
||||
$events->subscribe(Listener\HideUnapprovedContent::class);
|
||||
$events->subscribe(Listener\UnapproveNewContent::class);
|
||||
return [
|
||||
(new Extend\Assets('forum'))
|
||||
->defaultAssets(__DIR__)
|
||||
->bootstrapper('flarum/approval/main'),
|
||||
(new Extend\Assets('admin'))
|
||||
->asset(__DIR__.'/js/admin/dist/extension.js')
|
||||
->bootstrapper('flarum/approval/main'),
|
||||
function (Dispatcher $events) {
|
||||
$events->subscribe(Listener\AddPostApprovalAttributes::class);
|
||||
$events->subscribe(Listener\ApproveContent::class);
|
||||
$events->subscribe(Listener\HideUnapprovedContent::class);
|
||||
$events->subscribe(Listener\UnapproveNewContent::class);
|
||||
|
||||
$events->subscribe(Access\TagPolicy::class);
|
||||
};
|
||||
$events->subscribe(Access\TagPolicy::class);
|
||||
},
|
||||
];
|
||||
|
|
|
@ -1,47 +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\Approval\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']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Rendering $event
|
||||
*/
|
||||
public function addAssets(Rendering $event)
|
||||
{
|
||||
if ($event->isForum()) {
|
||||
$event->addAssets([
|
||||
__DIR__.'/../../js/forum/dist/extension.js',
|
||||
__DIR__.'/../../less/forum/extension.less'
|
||||
]);
|
||||
$event->addBootstrapper('flarum/approval/main');
|
||||
}
|
||||
|
||||
if ($event->isAdmin()) {
|
||||
$event->addAssets([
|
||||
__DIR__.'/../../js/admin/dist/extension.js'
|
||||
]);
|
||||
$event->addBootstrapper('flarum/approval/main');
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user