8000 Made sections collapsable · symfony/symfony@b02c227 · GitHub
[go: up one dir, main page]

Skip to content

Commit b02c227

Browse files
wouterjfabpot
authored andcommitted
Made sections collapsable
1 parent b223527 commit b02c227

File tree

1 file changed

+141
-84
lines changed
  • src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector

1 file changed

+141
-84
lines changed

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

Lines changed: 141 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,23 @@
236236
var tabView = new TabView();
237237
238238
tabView.init();
239+
240+
var elements = {};
241+
function toggle(data_id, section) {
242+
if (!elements[data_id]) {
243+
elements[data_id] = {};
244+
}
245+
if (!elements[data_id][section]) {
246+
elements[data_id][section] = {
247+
on: document.getElementById(data_id + '-' + section + '-open'),
248+
off: document.getElementById(data_id + '-' + section + '-close'),
249+
section_id: data_id + '-' + section
250+
};
251+
}
252+
253+
var data = elements[data_id][section];
254+
Sfjs.toggle(data.section_id, data.on, data.off);
255+
}
239256
</script>
240257
{% endblock %}
241258

@@ -288,39 +305,54 @@
288305
{% endif %}
289306

290307
{% if data.default_data is defined %}
291-
<h3>Default Data</h3>
292-
293-
<table>
294-
<tr>
295-
<th width="180">Model Format</th>
296-
<td>
297-
{% if data.default_data.model is defined %}
298-
<pre>{{ data.default_data.model }}</pre>
299-
{% else %}
300-
<em>same as normalized format</em>
301-
{% endif %}
302-
</td>
303-
</tr>
304-
<tr>
305-
<th>Normalized Format</th>
306-
<td><pre>{{ data.default_data.norm }}</pre></td>
307-
</tr>
308-
<tr>
309-
<th>View Format</th>
310-
<td>
311-
{% if data.default_data.view is defined %}
312-
<pre>{{ data.default_data.view }}</pre>
313-
{% else %}
314-
<em>same as normalized format</em>
315-
{% endif %}
316-
</td>
317-
</tr>
318-
</table>
308+
<h3>
309+
<a onclick="toggle('{{ data.id }}', 'default_data')">
310+
<img style="display:none" id="{{ data.id }}-default_data-open" src="{{ asset('bundles/framework/images/blue_picto_more.gif') }}">
311+
<img style="display:inline" id="{{ data.id }}-default_data-close" src="{{ asset('bundles/framework/images/blue_picto_less.gif') }}">
312+
</a>
313+
Default Data
314+
</h3>
315+
316+
<div id="{{ data.id }}-default_data">
317+
<table>
318+
<tr>
319+
<th width="180">Model Format</th>
320+
<td>
321+
{% if data.default_data.model is defined %}
322+
<pre>{{ data.default_data.model }}</pre>
323+
{% else %}
324+
<em>same as normalized format</em>
325+
{% endif %}
326+
</td>
327+
</tr>
328+
<tr>
329+
<th>Normalized Format</th>
330+
<td><pre>{{ data.default_data.norm }}</pre></td>
331+
</tr>
332+
<tr>
333+
<th>View Format</th>
334+
<td>
335+
{% if data.default_data.view is defined %}
336+
<pre>{{ data.default_data.view }}</pre>
337+
{% else %}
338+
<em>same as normalized format</em>
339+
{% endif %}
340+
</td>
341+
</tr>
342+
</table>
343+
</div>
319344
{% endif %}
320345

321346
{% if data.submitted_data is defined %}
322-
<h3>Submitted Data</h3>
323-
347+
<h3>
348+
<a onclick="toggle('{{ data.id }}', 'submitted_data')">
349+
<img style="display:none" id="{{ data.id }}-submitted_data-open" src="{{ asset('bundles/framework/images/blue_picto_more.gif') }}">
350+
<img style="display:inline" id="{{ data.id }}-submitted_data-close" src="{{ asset('bundles/framework/images/blue_picto_less.gif') }}">
351+
</a>
352+
Submitted Data
353+
</h3>
354+
355+
<div id="{{ data.id }}-submitted_data">
324356
{% if data.submitted_data.norm is defined %}
325357
<table>
326358
<tr>
@@ -351,69 +383,94 @@
351383
{% else %}
352384
<p><em>This form was not submitted.</em></p>
353385
{% endif %}
386+
</div>
354387
{% endif %}
355388

356389
{% if data.passed_options is defined %}
357-
<h3>Passed Options</h3>
358-
359-
{% if data.passed_options|length %}
360-
<table>
361-
<tr>
362-
<th width="180">Option</th>
363-
<th>Passed Value</th>
364-
<th>Resolved Value</th>
365-
</tr>
366-
{% for option, value in data.passed_options %}
367-
<tr>
368-
<th>{{ option }}</th>
369-
<td><pre>{{ value }}</pre></td>
370-
<td>
371-
{% if data.resolved_options[option] is sameas(value) %}
372-
<em>same as passed value</em>
373-
{% else %}
374-
<pre>{{ data.resolved_options[option] }}</pre>
375-
{% endif %}
376-
</td>
377-
</tr>
378-
{% endfor %}
379-
</table>
380-
{% else %}
381-
<p><em>No options where passed when constructing this form.</em></p>
382-
{% endif %}
390+
<h3>
391+
<a onclick="toggle('{{ data.id }}', 'passed_options')">
392+
<img style="display:none" id="{{ data.id }}-passed_options-open" src="{{ asset('bundles/framework/images/blue_picto_more.gif') }}">
393+
<img style="display:inline" id="{{ data.id }}-passed_options-close" src="{{ asset('bundles/framework/images/blue_picto_less.gif') }}">
394+
</a>
395+
Passed Options
396+
</h3>
397+
398+
<div id="{{ data.id }}-passed_options">
399+
{% if data.passed_options|length %}
400+
<table>
401+
<tr>
402+
<th width="180">Option</th>
403+
<th>Passed Value</th>
404+
<th>Resolved Value</th>
405+
</tr>
406+
{% for option, value in data.passed_options %}
407+
<tr>
408+
<th>{{ option }}</th>
409+
<td><pre>{{ value }}</pre></td>
410+
<td>
411+
{% if data.resolved_options[option] is sameas(value) %}
412+
<em>same as passed value</em>
413+
{% else %}
414+
<pre>{{ data.resolved_options[option] }}</pre>
415+
{% endif %}
416+
</td>
417+
</tr>
418+
{% endfor %}
419+
</table>
420+
{% else %}
421+
<p><em>No options where passed when constructing this form.</em></p>
422+
{% endif %}
423+
</div>
383424
{% endif %}
384425

385426
{% if data.resolved_options is defined %}
386-
<h3>Resolved Options</h3>
387-
388-
<table>
389-
<tr>
390-
<th width="180">Option</th>
391-
<th>Value</th>
392-
</tr>
393-
{% for option, value in data.resolved_options %}
394-
<tr>
395-
<th>{{ option }}</th>
396-
<td><pre>{{ value }}</pre></td>
397-
</tr>
398-
{% endfor %}
399-
</table>
427+
<h3>
428+
<a onclick="toggle('{{ data.id }}', 'resolved_options')">
429+
<img style="display:inline" id="{{ data.id }}-resolved_options-open" src="{{ asset('bundles/framework/images/blue_picto_more.gif') }}">
430+
<img style="display:none" id="{{ data.id }}-resolved_options-close" src="{{ asset('bundles/framework/images/blue_picto_less.gif') }}&quo F987 t;>
431+
</a>
432+
Resolved Options
433+
</h3>
434+
435+
<div id="{{ data.id }}-resolved_options" style="display:none">
436+
<table>
437+
<tr>
438+
<th width="180">Option</th>
439+
<th>Value</th>
440+
</tr>
441+
{% for option, value in data.resolved_options %}
442+
<tr>
443+
<th>{{ option }}</th>
444+
<td><pre>{{ value }}</pre></td>
445+
</tr>
446+
{% endfor %}
447+
</table>
448+
</div>
400449
{% endif %}
401450

402451
{% if data.view_vars is defined %}
403-
<h3>View Variables</h3>
404-
405-
<table>
406-
<tr>
407-
<th width="180">Variable</th>
408-
<th>Value</th>
409-
</tr>
410-
{% for variable, value in data.view_vars %}
411-
<tr>
412-
<th>{{ variable }}</th>
413-
<td><pre>{{ value }}</pre></td>
414-
</tr>
415-
{% endfor %}
416-
</table>
452+
<h3>
453+
<a onclick="toggle('{{ data.id }}', 'view_vars')">
454+
<img style="display:inline" id="{{ data.id }}-view_vars-open" src="{{ asset('bundles/framework/images/blue_picto_more.gif') }}">
455+
<img style="display:none" id="{{ data.id }}-view_vars-close" src="{{ asset('bundles/framework/images/blue_picto_less.gif') }}">
456+
</a>
457+
View Variables
458+
</h3>
459+
460+
<div id="{{ data.id }}-view_vars" style="display:none">
461+
<table>
462+
<tr>
463+
<th width="180">Variable</th>
464+
<th>Value</th>
465+
</tr>
466+
{% for variable, value in data.view_vars %}
467+
<tr>
468+
<th>{{ variable }}</th>
469+
<td><pre>{{ value }}</pre></td>
470+
</tr>
471+
{% endfor %}
472+
</table>
473+
</div>
417474
{% endif %}
418475
</div>
419476

0 commit comments

Comments
 (0)
0