Skip to content

Commit c9af8aa

Browse files
committed
[WebProfilerBundle] Added collapsed sidebar
1 parent f3b6ffc commit c9af8aa

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed
Lines changed: 3 additions & 0 deletions
Loading

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,22 @@
6262
</div>
6363

6464
{% if templates is defined %}
65+
<script type="text/javascript">
66+
(function(Sfjs) {
67+
if ('true' == Sfjs.getPreference('sidebar/collapse')) {
68+
Sfjs.addClass(document.body, 'sidebar-collapse');
69+
}
70+
})(Sfjs);
71+
</script>
6572
<ul id="menu-profiler">
73+
<li>
74+
<a href="#" onclick="javascript: Sfjs.toggleClass(document.body, 'sidebar-collapse'); Sfjs.setPreference('sidebar/collapse', Sfjs.hasClass(document.body, 'sidebar-collapse')); return false;">
75+
<span class="label">
76+
<span class="icon">{{ include('@WebProfiler/Icon/menu.svg') }}</span>
77+
<strong>Minimize</strong>
78+
</span>
79+
</a>
80+
</li>
6681
{% for name, template in templates %}
6782
{% set menu %}{{ template.renderBlock('menu', { collector: profile.getcollector(name), profiler_markup_version: profiler_markup_version }) }}{% endset %}
6883
{% if menu is not empty %}

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,9 @@ tr.status-warning td {
372372
margin: 0 0 30px 220px;
373373
padding: 14px 0 14px 20px;
374374
}
375+
.sidebar-collapse #collector-content {
376+
margin-left: 50px;
377+
}
375378

376379
#main h2:first-of-type {
377380
margin-top: 0;
@@ -475,12 +478,18 @@ tr.status-warning td {
475478
padding-bottom: 99999px; {# needed for 'same-height columns' trick #}
476479
width: 220px;
477480
}
481+
.sidebar-collapse #sidebar {
482+
width: 50px;
483+
}
478484
#sidebar a {
479485
color: #ADD8E6;
480486
}
481487
#sidebar .module {
482488
padding: 10px;
483489
}
490+
.sidebar-collapse #sidebar .module {
491+
display: none;
492+
}
484493
#sidebar .module h3 {
485494
color: #999;
486495
font-size: 12px;
@@ -502,6 +511,9 @@ tr.status-warning td {
502511
-ms-user-select: none;
503512
user-select: none;
504513
}
514+
.sidebar-collapse #sidebar #sidebar-shortcuts {
515+
display: none;
516+
}
505517
#sidebar #sidebar-shortcuts .btn {
506518
color: #F5F5F5;
507519
}
@@ -558,6 +570,13 @@ tr.status-warning td {
558570
#menu-profiler li {
559571
position: relative;
560572
margin-bottom: 0;
573+
width: 220px;
574+
}
575+
.sidebar-collapse #menu-profiler li {
576+
visibility: hidden;
577+
}
578+
.sidebar-collapse #menu-profiler li:hover {
579+
visibility: visible;
561580
}
562581
#menu-profiler li a {
563582
border: solid transparent;
@@ -583,6 +602,7 @@ tr.status-warning td {
583602
top: 8px;
584603
width: 50px;
585604
text-align: center;
605+
visibility: visible;
586606
}
587607
#menu-profiler li a .label .icon svg path {
588608
fill: #DDD;
@@ -606,6 +626,10 @@ tr.status-warning td {
606626
border: solid #555;
607627
border-width: 2px 0;
608628
}
629+
.sidebar-collapse #menu-profiler li a:hover {
630+
border-right-width: 2px;
631+
border-radius: 0 5px 5px 0;
632+
}
609633
#menu-profiler li.selected a .label,
610634
#menu-profiler li a:hover .label {
611635
color: #FFF;

0 commit comments

Comments
 (0)