From 2c3bc4fdeef7588785b2e31c38a7ed803997da00 Mon Sep 17 00:00:00 2001 From: lastlink Date: Wed, 24 Jul 2024 08:34:16 -0400 Subject: [PATCH 1/3] add javascript to only detail page --- Helper/WikiHelper.php | 13 +++++++++++++ Plugin.php | 4 ++-- Template/wiki/detail.php | 4 +++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Helper/WikiHelper.php b/Helper/WikiHelper.php index 3c9990c..675321e 100644 --- a/Helper/WikiHelper.php +++ b/Helper/WikiHelper.php @@ -28,6 +28,19 @@ public function getWikipages($project_id) // return $this->wikiModel->getWikipages($project['id']); // return $this->db->table(self::WIKITABLE)->eq('project_id', $project_id)->desc('order')->findAll(); } + /** + * Add a Javascript asset + * + * @param string $filename Filename + * @param bool $async + * @return string + */ + public function js($filename, $async = false) + { + $dir = dirname(__DIR__,2); + $filepath = $dir.'/'.$filename; + return ''; + } /** * render wiki page html children recursively * @param mixed $children diff --git a/Plugin.php b/Plugin.php index 9abba34..aa86944 100755 --- a/Plugin.php +++ b/Plugin.php @@ -49,8 +49,8 @@ public function initialize() $this->template->setTemplateOverride('file_viewer/show', 'wiki:file_viewer/show'); $this->hook->on('template:layout:css', array('template' => 'plugins/Wiki/Asset/css/wiki.css')); - $this->hook->on('template:layout:js', array('template' => 'plugins/Wiki/Asset/vendor/jquery-sortable/jquery-sortable.js')); - $this->hook->on('template:layout:js', array('template' => 'plugins/Wiki/Asset/Javascript/wiki.js')); + // $this->hook->on('template:layout:js', array('template' => 'plugins/Wiki/Asset/vendor/jquery-sortable/jquery-sortable.js')); + // $this->hook->on('template:layout:js', array('template' => 'plugins/Wiki/Asset/Javascript/wiki.js')); // $this->template->setTemplateOverride('wiki', 'wiki:wiki/layout'); diff --git a/Template/wiki/detail.php b/Template/wiki/detail.php index 6f8e68e..92c97ed 100755 --- a/Template/wiki/detail.php +++ b/Template/wiki/detail.php @@ -1,7 +1,9 @@ -projectHeader->render($project, 'TaskListController', 'show') ?> + wikiHelper->js("/Wiki/Asset/vendor/jquery-sortable/jquery-sortable.js")?> + wikiHelper->js("/Wiki/Asset/Javascript/wiki.js")?> + projectHeader->render($project, 'TaskListController', 'show') ?>