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([
|
||||
'basePath' => $assetPath,
|
||||
'baseUrl' => '/assets',
|
||||
'baseUrl' => './assets',
|
||||
]);
|
||||
}
|
||||
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 $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
|
||||
*/
|
||||
|
||||
\yii\apidoc\templates\offline\assets\AssetBundle::register($this);
|
||||
|
||||
$this->beginPage();
|
||||
?>
|
||||
<!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>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<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(); ?>
|
||||
<title><?php echo $this->context->pageTitle; ?></title>
|
||||
</head>
|
||||
@@ -35,16 +34,22 @@ $this->beginPage();
|
||||
All Rights Reserved.<br/>
|
||||
</div><!-- end of footer -->
|
||||
|
||||
<?php \yii\web\JqueryAsset::register($this); ?>
|
||||
<script type="text/javascript">
|
||||
/*<![CDATA[*/
|
||||
$("a.toggle").toggle(function(){
|
||||
$(this).text($(this).text().replace(/Hide/,'Show'));
|
||||
$(this).parents(".summary").find(".inherited").hide();
|
||||
},function(){
|
||||
$(this).text($(this).text().replace(/Show/,'Hide'));
|
||||
$(this).parents(".summary").find(".inherited").show();
|
||||
$("a.toggle").on('click', function() {
|
||||
var $this = $(this);
|
||||
if ($this.hasClass('properties-hidden')) {
|
||||
$this.text($this.text().replace(/Show/,'Hide'));
|
||||
$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(){
|
||||
$(this).text($(this).text().replace(/show/,'hide'));
|
||||
$(this).parents(".sourceCode").find("div.code").show();
|
||||
@@ -55,6 +60,7 @@ $(".sourceCode a.show").toggle(function(){
|
||||
$("a.sourceLink").click(function(){
|
||||
$(this).attr('target','_blank');
|
||||
});
|
||||
*/
|
||||
/*]]>*/
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1471,7 +1471,7 @@ class BaseHtml
|
||||
return Yii::$app->getRequest()->getUrl();
|
||||
} else {
|
||||
$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;
|
||||
} else {
|
||||
return Yii::$app->getRequest()->getBaseUrl() . '/' . $url;
|
||||
|
||||
Reference in New Issue
Block a user