From 9cef15b4f5fa318f3b815aa8239d4107a78dd365 Mon Sep 17 00:00:00 2001 From: Christian Wolf Date: Tue, 11 Jun 2019 14:11:46 +0200 Subject: [PATCH] Basic JS insertion successfully done --- src/admin/res/clubs.js | 8 ++++++++ src/admin/views/test/tmpl/default.php | 4 +++- src/admin/views/test/tmpl/foo.php | 2 ++ src/admin/views/test/view.html.php | 5 +++++ 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/admin/res/clubs.js diff --git a/src/admin/res/clubs.js b/src/admin/res/clubs.js new file mode 100644 index 0000000..be3e993 --- /dev/null +++ b/src/admin/res/clubs.js @@ -0,0 +1,8 @@ + +jQuery(function($){ + $('#mya').click(function() + { + //alert("a"); + console.log("a"); + }); +}); diff --git a/src/admin/views/test/tmpl/default.php b/src/admin/views/test/tmpl/default.php index 90b91bb..c114058 100644 --- a/src/admin/views/test/tmpl/default.php +++ b/src/admin/views/test/tmpl/default.php @@ -19,4 +19,6 @@ Place: getName(); ?>

Output

-
log); ?>
\ No newline at end of file +
log); ?>
+ +Test Link diff --git a/src/admin/views/test/tmpl/foo.php b/src/admin/views/test/tmpl/foo.php index 8b7e2d6..24670a8 100644 --- a/src/admin/views/test/tmpl/foo.php +++ b/src/admin/views/test/tmpl/foo.php @@ -4,3 +4,5 @@ defined('_JEXEC') or die; // Append &layout=foo to URL +?> +

This is foo.

diff --git a/src/admin/views/test/view.html.php b/src/admin/views/test/view.html.php index d6049fa..c080266 100644 --- a/src/admin/views/test/view.html.php +++ b/src/admin/views/test/view.html.php @@ -2,6 +2,7 @@ use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\CMS\MVC\View\HtmlView; +use Joomla\CMS\Factory; // No direct access. defined('_JEXEC') or die; @@ -44,6 +45,10 @@ class ClubsViewTest extends HtmlView $this->log = $np; parent::display($tpl); + //Factory::getDocument()->addScript( "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" ); + JHtmlJquery::framework(); + Factory::getDocument()->addScript('components/com_clubs/res/clubs.js'); + //jexit(); } protected function getViewName()