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

Skip to content

Commit 44091f5

Browse files
committed
feature #15818 [WebProfilerBundle] Add collapsed sidebar on small screens (hason)
This PR was merged into the 2.8 branch. Discussion ---------- [WebProfilerBundle] Add collapsed sidebar on small screens | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Desktop ![Desktop](https://cloud.githubusercontent.com/assets/288535/9927840/1e4eb7fc-5d22-11e5-9833-f1431ed2855d.png) Mobile ![Mobile](https://cloud.githubusercontent.com/assets/288535/9927847/23a5c5c4-5d22-11e5-928a-87b167a079b5.png) ![Mobile touch](https://cloud.githubusercontent.com/assets/288535/9927851/2bb800e2-5d22-11e5-9566-c74a23eb9cb5.png) Commits ------- 184d4f2 [WebProfilerBundle] Added collapsed sidebar on small screens
2 parents 59ee12c + 184d4f2 commit 44091f5

File tree

4 files changed

+79
-6
lines changed

4 files changed

+79
-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/tRYUhFjwcg49hn6aYr1V4TiGp86CoP9Oh1tV414KnM6t9fHymKUZ3DAI0hW4b1AyK3lE8phh5OxWeoJgUGhi5mLm95YzBwcHuhIQEV1JSEoWGh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XmOyeUtGSskmDjx4/nRgPAfBDmMpZtUIbRcsi2GsfSD2QYyd2OcdmyZSSwdu1apuXk5GB16v4bak0yX0imyIUEgwNovFTglhMZGcm0srIy43zAVUxuTLbW4xn17Fci23wly9dngUummrTaixcvMpOtW7fiiBwQpqKYU9efHuxDJE5hC9wvL9TW1RLg+PHjPGTQ8wsLC4WpDC5Y5UR4k5qKMSLT6lqeAiX0nuAaMmSI9sMPP9CZM2foyJEj9O677wpTVIuTjidNp0HibvttoH9E5OMqbWKkSaNSlojldoLF7TEP+nUEmKI62y1kOBINbVaNarcI0PuGGUlHyfYvLHg7/jhFSFYqZh0P8KHSptd5ksOPU3tvqAEUot/hFmOIYJLp87wGe9Dwm95eg5xa/R8G6d8U5EcFhwAAAABJRU5ErkJggg==">
89

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: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ tr.status-warning td {
491491
}
492492
#sidebar .module {
493493
padding: 10px;
494+
width: 220px;
494495
}
495496
#sidebar .module h3 {
496497
color: #999;
@@ -504,14 +505,25 @@ tr.status-warning td {
504505
------------------------------------------------------------------------- #}
505506
#sidebar #sidebar-shortcuts {
506507
background: #333;
507-
padding: 16px 10px;
508508
/* needed to prevent visual issues due to the pure CSS slideToggle() */
509509
-webkit-touch-callout: none;
510510
-webkit-user-select: none;
511511
-khtml-user-select: none;
512512
-moz-user-select: none;
513513
-ms-user-select: none;
514514
user-select: none;
515+
width: 220px;
516+
}
517+
#sidebar #sidebar-shortcuts .shortcuts {
518+
position: relative;
519+
padding: 16px 10px;
520+
}
521+
#sidebar-shortcuts .icon {
522+
display: block;
523+
float: left;
524+
width: 50px;
525+
margin: 2px 0 0 -10px;
526+
text-align: center;
515527
}
516528
#sidebar #sidebar-shortcuts .btn {
517529
color: #F5F5F5;
@@ -569,6 +581,7 @@ tr.status-warning td {
569581
#menu-profiler li {
570582
position: relative;
571583
margin-bottom: 0;
584+
width: 220px;
572585
}
573586
#menu-profiler li a {
574587
border: solid transparent;
@@ -853,3 +866,53 @@ table.logs .metadata strong {
853866
{{ mixins.sans_serif_font|raw }}
854867
vertical-align: middle;
855868
}
869+
870+
{# Small screens
871+
========================================================================= #}
872+
873+
.visible-small {
874+
display: none;
875+
}
876+
.hidden-small {
877+
display: inherit;
878+
}
879+
880+
@media (max-width: 768px) {
881+
#collector-content {
882+
margin-left: 50px;
883+
}
884+
885+
#sidebar {
886+
width: 50px;
887+
overflow-y: hidden;
888+
transition: width 200ms ease-out;
889+
}
890+
#sidebar:hover, #sidebar.expanded {
891+
width: 220px;
892+
}
893+
894+
#sidebar-search {
895+
display: none;
896+
}
897+
#sidebar:hover #sidebar-search.sf-toggle-visible, #sidebar.expanded #sidebar-search.sf-toggle-visible {
898+
display: block;
899+
}
900+
901+
#sidebar .module {
902+
display: none;
903+
}
904+
#sidebar:hover .module, #sidebar.expanded .module {
905+
display: block;
906+
}
907+
908+
.visible-small {
909+
display: inherit;
910+
}
911+
.hidden-small {
912+
display: none;
913+
}
914+
915+
.btn-sm svg {
916+
margin-left: 2px;
917+
}
918+
}

0 commit comments

Comments
 (0)