Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4eee931

Browse files
committed
Restored all the code removed by mistake
1 parent b6f413f commit 4eee931

File tree

2 files changed

+45
-10
lines changed

2 files changed

+45
-10
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,31 @@
8282
</tr>
8383
</table>
8484

85-
{% if collector.logs %}
86-
<ul class="alt">
85+
{% if collector.logs %}
86+
<table>
87+
<tr>
88+
<th>#</th>
89+
<th>Priority</th>
90+
<th>Channel</th>
91+
<th>Message and context</th>
92+
</tr>
93+
8794
{% set log_loop_index = 0 %}
8895
{% for log in collector.logs %}
8996
{% set is_deprecation = log.context.level is defined and log.context.type is defined and (constant('E_DEPRECATED') == log.context.type or constant('E_USER_DEPRECATED') == log.context.type) %}
9097
{% if priority == '-100' ? is_deprecation : log.priority >= priority %}
9198
{% set log_loop_index = log_loop_index + 1 %}
92-
<li class="{{ cycle(['odd', 'even'], log_loop_index) }}{% if log.context.scream is defined %} scream{% elseif log.priority >= 400 %} error{% elseif log.priority >= 300 or is_deprecation %} warning{% endif %}">
93-
{{ logger.display_message(loop.index, log, is_deprecation) }}
94-
</li>
99+
<tr class="{{ cycle(['odd', 'even'], log_loop_index) }}{% if log.context.scream is defined %} scream{% elseif log.priority >= 400 %} error{% elseif log.priority >= 300 or is_deprecation %} warning{% endif %}">
100+
<td>{{ log_loop_index }}</td>
101+
<td>{{ is_deprecation ? 'DEPRECATION' : log.priorityName }}</td>
102+
<td>{{ log.channel is defined ? log.channel }}</td>
103+
<td>{{ logger.display_message(loop.index, log, is_deprecation) }}</td>
104+
</tr>
95105
{% endif %}
96106
{% else %}
97-
<li><em>No logs available for this priority.</em></li>
107+
<tr><td colspan="4"><em>No logs available for {{ priority }} priority.</em></td></tr>
98108
{% endfor %}
99-
</ul>
109+
</table>
100110
{% else %}
101111
<p>
102112
<em>No logs available.</em>
@@ -106,11 +116,13 @@
106116

107117

108118
{% macro display_message(log_index, log, is_deprecation) %}
119+
{{ is_deprecation ? 'DEPRECATED' : log.priorityName }} - {{ log.message }}
120+
109121
{% if is_deprecation %}
110122
{% set stack = log.context.stack|default([]) %}
111123
{% set id = 'sf-call-stack-' ~ log_index %}
112124

113-
DEPRECATED - {{ log.message }}
125+
{{ log.message }}
114126

115127
{% if stack %}
116128
<a href="#" onclick="Sfjs.toggle('{{ id }}', document.getElementById('{{ id }}-on'), document.getElementById('{{ id }}-off')); return false;">
@@ -140,7 +152,6 @@
140152
{% endif %}
141153
{% endfor %}
142154
{% else %}
143-
{{ log.priorityName }} - {{ log.message }}
144155
{% if log.context is defined and log.context is not empty %}
145156
<br />
146157
<small>

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@
5454
{% endblock %}
5555

5656
{% block panelContent %}
57+
{% set filter = request.query.get('state', '-1') %}
58+
{% set filterOptions = {
59+
'-1': '',
60+
(constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_DEFINED')): 'Defined messages',
61+
(constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_MISSING')): 'Missing messages',
62+
(constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK')): 'Fallback messages',
63+
} %}
64+
5765
<h2>Translation Stats</h2>
5866
<table>
5967
<tbody>
@@ -69,6 +77,22 @@
6977
<th>Missing messages</th>
7078
<td><pre>{{ collector.countMissings }}</pre></td>
7179
</tr>
80+
<tr>
81+
<th>Filter</th>
82+
<td>
83+
<form id="filter-form" action="" method="get" style="display: inline">
84+
<input type="hidden" name="panel" value="translation">
85+
<select id="filter" name="state" onchange="document.getElementById('filter-form').submit(); ">
86+
{% for key,option in filterOptions %}
87+
<option value="{{ key }}"{{ filter == key ? ' selected' : '' }}>{{ option }}</option>
88+
{% endfor %}
89+
</select>
90+
<noscript>
91+
<input type="submit" value="refresh">
92+
</noscript>
93+
</form>
94+
</td>
95+
</tr>
7296
</tbody>
7397
</table>
7498

@@ -80,7 +104,7 @@
80104
<th>Id</th>
81105
<th>Message Preview</th>
82106
</tr>
83-
{% for message in collector.messages %}
107+
{% for message in collector.messages if message.state == filter or filter == '-1' %}
84108
<tr>
85109
<td><code>{{ translator.state(message) }}</code></td>
86110
<td><code>{{ message.locale }}</code></td>

0 commit comments

Comments
 (0)