diff --git a/extensions/yii/apidoc/templates/html/Renderer.php b/extensions/yii/apidoc/templates/html/Renderer.php index bf730c7..4d5ae20 100644 --- a/extensions/yii/apidoc/templates/html/Renderer.php +++ b/extensions/yii/apidoc/templates/html/Renderer.php @@ -76,7 +76,7 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface } $this->_view->assetManager = new AssetManager([ 'basePath' => $assetPath, - 'baseUrl' => '/assets', + 'baseUrl' => './assets', ]); } return $this->_view; diff --git a/extensions/yii/apidoc/templates/offline/Renderer.php b/extensions/yii/apidoc/templates/offline/Renderer.php index 1e544b7..a618fc8 100644 --- a/extensions/yii/apidoc/templates/offline/Renderer.php +++ b/extensions/yii/apidoc/templates/offline/Renderer.php @@ -23,22 +23,4 @@ class Renderer extends \yii\apidoc\templates\html\Renderer public $indexView = '@yii/apidoc/templates/offline/views/index.php'; public $pageTitle = 'Yii Framework 2.0 API Documentation'; - - /** - * Renders a given [[Context]]. - * - * @param Context $context the api documentation context to render. - * @param Controller $controller the apidoc controller instance. Can be used to control output. - */ - public function render($context, $controller) - { - parent::render($context, $controller); - - $dir = Yii::getAlias($this->targetDir); - - $controller->stdout('Copying asset files... '); - FileHelper::copyDirectory(__DIR__ . '/assets/css', $dir . '/css'); - $controller->stdout('done.' . PHP_EOL, Console::FG_GREEN); - } - } \ No newline at end of file diff --git a/extensions/yii/apidoc/templates/offline/assets/AssetBundle.php b/extensions/yii/apidoc/templates/offline/assets/AssetBundle.php new file mode 100644 index 0000000..e8c7024 --- /dev/null +++ b/extensions/yii/apidoc/templates/offline/assets/AssetBundle.php @@ -0,0 +1,31 @@ + + * @since 2.0 + */ +class AssetBundle extends \yii\web\AssetBundle +{ + public $sourcePath = '@yii/apidoc/templates/offline/assets/css'; + public $css = [ + 'api.css', + 'style.css', + ]; + public $depends = [ + 'yii\web\JqueryAsset', + ]; + public $jsOptions = [ + 'position' => View::POS_HEAD, + ]; +} diff --git a/extensions/yii/apidoc/templates/offline/views/offline.php b/extensions/yii/apidoc/templates/offline/views/offline.php index 36b2487..b5565c5 100644 --- a/extensions/yii/apidoc/templates/offline/views/offline.php +++ b/extensions/yii/apidoc/templates/offline/views/offline.php @@ -4,6 +4,8 @@ * @var yii\web\View $this */ +\yii\apidoc\templates\offline\assets\AssetBundle::register($this); + $this->beginPage(); ?> @@ -11,9 +13,6 @@ $this->beginPage();
- - - head(); ?>