Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add javascript to only detail page #86

Merged
merged 3 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ Improvements:

* unit test updates
* code cleanup
* Add Wiki entry to views switcher, fixes issue #61.
* Add Wiki entry to views switcher
* only load nested vendor on detail page

Bug fixes:

* Fix https://github.com/funktechno/kanboard-plugin-wiki/issues/
* Fix https://github.com/funktechno/kanboard-plugin-wiki/issues/61
* Fix https://github.com/funktechno/kanboard-plugin-wiki/issues/11

Version 0.3.6
Improvements:
Expand Down
13 changes: 13 additions & 0 deletions Helper/WikiHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<script '.($async ? 'async' : '').' defer type="text/javascript" src="'.$this->helper->url->dir()."plugins".$filename.'?'.filemtime($filepath).'"></script>';
}
/**
* render wiki page html children recursively
* @param mixed $children
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugin=Wiki
version=0.3.6
version=0.3.7
all:
@ echo "Build archive for plugin ${plugin} version=${version}"
@ git archive HEAD --prefix=${plugin}/ --format=zip -o ${plugin}-${version}.zip
6 changes: 3 additions & 3 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -98,7 +98,7 @@ public function getPluginAuthor()

public function getPluginVersion()
{
return '0.3.6';
return '0.3.7';
}

public function getPluginHomepage()
Expand Down
4 changes: 3 additions & 1 deletion Template/wiki/detail.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php (isset($not_editable)) ?: $not_editable = false;
?>
<?php if (!$not_editable): ?>
<?= $this->projectHeader->render($project, 'TaskListController', 'show') ?>
<?=$this->wikiHelper->js("/Wiki/Asset/vendor/jquery-sortable/jquery-sortable.js")?>
<?=$this->wikiHelper->js("/Wiki/Asset/Javascript/wiki.js")?>
<?= $this->projectHeader->render($project, 'TaskListController', 'show') ?>
<?php endif ?>
<div class="page-header">
<h2>
Expand Down
Loading