Skip to content

Commit 9994bb4

Browse files
authored
Merge pull request #86 from funktechno/bug/subpage
add javascript to only detail page
2 parents a2a8001 + de353e7 commit 9994bb4

File tree

5 files changed

+24
-7
lines changed

5 files changed

+24
-7
lines changed

ChangeLog

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ Improvements:
33

44
* unit test updates
55
* code cleanup
6-
* Add Wiki entry to views switcher, fixes issue #61.
6+
* Add Wiki entry to views switcher
7+
* only load nested vendor on detail page
78

89
Bug fixes:
910

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

1214
Version 0.3.6
1315
Improvements:

Helper/WikiHelper.php

+13
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@ public function getWikipages($project_id)
2828
// return $this->wikiModel->getWikipages($project['id']);
2929
// return $this->db->table(self::WIKITABLE)->eq('project_id', $project_id)->desc('order')->findAll();
3030
}
31+
/**
32+
* Add a Javascript asset
33+
*
34+
* @param string $filename Filename
35+
* @param bool $async
36+
* @return string
37+
*/
38+
public function js($filename, $async = false)
39+
{
40+
$dir = dirname(__DIR__,2);
41+
$filepath = $dir.'/'.$filename;
42+
return '<script '.($async ? 'async' : '').' defer type="text/javascript" src="'.$this->helper->url->dir()."plugins".$filename.'?'.filemtime($filepath).'"></script>';
43+
}
3144
/**
3245
* render wiki page html children recursively
3346
* @param mixed $children

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugin=Wiki
2-
version=0.3.6
2+
version=0.3.7
33
all:
44
@ echo "Build archive for plugin ${plugin} version=${version}"
55
@ git archive HEAD --prefix=${plugin}/ --format=zip -o ${plugin}-${version}.zip

Plugin.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public function initialize()
4949
$this->template->setTemplateOverride('file_viewer/show', 'wiki:file_viewer/show');
5050

5151
$this->hook->on('template:layout:css', array('template' => 'plugins/Wiki/Asset/css/wiki.css'));
52-
$this->hook->on('template:layout:js', array('template' => 'plugins/Wiki/Asset/vendor/jquery-sortable/jquery-sortable.js'));
53-
$this->hook->on('template:layout:js', array('template' => 'plugins/Wiki/Asset/Javascript/wiki.js'));
52+
// $this->hook->on('template:layout:js', array('template' => 'plugins/Wiki/Asset/vendor/jquery-sortable/jquery-sortable.js'));
53+
// $this->hook->on('template:layout:js', array('template' => 'plugins/Wiki/Asset/Javascript/wiki.js'));
5454

5555

5656
// $this->template->setTemplateOverride('wiki', 'wiki:wiki/layout');
@@ -98,7 +98,7 @@ public function getPluginAuthor()
9898

9999
public function getPluginVersion()
100100
{
101-
return '0.3.6';
101+
return '0.3.7';
102102
}
103103

104104
public function getPluginHomepage()

Template/wiki/detail.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<?php (isset($not_editable)) ?: $not_editable = false;
22
?>
33
<?php if (!$not_editable): ?>
4-
<?= $this->projectHeader->render($project, 'TaskListController', 'show') ?>
4+
<?=$this->wikiHelper->js("/Wiki/Asset/vendor/jquery-sortable/jquery-sortable.js")?>
5+
<?=$this->wikiHelper->js("/Wiki/Asset/Javascript/wiki.js")?>
6+
<?= $this->projectHeader->render($project, 'TaskListController', 'show') ?>
57
<?php endif ?>
68
<div class="page-header">
79
<h2>

0 commit comments

Comments
 (0)