Skip to content

Commit

Permalink
Merge pull request #86 from funktechno/bug/subpage
Browse files Browse the repository at this point in the history
add javascript to only detail page
  • Loading branch information
lastlink authored Jul 24, 2024
2 parents a2a8001 + de353e7 commit 9994bb4
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
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

0 comments on commit 9994bb4

Please sign in to comment.