diff --git a/src/Bridges/ApplicationTracy/RoutingPanel.php b/src/Bridges/ApplicationTracy/RoutingPanel.php index a69c429dc..bbfd16777 100644 --- a/src/Bridges/ApplicationTracy/RoutingPanel.php +++ b/src/Bridges/ApplicationTracy/RoutingPanel.php @@ -45,7 +45,7 @@ public function getTab(): string ); return Nette\Utils\Helpers::capture(function () { $matched = $this->matched; - require __DIR__ . '/templates/RoutingPanel.tab.phtml'; + require __DIR__ . '/dist/tab.phtml'; }); } @@ -61,7 +61,7 @@ public function getPanel(): string $source = $this->matched ? $this->findSource() : null; $url = $this->httpRequest->getUrl(); $method = $this->httpRequest->getMethod(); - require __DIR__ . '/templates/RoutingPanel.panel.phtml'; + require __DIR__ . '/dist/panel.phtml'; }); } diff --git a/src/Bridges/ApplicationTracy/dist/panel.phtml b/src/Bridges/ApplicationTracy/dist/panel.phtml new file mode 100644 index 000000000..add492e07 --- /dev/null +++ b/src/Bridges/ApplicationTracy/dist/panel.phtml @@ -0,0 +1,193 @@ + + + + + + +

+ + no route + + : + + ! + + +

+ +
+
+

+ + getBaseUrl()) ?>&', '?'], htmlspecialchars($url->getRelativeUrl())) ?> +

+ + +

(class not found)

+ +

getName() : $source->getDeclaringClass()->getName() . '::' . $source->getName() . '()') ?>

+ +
+ +
+ +

No routes defined.

+ +
+
+
+
Mask / Class
+
Defaults
+
Matched as
+
+ + +
+ +
+ domain = + + module = + +
+ + + + + + + + + +
+ + + +
+
+ '✓', 'may' => '≈', 'no' => '', 'oneway' => '⛔', 'error' => '❌'][$route->matched]) ?> + +
+ +
+ + + + mask) ? str_replace(['/', '-'], ['/', '-'], htmlspecialchars($route->mask)) : str_replace('\\', '\\', htmlspecialchars($route->class)) ?> + + +
+ +
+ +defaults as $key => $value): ?> +  = 
true, Dumper::LIVE => true]) ?> + + +
+
+ +
+params): ?> + +params ?> + + : +
+ + + $value): ?> +  = 
true, Dumper::LIVE => true]) ?> + + +
+error): ?> + error->getMessage()) ?> + +
+
+ + + +
+ +
+
diff --git a/src/Bridges/ApplicationTracy/dist/tab.phtml b/src/Bridges/ApplicationTracy/dist/tab.phtml new file mode 100644 index 000000000..f163f31cf --- /dev/null +++ b/src/Bridges/ApplicationTracy/dist/tab.phtml @@ -0,0 +1,21 @@ + + + + + + + + + + no route + + : + + ! + + + + diff --git a/src/Bridges/ApplicationTracy/panel.latte b/src/Bridges/ApplicationTracy/panel.latte new file mode 100644 index 000000000..580cbb229 --- /dev/null +++ b/src/Bridges/ApplicationTracy/panel.latte @@ -0,0 +1,181 @@ +{use Nette\Application\UI\Presenter} +{use Tracy\Dumper} + + + +

+ {if $matched === null} + no route + {elseif isset($matched[Presenter::PresenterKey])} + {$matched[Presenter::PresenterKey]}:{$matched[Presenter::ActionKey] ?? Presenter::DefaultAction} + {if isset($matched[Presenter::SignalKey])}{$matched[Presenter::SignalKey]}!{/if} + {/if} +

+ +
+
+

+ {$method} + {$url->getBaseUrl()}{str_replace(['&', '?'], ['&', '?'], htmlspecialchars($url->getRelativeUrl()))|noescape} +

+ + {if is_string($source)} +

{$source} (class not found)

+ {elseif $source} +

{$source instanceof ReflectionClass ? $source->getName() : $source->getDeclaringClass()->getName() . '::' . $source->getName() . '()'}

+ {/if} +
+ +
+ {if empty($routes)} +

No routes defined.

+ {else} +
+
+
+
Mask / Class
+
Defaults
+
Matched as
+
+ + {define routeList $list, $path = ''} +
+ {if $list[domain] || $list[module]} +
+ {if $list[domain]}domain = {$list[domain]}{/if} + {if $list[module]}module = {$list[module]}{/if} +
+ {/if} + {do $path .= $list[path]} + {foreach $list[routes] as $router} + {if is_array($router)} + {include routeList $router, $path} + {else} + {include route $router, $path} + {/if} + {/foreach} +
+ {/define} + + {define route $route, $path} +
+
+ {=[yes => '✓', may => '≈', no => '', oneway => '⛔', error => '❌'][$route->matched]} +
+ +
+ + {if $path !== ''}{$path}{/if} + {isset($route->mask) ? str_replace(['/', '-'], ['/', '-'], htmlspecialchars($route->mask)) : str_replace('\\', '\\', htmlspecialchars($route->class))|noescape} + +
+ +
+ + {foreach $route->defaults as $key => $value} + {$key} = {if is_string($value)}{$value}
{Dumper::toHtml($value, [Dumper::COLLAPSE => true, Dumper::LIVE => true])}{/if} + {/foreach} +
+
+ +
+ {if $route->params} + + {do $params = $route->params} + {if isset($params[Presenter::PresenterKey])} + {$params[presenter]}:{$params[Presenter::ActionKey] ?? Presenter::DefaultAction} +
+ {do unset($params[Presenter::PresenterKey], $params[Presenter::ActionKey])} + {/if} + {foreach $params as $key => $value} + {$key} = {if is_string($value)}{$value}
{Dumper::toHtml($value, [Dumper::COLLAPSE => true, Dumper::LIVE => true])}{/if} + {/foreach} +
+ {elseif $route->error} + {$route->error->getMessage()} + {/if} +
+
+ {/define} + + {include routeList $routes} +
+ {/if} +
+
diff --git a/src/Bridges/ApplicationTracy/tab.latte b/src/Bridges/ApplicationTracy/tab.latte new file mode 100644 index 000000000..00234c51b --- /dev/null +++ b/src/Bridges/ApplicationTracy/tab.latte @@ -0,0 +1,16 @@ +{use Nette\Application\UI\Presenter} + + + + + + + {if $matched === null} + no route + {elseif isset($matched[Presenter::PresenterKey])} + {$matched[Presenter::PresenterKey]}:{$matched[Presenter::ActionKey] ?? Presenter::DefaultAction}{if isset($matched[Presenter::SignalKey])} + {$matched[Presenter::SignalKey]}!{/if} + {/if} + + diff --git a/src/Bridges/ApplicationTracy/templates/RoutingPanel.panel.phtml b/src/Bridges/ApplicationTracy/templates/RoutingPanel.panel.phtml deleted file mode 100644 index 6d499b185..000000000 --- a/src/Bridges/ApplicationTracy/templates/RoutingPanel.panel.phtml +++ /dev/null @@ -1,182 +0,0 @@ - - - -

- - no route - - - -

- -
-
-

- getBaseUrl()) ?>&', '?'], Helpers::escapeHtml($url->getRelativeUrl())) ?>

- - -

(class not found)

- -

getName() : $source->getDeclaringClass()->getName() . '::' . $source->getName() . '()' ?>

- -
- -
- -

No routes defined.

- - -
-
-
-
Mask / Class
-
Defaults
-
Matched as
-
- -
- -
- - -
- - -
- -
-
'✓', 'may' => '≈', 'no' => '', 'oneway' => '⛔', 'error' => '❌'][$route->matched] ?>
- -
' . Helpers::escapeHtml($path) . '', - isset($route->mask) ? str_replace(['/', '-'], ['/', '-'], Helpers::escapeHtml($route->mask)) : str_replace('\\', '\\', Helpers::escapeHtml($route->class)) - ?>
- -
- defaults as $key => $value): ?> - ' : Dumper::toHtml($value, [Dumper::COLLAPSE => true, Dumper::LIVE => true]) ?> - -
- -
params): ?> - params; ?> - -
- - - $value): ?> - ' : Dumper::toHtml($value, [Dumper::COLLAPSE => true, Dumper::LIVE => true]) ?> - -
error): ?>error->getMessage()) ?>
-
- -
- -
-
diff --git a/src/Bridges/ApplicationTracy/templates/RoutingPanel.tab.phtml b/src/Bridges/ApplicationTracy/templates/RoutingPanel.tab.phtml deleted file mode 100644 index b61c174fb..000000000 --- a/src/Bridges/ApplicationTracy/templates/RoutingPanel.tab.phtml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - -no route -