mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-22 01:30:23 +08:00
fixed javascript
This commit is contained in:
@@ -76,7 +76,7 @@ abstract class Renderer extends BaseRenderer implements ViewContextInterface
|
|||||||
}
|
}
|
||||||
$this->_view->assetManager = new AssetManager([
|
$this->_view->assetManager = new AssetManager([
|
||||||
'basePath' => $assetPath,
|
'basePath' => $assetPath,
|
||||||
'baseUrl' => '/assets',
|
'baseUrl' => './assets',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
return $this->_view;
|
return $this->_view;
|
||||||
|
|||||||
@@ -23,22 +23,4 @@ class Renderer extends \yii\apidoc\templates\html\Renderer
|
|||||||
public $indexView = '@yii/apidoc/templates/offline/views/index.php';
|
public $indexView = '@yii/apidoc/templates/offline/views/index.php';
|
||||||
|
|
||||||
public $pageTitle = 'Yii Framework 2.0 API Documentation';
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @link http://www.yiiframework.com/
|
||||||
|
* @copyright Copyright (c) 2008 Yii Software LLC
|
||||||
|
* @license http://www.yiiframework.com/license/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace yii\apidoc\templates\offline\assets;
|
||||||
|
use yii\web\JqueryAsset;
|
||||||
|
use yii\web\View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The asset bundle for the offline template.
|
||||||
|
*
|
||||||
|
* @author Carsten Brandt <mail@cebe.cc>
|
||||||
|
* @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,
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -4,6 +4,8 @@
|
|||||||
* @var yii\web\View $this
|
* @var yii\web\View $this
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
\yii\apidoc\templates\offline\assets\AssetBundle::register($this);
|
||||||
|
|
||||||
$this->beginPage();
|
$this->beginPage();
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
@@ -11,9 +13,6 @@ $this->beginPage();
|
|||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<meta name="language" content="en" />
|
<meta name="language" content="en" />
|
||||||
<link rel="stylesheet" type="text/css" href="css/style.css" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="css/api.css" />
|
|
||||||
<script type="text/javascript" src="js/jquery.js"></script>
|
|
||||||
<?php $this->head(); ?>
|
<?php $this->head(); ?>
|
||||||
<title><?php echo $this->context->pageTitle; ?></title>
|
<title><?php echo $this->context->pageTitle; ?></title>
|
||||||
</head>
|
</head>
|
||||||
@@ -35,16 +34,22 @@ $this->beginPage();
|
|||||||
All Rights Reserved.<br/>
|
All Rights Reserved.<br/>
|
||||||
</div><!-- end of footer -->
|
</div><!-- end of footer -->
|
||||||
|
|
||||||
<?php \yii\web\JqueryAsset::register($this); ?>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
/*<![CDATA[*/
|
/*<![CDATA[*/
|
||||||
$("a.toggle").toggle(function(){
|
$("a.toggle").on('click', function() {
|
||||||
$(this).text($(this).text().replace(/Hide/,'Show'));
|
var $this = $(this);
|
||||||
$(this).parents(".summary").find(".inherited").hide();
|
if ($this.hasClass('properties-hidden')) {
|
||||||
},function(){
|
$this.text($this.text().replace(/Show/,'Hide'));
|
||||||
$(this).text($(this).text().replace(/Show/,'Hide'));
|
$this.parents(".summary").find(".inherited").show();
|
||||||
$(this).parents(".summary").find(".inherited").show();
|
$this.removeClass('properties-hidden');
|
||||||
|
} else {
|
||||||
|
$this.text($this.text().replace(/Hide/,'Show'));
|
||||||
|
$this.parents(".summary").find(".inherited").hide();
|
||||||
|
$this.addClass('properties-hidden');
|
||||||
|
}
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
|
/*
|
||||||
$(".sourceCode a.show").toggle(function(){
|
$(".sourceCode a.show").toggle(function(){
|
||||||
$(this).text($(this).text().replace(/show/,'hide'));
|
$(this).text($(this).text().replace(/show/,'hide'));
|
||||||
$(this).parents(".sourceCode").find("div.code").show();
|
$(this).parents(".sourceCode").find("div.code").show();
|
||||||
@@ -55,6 +60,7 @@ $(".sourceCode a.show").toggle(function(){
|
|||||||
$("a.sourceLink").click(function(){
|
$("a.sourceLink").click(function(){
|
||||||
$(this).attr('target','_blank');
|
$(this).attr('target','_blank');
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
/*]]>*/
|
/*]]>*/
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1471,7 +1471,7 @@ class BaseHtml
|
|||||||
return Yii::$app->getRequest()->getUrl();
|
return Yii::$app->getRequest()->getUrl();
|
||||||
} else {
|
} else {
|
||||||
$url = Yii::getAlias($url);
|
$url = Yii::getAlias($url);
|
||||||
if ($url !== '' && ($url[0] === '/' || $url[0] === '#' || strpos($url, '://'))) {
|
if ($url !== '' && ($url[0] === '/' || $url[0] === '#' || strpos($url, '://') || !strncmp($url, './', 2))) {
|
||||||
return $url;
|
return $url;
|
||||||
} else {
|
} else {
|
||||||
return Yii::$app->getRequest()->getBaseUrl() . '/' . $url;
|
return Yii::$app->getRequest()->getBaseUrl() . '/' . $url;
|
||||||
|
|||||||
Reference in New Issue
Block a user