From 5c46e03750122e5f25552542e28e10012f4221ba Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Sat, 3 Oct 2015 16:44:20 +0930 Subject: [PATCH] Use new BuildClientView API --- .../tags/src/Listeners/AddClientAssets.php | 48 +++++++------------ 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/extensions/tags/src/Listeners/AddClientAssets.php b/extensions/tags/src/Listeners/AddClientAssets.php index 5e39e93d5..14726cab1 100755 --- a/extensions/tags/src/Listeners/AddClientAssets.php +++ b/extensions/tags/src/Listeners/AddClientAssets.php @@ -1,4 +1,4 @@ -listen(RegisterLocales::class, [$this, 'addLocale']); $events->listen(BuildClientView::class, [$this, 'addAssets']); $events->listen(RegisterForumRoutes::class, [$this, 'addRoutes']); } - public function addLocale(RegisterLocales $event) - { - $event->addTranslations('en', __DIR__.'/../../locale/en.yml'); - } - public function addAssets(BuildClientView $event) { - $event->forumAssets([ - __DIR__.'/../../js/forum/dist/extension.js', - __DIR__.'/../../less/forum/extension.less' - ]); + if ($event->isForum()) { + $event->addAssets([ + __DIR__.'/../../js/forum/dist/extension.js', + __DIR__.'/../../less/forum/extension.less' + ]); - $event->forumBootstrapper('tags/main'); + $event->addBootstrapper('flarum/tags/main'); - $event->forumTranslations([ - 'tags.tags', - 'tags.discussion_tagged_post', - 'tags.added_tags', - 'tags.removed_tags', - 'tags.tag_new_discussion_title', - 'tags.tag_new_discussion_link', - 'tags.edit_discussion_tags_title', - 'tags.edit_discussion_tags_link', - 'tags.choose_primary_tags', - 'tags.choose_secondary_tags', - 'tags.confirm', - 'tags.more', - 'tags.deleted' - ]); + $event->addTranslations(['flarum-tags.forum']); + } - $event->adminAssets([ - __DIR__.'/../../js/admin/dist/extension.js', - __DIR__.'/../../less/admin/extension.less' - ]); + if ($event->isAdmin()) { + $event->addAssets([ + __DIR__.'/../../js/admin/dist/extension.js', + __DIR__.'/../../less/admin/extension.less' + ]); - $event->adminBootstrapper('tags/main'); + $event->addBootstrapper('flarum/tags/main'); + } } public function addRoutes(RegisterForumRoutes $event)