Skip to content

Commit b0bb382

Browse files
committed
[WebProfilerBundle] Added collapsed sidebar on small screens
1 parent 7b358a1 commit b0bb382

File tree

4 files changed

+75
-6
lines changed

4 files changed

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

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<head>
44
<meta charset="{{ _charset }}" />
55
<meta name="robots" content="noindex,nofollow" />
6+
<meta name="viewport" content="width=device-width,initial-scale=1" />
67
<title>Symfony Profiler</title>
78
<link rel="icon" type="image/x-icon" sizes="16x16" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAFEUlEQVR4AZVXA4wm2RMf27bXDM/+3/+sYBGfrbVtezc6BWtzfPbYXtvDL9906t6v0vWl05me7q1JzXuvvu4yXnvZgJ9hH6bwZYXLFR739vauUGuDwhq1L1N4Uv/tRYUhFjwcg49hn6aYr1V4TiGp86CoP9Oh1tV414KnM6t9fHymKUZ3DAI0hW4b1AyK3lE8phh5OxWeoJgUGhi5mLm95YzBwcHuhIQEV1JSEoWGhoKWHxYWFmenhJ/B5W0GwZpDt5Ovry9lZWWRyWOu5ORk7JsUpogsq5gnmISTU+HKQoLFQv/qq6/os88+I+EVFRUlSsRZ5oRiVmwlXMWShQkahUdERJCfnx/vd+3aRTU1NXTixAmqrq6mK1eu0PTp05mnrmD+QK6XhLO0XP2O2FJAQICRjjMU4P1PP/1EfX19NGfOHM8Z0N7ezueQkBBXYGAgSWIaQ5Em2T5QzFNSUig9PV3OHOe4uDjZ87p//34C7Nm7x/NcRUUFAX799Vec8Y7m7+8Pz92SfBDXr7VwPYRbxn/MmDG8Tps2jQBd3V30/PPPe35/6qmnaPXq1TR69Gg+h4eHiwwosdLT4dBkQDSXWmJiIq/vv/8+/fvvv3ThwgWqr6+n/Px8oyCmAerq6jy03Nxc2Yv7ySSjQ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

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,19 @@
5252

5353
<div id="sidebar">
5454
<div id="sidebar-shortcuts">
55-
<a class="btn btn-sm" href="{{ path('_profiler_search', { limit: 10 }) }}">Latest profiles</a>
55+
<div class="shortcuts">
56+
<a href="#" class="visible-small" onclick="Sfjs.toggleClass(document.getElementById('sidebar'), 'expanded'); return false;">
57+
<span class="icon">{{ include('@WebProfiler/Icon/menu.svg') }}</span>
58+
</a>
5659

57-
<a class="sf-toggle btn btn-sm" data-toggle-selector="#sidebar-search" {% if tokens is defined or about is defined %}data-toggle-initial="display"{% endif %}>
58-
{{ include('@WebProfiler/Icon/search.svg') }} Search
59-
</a>
60+
<a class="btn btn-sm" href="{{ path('_profiler_search', { limit: 10 }) }}">Latest profiles</a>
6061

61-
{{ render(path('_profiler_search_bar')) }}
62+
<a class="sf-toggle btn btn-sm" data-toggle-selector="#sidebar-search" {% if tokens is defined or about is defined %}data-toggle-initial="display"{% endif %}>
63+
{{ include('@WebProfiler/Icon/search.svg') }} <span class="hidden-small">Search</span>
64+
</a>
65+
66+
{{ render(path('_profiler_search_bar')) }}
67+
</div>
6268
</div>
6369

6470
{% if templates is defined %}

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

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ tr.status-warning td {
480480
}
481481
#sidebar .module {
482482
padding: 10px;
483+
width: 220px;
483484
}
484485
#sidebar .module h3 {
485486
color: #999;
@@ -493,14 +494,25 @@ tr.status-warning td {
493494
------------------------------------------------------------------------- #}
494495
#sidebar #sidebar-shortcuts {
495496
background: #333;
496-
padding: 16px 10px;
497497
/* needed to prevent visual issues due to the pure CSS slideToggle() */
498498
-webkit-touch-callout: none;
499499
-webkit-user-select: none;
500500
-khtml-user-select: none;
501501
-moz-user-select: none;
502502
-ms-user-select: none;
503503
user-select: none;
504+
width: 220px;
505+
}
506+
#sidebar #sidebar-shortcuts .shortcuts {
507+
position: relative;
508+
padding: 16px 10px;
509+
}
510+
#sidebar-shortcuts .icon {
511+
display: block;
512+
float: left;
513+
width: 36px;
514+
text-align: left;
515+
padding: 2px;
504516
}
505517
#sidebar #sidebar-shortcuts .btn {
506518
color: #F5F5F5;
@@ -558,6 +570,7 @@ tr.status-warning td {
558570
#menu-profiler li {
559571
position: relative;
560572
margin-bottom: 0;
573+
width: 220px;
561574
}
562575
#menu-profiler li a {
563576
border: solid transparent;
@@ -842,3 +855,49 @@ table.logs .metadata strong {
842855
{{ mixins.sans_serif_font|raw }}
843856
vertical-align: middle;
844857
}
858+
859+
{# Small screens
860+
========================================================================= #}
861+
862+
.visible-small {
863+
display: none;
864+
}
865+
.hidden-small {
866+
display: inherit;
867+
}
868+
869+
@media (max-width: 768px) {
870+
#collector-content {
871+
margin-left: 50px;
872+
}
873+
874+
#sidebar {
875+
width: 50px;
876+
overflow-y: hidden;
877+
transition: width 200ms ease-out;
878+
}
879+
#sidebar:hover, #sidebar.expanded {
880+
width: 220px;
881+
}
882+
883+
#sidebar-search {
884+
display: none;
885+
}
886+
#sidebar:hover #sidebar-search.sf-toggle-visible, #sidebar.expanded #sidebar-search.sf-toggle-visible {
887+
display: block;
888+
}
889+
890+
#sidebar .module {
891+
display: none;
892+
}
893+
#sidebar:hover .module, #sidebar.expanded .module {
894+
display: block;
895+
}
896+
897+
.visible-small {
898+
display: inherit;
899+
}
900+
.hidden-small {
901+
display: none;
902+
}
903+
}

0 commit comments

Comments
 (0)