From ed3e403b4bf8b183a1fe76559b9b7849c43a8a3e Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Fri, 23 Jun 2017 00:23:25 -0400 Subject: [PATCH] Display a better error design when the toolbar cannot be displayed --- .../Resources/views/Profiler/toolbar.css.twig | 30 +++++++++++++++++++ .../views/Profiler/toolbar_js.html.twig | 18 +++++------ 2 files changed, 38 insertions(+), 10 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 a01a9017f4..2e05fb89ab 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 *****/ +.sf-error-toolbar .sf-toolbarreset { + background: #222; + color: #f5f5f5; + font: 13px/36px Arial, sans-serif; + height: 36px; + padding: 0 15px; + text-align: left; +} + +.sf-error-toolbar .sf-toolbarreset svg { + height: auto; +} + +.sf-error-toolbar .sf-toolbarreset a { + color: #99cdd8; + margin-left: 5px; + text-decoration: underline; +} + +.sf-error-toolbar .sf-toolbarreset a:hover { + text-decoration: none; +} + +.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 57537f61a3..3bdd8ef1e8 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,17 +57,15 @@ } }, function(xhr) { - var errorToolbarHtml = ' - -
An error occurred while loading the web debug toolbar. Open the web profiler.
- '; - if (xhr.status !== 0) { - window.document.body.insertAdjacentHTML('beforeend', errorToolbarHtml); + var sfwdt = document.getElementById('sfwdt{{ token }}'); + sfwdt.innerHTML = '\ +
\ +
\ + An error occurred while loading the web debug toolbar. Open the web profiler.\ +
\ + '; + sfwdt.setAttribute('class', 'sf-toolbar sf-error-toolbar'); } }, {'maxTries': 5}