Commit 0e013c4f by Qiang Xue

Fixed debugger with the new bootstrap.

parent afa0a2b1
...@@ -21,6 +21,7 @@ class SiteController extends Controller ...@@ -21,6 +21,7 @@ class SiteController extends Controller
public function actionIndex() public function actionIndex()
{ {
Yii::warning('test');
return $this->render('index'); return $this->render('index');
} }
......
...@@ -46,7 +46,7 @@ class ButtonDropdown extends Widget ...@@ -46,7 +46,7 @@ class ButtonDropdown extends Widget
/** /**
* @var array the HTML attributes of the button. * @var array the HTML attributes of the button.
*/ */
public $buttonOptions = array(); public $options = array();
/** /**
* @var array the configuration array for [[Dropdown]]. * @var array the configuration array for [[Dropdown]].
*/ */
...@@ -58,24 +58,11 @@ class ButtonDropdown extends Widget ...@@ -58,24 +58,11 @@ class ButtonDropdown extends Widget
/** /**
* Initializes the widget.
* If you override this method, make sure you call the parent implementation first.
*/
public function init()
{
parent::init();
Html::addCssClass($this->options, 'btn-group');
}
/**
* Renders the widget. * Renders the widget.
*/ */
public function run() public function run()
{ {
echo Html::beginTag('div', $this->options) . "\n"; echo $this->renderButton() . "\n" . $this->renderDropdown();
echo $this->renderButton() . "\n";
echo $this->renderDropdown() . "\n";
echo Html::endTag('div') . "\n";
$this->registerPlugin('button'); $this->registerPlugin('button');
} }
...@@ -85,21 +72,21 @@ class ButtonDropdown extends Widget ...@@ -85,21 +72,21 @@ class ButtonDropdown extends Widget
*/ */
protected function renderButton() protected function renderButton()
{ {
Html::addCssClass($this->buttonOptions, 'btn'); Html::addCssClass($this->options, 'btn');
if ($this->split) { if ($this->split) {
$tag = 'button'; $tag = 'button';
$options = $this->buttonOptions; $options = $this->options;
$this->buttonOptions['data-toggle'] = 'dropdown'; $this->options['data-toggle'] = 'dropdown';
Html::addCssClass($this->buttonOptions, 'dropdown-toggle'); Html::addCssClass($this->options, 'dropdown-toggle');
$splitButton = Button::widget(array( $splitButton = Button::widget(array(
'label' => '<span class="caret"></span>', 'label' => '<span class="caret"></span>',
'encodeLabel' => false, 'encodeLabel' => false,
'options' => $this->buttonOptions, 'options' => $this->options,
)); ));
} else { } else {
$tag = 'a'; $tag = 'a';
$this->label .= ' <span class="caret"></span>'; $this->label .= ' <span class="caret"></span>';
$options = $this->buttonOptions; $options = $this->options;
if (!isset($options['href'])) { if (!isset($options['href'])) {
$options['href'] = '#'; $options['href'] = '#';
} }
......
...@@ -18,7 +18,7 @@ use yii\helpers\Html; ...@@ -18,7 +18,7 @@ use yii\helpers\Html;
* ```php * ```php
* // a button group with items configuration * // a button group with items configuration
* echo ButtonGroup::::widget(array( * echo ButtonGroup::::widget(array(
* 'items' => array( * 'buttons' => array(
* array('label' => 'A'), * array('label' => 'A'),
* array('label' => 'B'), * array('label' => 'B'),
* ) * )
...@@ -26,7 +26,7 @@ use yii\helpers\Html; ...@@ -26,7 +26,7 @@ use yii\helpers\Html;
* *
* // button group with an item as a string * // button group with an item as a string
* echo ButtonGroup::::widget(array( * echo ButtonGroup::::widget(array(
* 'items' => array( * 'buttons' => array(
* Button::widget(array('label' => 'A')), * Button::widget(array('label' => 'A')),
* array('label' => 'B'), * array('label' => 'B'),
* ) * )
...@@ -60,7 +60,6 @@ class ButtonGroup extends Widget ...@@ -60,7 +60,6 @@ class ButtonGroup extends Widget
public function init() public function init()
{ {
parent::init(); parent::init();
$this->clientOptions = false;
Html::addCssClass($this->options, 'btn-group'); Html::addCssClass($this->options, 'btn-group');
} }
...@@ -70,7 +69,7 @@ class ButtonGroup extends Widget ...@@ -70,7 +69,7 @@ class ButtonGroup extends Widget
public function run() public function run()
{ {
echo Html::tag('div', $this->renderButtons(), $this->options); echo Html::tag('div', $this->renderButtons(), $this->options);
$this->registerPlugin('button'); BootstrapAsset::register($this->getView());
} }
/** /**
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
font: 11px Verdana, Arial, sans-serif; font: 11px Verdana, Arial, sans-serif;
text-align: left; text-align: left;
height: 40px; height: 40px;
border-bottom: 1px solid #ccc; border-bottom: 1px solid #e4e4e4;
background: rgb(237,237,237); background: rgb(237,237,237);
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2VkZWRlZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjUzJSIgc3RvcC1jb2xvcj0iI2Y2ZjZmNiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZmZmZmYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2VkZWRlZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjUzJSIgc3RvcC1jb2xvcj0iI2Y2ZjZmNiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZmZmZmYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, rgba(237,237,237,1) 0%, rgba(246,246,246,1) 53%, rgba(255,255,255,1) 100%); background: -moz-linear-gradient(top, rgba(237,237,237,1) 0%, rgba(246,246,246,1) 53%, rgba(255,255,255,1) 100%);
...@@ -119,11 +119,22 @@ span.indent { ...@@ -119,11 +119,22 @@ span.indent {
ul.trace { ul.trace {
font-size: 12px; font-size: 12px;
color: #666; color: #999;
margin: 2px 0 0 20px; margin: 2px 0 0 0;
padding: 0;
list-style: none;
} }
.default-index .container, .default-index .container,
.default-view .container { .default-view .container {
margin-top: 10px; margin-top: 10px;
} }
.callout-danger {
background-color: #fcf2f2;
border-color: #dFb5b4;
}
.callout {
margin: 0 0 10px 0;
padding: 5px 10px;
}
...@@ -65,11 +65,11 @@ EOD; ...@@ -65,11 +65,11 @@ EOD;
)); ));
} }
if ($level == Logger::LEVEL_ERROR) { if ($level == Logger::LEVEL_ERROR) {
$class = ' class="error"'; $class = ' class="danger"';
} elseif ($level == Logger::LEVEL_WARNING) { } elseif ($level == Logger::LEVEL_WARNING) {
$class = ' class="warning"'; $class = ' class="warning"';
} elseif ($level == Logger::LEVEL_INFO) { } elseif ($level == Logger::LEVEL_INFO) {
$class = ' class="info"'; $class = ' class="success"';
} else { } else {
$class = ''; $class = '';
} }
...@@ -84,7 +84,7 @@ EOD; ...@@ -84,7 +84,7 @@ EOD;
<thead> <thead>
<tr> <tr>
<th style="width: 100px;">Time</th> <th style="width: 100px;">Time</th>
<th style="width: 100px;">Level</th> <th style="width: 65px;">Level</th>
<th style="width: 250px;">Category</th> <th style="width: 250px;">Category</th>
<th>Message</th> <th>Message</th>
</tr> </tr>
......
<?php <?php
use yii\bootstrap\ButtonDropdown;
use yii\bootstrap\ButtonGroup;
use yii\helpers\Html; use yii\helpers\Html;
/** /**
...@@ -36,35 +38,36 @@ $this->title = 'Yii Debugger'; ...@@ -36,35 +38,36 @@ $this->title = 'Yii Debugger';
</ul> </ul>
</div><!--/span--> </div><!--/span-->
<div class="col-lg-10"> <div class="col-lg-10">
<div class="meta alert alert-info"> <div class="callout callout-danger">
<div class="btn-group"> <?php
<?php echo Html::a('All', array('index'), array('class' => 'btn')); ?> $count = 0;
<button class="btn dropdown-toggle" data-toggle="dropdown"> $items = array();
Last 10 foreach ($manifest as $meta) {
<span class="caret"></span> $label = $meta['tag'] . ': ' . $meta['method'] . ' ' . $meta['url'] . ($meta['ajax'] ? ' (AJAX)' : '')
</button> . ', ' . date('Y-m-d h:i:s a', $meta['time'])
<ul class="dropdown-menu"> . ', ' . $meta['ip'];
<?php $url = array('view', 'tag' => $meta['tag'], 'panel' => $activePanel->id);
$count = 0; $items[] = array(
foreach ($manifest as $meta) { 'label' => $label,
$label = $meta['tag'] . ': ' . $meta['method'] . ' ' . $meta['url'] . ($meta['ajax'] ? ' (AJAX)' : '') 'url' => $url,
. ', ' . date('Y-m-d h:i:s a', $meta['time']) );
. ', ' . $meta['ip']; if (++$count >= 10) {
$url = array('view', 'tag' => $meta['tag'], 'panel' => $activePanel->id); break;
echo '<li>' . Html::a(Html::encode($label), $url) . '</li>';
if (++$count >= 10) {
break;
}
} }
?> }
</ul> echo ButtonGroup::widget(array(
</div> 'buttons' => array(
<?php echo $summary['tag']; ?>: Html::a('All', array('index'), array('class' => 'btn btn-default')),
<?php echo $summary['method']; ?> ButtonDropdown::widget(array(
<?php echo Html::a(Html::encode($summary['url']), $summary['url']); ?> 'label' => 'Last 10',
<?php echo $summary['ajax'] ? ' (AJAX)' : ''; ?> 'options' => array('class' => 'btn-default'),
at <?php echo date('Y-m-d h:i:s a', $summary['time']); ?> 'dropdown' => array('items' => $items),
by <?php echo $summary['ip']; ?> )),
),
));
echo "\n" . $summary['tag'] . ': ' . $summary['method'] . ' ' . Html::a(Html::encode($summary['url']), $summary['url']);
echo ' at ' . date('Y-m-d h:i:s a', $summary['time']) . ' by ' . $summary['ip'];
?>
</div> </div>
<?php echo $activePanel->getDetail(); ?> <?php echo $activePanel->getDetail(); ?>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment