mirror of
https://github.com/flarum/framework.git
synced 2024-12-01 22:43:41 +08:00
Adapt new bootstrap format, use Asset extender
This commit is contained in:
parent
1a879ac59f
commit
a4c42dcfff
|
@ -9,13 +9,21 @@
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Flarum\Extend;
|
||||||
use Flarum\Sticky\Listener;
|
use Flarum\Sticky\Listener;
|
||||||
use Illuminate\Contracts\Events\Dispatcher;
|
use Illuminate\Contracts\Events\Dispatcher;
|
||||||
|
|
||||||
return function (Dispatcher $events) {
|
return [
|
||||||
$events->subscribe(Listener\AddApiAttributes::class);
|
(new Extend\Assets('forum'))
|
||||||
$events->subscribe(Listener\AddClientAssets::class);
|
->defaultAssets(__DIR__)
|
||||||
$events->subscribe(Listener\CreatePostWhenDiscussionIsStickied::class);
|
->bootstrapper('flarum/sticky/main'),
|
||||||
$events->subscribe(Listener\PinStickiedDiscussionsToTop::class);
|
(new Extend\Assets('admin'))
|
||||||
$events->subscribe(Listener\SaveStickyToDatabase::class);
|
->asset(__DIR__.'/js/admin/dist/extension.js')
|
||||||
};
|
->bootstrapper('flarum/sticky/main'),
|
||||||
|
function (Dispatcher $events) {
|
||||||
|
$events->subscribe(Listener\AddApiAttributes::class);
|
||||||
|
$events->subscribe(Listener\CreatePostWhenDiscussionIsStickied::class);
|
||||||
|
$events->subscribe(Listener\PinStickiedDiscussionsToTop::class);
|
||||||
|
$events->subscribe(Listener\SaveStickyToDatabase::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\Sticky\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/sticky/main');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($event->isAdmin()) {
|
|
||||||
$event->addAssets([
|
|
||||||
__DIR__.'/../../js/admin/dist/extension.js'
|
|
||||||
]);
|
|
||||||
$event->addBootstrapper('flarum/sticky/main');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user