Skip to content

Commit 170b978

Browse files
committed
RoutingPanel: redesign
1 parent 7bcb19b commit 170b978

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

src/Bridges/ApplicationTracy/RoutingPanel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public function getPanel()
8282
$request = $this->request;
8383
$routers = $this->routers;
8484
$source = $this->source;
85+
$hasModule = (bool) array_filter($routers, function($rq) { return $rq['module']; });
8586
$url = $this->httpRequest->getUrl();
8687
require __DIR__ . '/templates/RoutingPanel.panel.phtml';
8788
return ob_get_clean();

src/Bridges/ApplicationTracy/templates/RoutingPanel.panel.phtml

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@ use Nette,
1515
}
1616

1717
#tracy-debug .nette-RoutingPanel .yes td {
18-
color: green;
18+
background: #BDE678 !important;
1919
}
2020

2121
#tracy-debug .nette-RoutingPanel .may td {
22-
color: #67F;
22+
background: #C1D3FF !important;
2323
}
2424

2525
#tracy-debug .nette-RoutingPanel pre, #tracy-debug .nette-RoutingPanel code {
2626
display: inline;
27+
background: transparent;
2728
}
2829

2930
</style>
@@ -38,40 +39,35 @@ use Nette,
3839
</h1>
3940

4041
<div class="tracy-inner">
41-
<p><code><?= htmlSpecialChars($url, ENT_IGNORE, 'UTF-8') ?></code></p>
42-
4342
<?php if (empty($routers)): ?>
4443
<p>No routers defined.</p>
4544

4645
<?php else: ?>
4746
<table>
4847
<thead>
4948
<tr>
50-
<th>Matched?</th>
51-
<th>Class</th>
52-
<th>Mask</th>
49+
<th></th>
50+
<th>Mask / Class</th>
5351
<th>Defaults</th>
54-
<th>Module</th>
55-
<th>Request</th>
52+
<?php if ($hasModule): ?><th>Module</th><?php endif ?>
53+
<th>Matched as</th>
5654
</tr>
5755
</thead>
5856

5957
<tbody>
6058
<?php foreach ($routers as $router): ?>
6159
<tr class="<?= $router['matched'] ?>">
62-
<td><?= $router['matched'] ?></td>
63-
64-
<td><code title="<?= htmlSpecialChars($router['class'], ENT_QUOTES, 'UTF-8') ?>"><?= preg_replace('#.+\\\\#', '', htmlSpecialChars($router['class'], ENT_NOQUOTES, 'UTF-8')) ?></code></td>
60+
<td><?= $router['matched'] === 'yes' ? '' : ($router['matched'] === 'may' ? '' : '') ?></td>
6561

66-
<td><code><strong><?= htmlSpecialChars($router['mask'], ENT_NOQUOTES, 'UTF-8') ?></strong></code></td>
62+
<td><code title="<?= htmlSpecialChars($router['class'], ENT_QUOTES, 'UTF-8') ?>"><?= htmlSpecialChars($router['mask'] ?: $router['class'], ENT_NOQUOTES, 'UTF-8') ?></code></td>
6763

6864
<td><code>
6965
<?php foreach ($router['defaults'] as $key => $value): ?>
7066
<?= htmlSpecialChars($key, ENT_IGNORE, 'UTF-8'), "&nbsp;=&nbsp;", is_string($value) ? htmlSpecialChars($value, ENT_IGNORE, 'UTF-8') . '<br />' : Dumper::toHtml($value, [Dumper::COLLAPSE => TRUE, Dumper::LIVE => TRUE]) ?>
7167
<?php endforeach ?>
7268
</code></td>
7369

74-
<td><code><?= htmlSpecialChars($router['module'], ENT_NOQUOTES, 'UTF-8') ?></code></td>
70+
<?php if ($hasModule): ?><td><code><?= htmlSpecialChars($router['module'], ENT_NOQUOTES, 'UTF-8') ?></code></td><?php endif ?>
7571

7672
<td><?php if ($router['request']): ?><code>
7773
<?php $params = $router['request']->getParameters(); ?>
@@ -87,10 +83,10 @@ use Nette,
8783
</table>
8884
<?php endif ?>
8985

86+
<p><code><?= htmlSpecialChars($url->getBaseUrl(), ENT_IGNORE, 'UTF-8') ?><span style="background:#eee; white-space:nowrap"><?= htmlSpecialChars($url->getRelativeUrl(), ENT_IGNORE, 'UTF-8') ?></span></code></p>
87+
9088
<?php if ($source): ?>
91-
<p><?= $source instanceof \ReflectionClass ? $source->getName() : $source->getDeclaringClass()->getName() . '::' . $source->getName() . '()' ?> in
92-
<?= Tracy\Helpers::editorLink($source->getFileName(), $source->getStartLine()) ?>
93-
</p>
89+
<p><a href="<?= htmlSpecialChars(Tracy\Helpers::editorUri($source->getFileName(), $source->getStartLine()), ENT_QUOTES, 'UTF-8') ?>"><?= $source instanceof \ReflectionClass ? $source->getName() : $source->getDeclaringClass()->getName() . '::' . $source->getName() . '()' ?></a></p>
9490
<?php endif ?>
9591
</div>
9692
</div>

0 commit comments

Comments
 (0)