From ee42fba327cf182a849968613a52346e9d92b7d8 Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Fri, 23 Jun 2017 00:23:25 -0400 Subject: [PATCH 1/4] Display a better error design when the toolbar cannot be displayed --- .../views/Profiler/toolbar_js.html.twig | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig index 57537f61a3feb..c92fffb23915b 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig @@ -57,13 +57,17 @@ } }, function(xhr) { - var errorToolbarHtml = ' - -
An error occurred while loading the web debug toolbar. Open the web profiler.
+ var errorToolbarHtml = '\ + \ +
\ +
\ + An error occurred while loading the web debug toolbar. Open the web profiler.\ +
\ '; if (xhr.status !== 0) { From 86750a3f54bdcbdc796d9721b3182d8f25a94a56 Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Fri, 23 Jun 2017 09:49:44 -0400 Subject: [PATCH 2/4] Use current sfwdt div and pushing styles into toolbar.css.twig --- .../Resources/views/Profiler/toolbar.css.twig | 30 +++++++++++++++++++ .../views/Profiler/toolbar_js.html.twig | 18 ++++------- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig index a01a9017f4a49..9498cbf0a43d6 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig @@ -440,3 +440,33 @@ visibility: hidden; } } + +/***** Error Toolbar *****/ +.sfErrorToolbar { + background: #222; + left: 0; + bottom: 0; + color: #f5f5f5; + font: 13px/36px Arial, sans-serif; + height: 36px; + padding: 0 15px; + position: fixed; + width: 100%; + text-align: left; +} + +.sfErrorToolbar a { + color: #99cdd8; + margin-left: 5px; + text-decoration: underline; +} + +.sfErrorToolbar a:hover { + text-decoration: none; +} + +.sfErrorToolbar .sf-toolbar-icon { + float: left; + padding: 5px 0; + margin-right: 10px; +} diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig index c92fffb23915b..9f58bcd97c758 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig @@ -57,21 +57,13 @@ } }, function(xhr) { - var errorToolbarHtml = '\ - \ -
\ + if (xhr.status !== 0) { + var sfwdt = document.getElementById('sfwdt{{ token }}'); + sfwdt.innerHTML = '\
\ An error occurred while loading the web debug toolbar. Open the web profiler.\ -
\ - '; - - if (xhr.status !== 0) { - window.document.body.insertAdjacentHTML('beforeend', errorToolbarHtml); + '; + sfwdt.setAttribute('class', 'sfErrorToolbar'); } }, {'maxTries': 5} From f7331864edf499867348050c5c0adff7b622b66e Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Fri, 23 Jun 2017 10:29:56 -0400 Subject: [PATCH 3/4] Respect configured toolbar position --- .../Resources/views/Profiler/toolbar.css.twig | 12 ++++-------- .../Resources/views/Profiler/toolbar_js.html.twig | 8 +++++--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig index 9498cbf0a43d6..81279cfc92259 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig @@ -442,30 +442,26 @@ } /***** Error Toolbar *****/ -.sfErrorToolbar { +.sf-error-toolbar .sf-toolbarreset { background: #222; - left: 0; - bottom: 0; color: #f5f5f5; font: 13px/36px Arial, sans-serif; height: 36px; padding: 0 15px; - position: fixed; - width: 100%; text-align: left; } -.sfErrorToolbar a { +.sf-error-toolbar .sf-toolbarreset a { color: #99cdd8; margin-left: 5px; text-decoration: underline; } -.sfErrorToolbar a:hover { +.sf-error-toolbar .sf-toolbarreset a:hover { text-decoration: none; } -.sfErrorToolbar .sf-toolbar-icon { +.sf-error-toolbar .sf-toolbarreset .sf-toolbar-icon { float: left; padding: 5px 0; margin-right: 10px; diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig index 9f58bcd97c758..3bdd8ef1e843e 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig @@ -60,10 +60,12 @@ if (xhr.status !== 0) { var sfwdt = document.getElementById('sfwdt{{ token }}'); sfwdt.innerHTML = '\ -
\ - An error occurred while loading the web debug toolbar. Open the web profiler.\ +
\ +
\ + An error occurred while loading the web debug toolbar. Open the web profiler.\ +
\ '; - sfwdt.setAttribute('class', 'sfErrorToolbar'); + sfwdt.setAttribute('class', 'sf-toolbar sf-error-toolbar'); } }, {'maxTries': 5} From e40c4093bbb26bdeca4d93290dd445d10c93f23f Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Fri, 23 Jun 2017 12:19:04 -0400 Subject: [PATCH 4/4] Guaranteeing that the svg height is the same until 3.4 version --- .../Resources/views/Profiler/toolbar.css.twig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig index 81279cfc92259..2e05fb89abe71 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig @@ -451,6 +451,10 @@ text-align: left; } +.sf-error-toolbar .sf-toolbarreset svg { + height: auto; +} + .sf-error-toolbar .sf-toolbarreset a { color: #99cdd8; margin-left: 5px;