Skip to content

Commit

Permalink
refactor: Use addScript
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Ng <[email protected]>
  • Loading branch information
Pytal committed Jun 11, 2024
1 parent 7904572 commit 332856b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/Listener/LoadAdditionalScriptsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@
use OCA\Files\Event\LoadAdditionalScriptsEvent;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\Util;

/**
* @template-implements IEventListener<LoadAdditionalScriptsEvent>
*/
class LoadAdditionalScriptsListener implements IEventListener {
public function handle(Event $event): void {
\OCP\Util::addScript('guests', 'guests-main');
Util::addScript('guests', 'guests-main');
}
}
2 changes: 2 additions & 0 deletions lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

use OCA\Guests\AppWhitelist;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Util;

class Admin implements \OCP\Settings\ISettings {
/** @var AppWhitelist */
Expand All @@ -36,6 +37,7 @@ public function __construct(AppWhitelist $appWhitelist) {
* {@inheritdoc}
*/
public function getForm(): TemplateResponse {
Util::addScript('guests', 'guests-settings');
return new TemplateResponse('guests', 'settings/admin');
}

Expand Down
1 change: 0 additions & 1 deletion templates/settings/admin.php
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<?php script('guests', 'guests-settings'); ?>
<div id="guest-settings"/>

0 comments on commit 332856b

Please sign in to comment.