Qiang Xue
12 years ago
9 changed files with 123 additions and 1 deletions
@ -0,0 +1,26 @@
|
||||
/** |
||||
* Yii debug module. |
||||
* |
||||
* This JavaScript module provides the functions needed by the Yii debug toolbar. |
||||
* |
||||
* @link http://www.yiiframework.com/
|
||||
* @copyright Copyright (c) 2008 Yii Software LLC |
||||
* @license http://www.yiiframework.com/license/
|
||||
* @author Qiang Xue <qiang.xue@gmail.com> |
||||
* @since 2.0 |
||||
*/ |
||||
|
||||
yii.debug = (function ($) { |
||||
return { |
||||
load: function (id, url) { |
||||
$.ajax({ |
||||
url: url, |
||||
//dataType: 'json',
|
||||
success: function(data) { |
||||
var $e = $('#' + id); |
||||
$e.html(data); |
||||
} |
||||
}); |
||||
} |
||||
}; |
||||
})(jQuery); |
@ -0,0 +1,17 @@
|
||||
<?php |
||||
/** |
||||
* @link http://www.yiiframework.com/ |
||||
* @copyright Copyright (c) 2008 Yii Software LLC |
||||
* @license http://www.yiiframework.com/license/ |
||||
*/ |
||||
|
||||
namespace yii\debug; |
||||
|
||||
/** |
||||
* @author Qiang Xue <qiang.xue@gmail.com> |
||||
* @since 2.0 |
||||
*/ |
||||
class Module extends \yii\base\Module |
||||
{ |
||||
public $controllerNamespace = 'yii\debug\controllers'; |
||||
} |
@ -0,0 +1,38 @@
|
||||
<?php |
||||
/** |
||||
* @link http://www.yiiframework.com/ |
||||
* @copyright Copyright (c) 2008 Yii Software LLC |
||||
* @license http://www.yiiframework.com/license/ |
||||
*/ |
||||
|
||||
namespace yii\debug; |
||||
|
||||
use Yii; |
||||
use yii\base\Widget; |
||||
use yii\helpers\Html; |
||||
|
||||
/** |
||||
* @author Qiang Xue <qiang.xue@gmail.com> |
||||
* @since 2.0 |
||||
*/ |
||||
class Toolbar extends Widget |
||||
{ |
||||
public $debugAction = 'debug'; |
||||
public $enabled = YII_DEBUG; |
||||
|
||||
public function run() |
||||
{ |
||||
if ($this->enabled) { |
||||
$id = 'yii-debug-toolbar'; |
||||
$url = Yii::$app->getUrlManager()->createUrl($this->debugAction, array( |
||||
'tag' => Yii::getLogger()->tag, |
||||
)); |
||||
$this->view->registerJs("yii.debug.load('$id', '$url');"); |
||||
$this->view->registerAssetBundle('yii/debug'); |
||||
echo Html::tag('div', '', array( |
||||
'id' => $id, |
||||
'style' => 'display: none', |
||||
)); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,22 @@
|
||||
<?php |
||||
/** |
||||
* @link http://www.yiiframework.com/ |
||||
* @copyright Copyright (c) 2008 Yii Software LLC |
||||
* @license http://www.yiiframework.com/license/ |
||||
*/ |
||||
|
||||
namespace yii\debug\controllers; |
||||
|
||||
use yii\web\Controller; |
||||
|
||||
/** |
||||
* @author Qiang Xue <qiang.xue@gmail.com> |
||||
* @since 2.0 |
||||
*/ |
||||
class DefaultController extends Controller |
||||
{ |
||||
public function actionIndex($tag) |
||||
{ |
||||
echo $tag; |
||||
} |
||||
} |
Loading…
Reference in new issue