Skip to content

Commit ed3e403

Browse files
ycerutofabpot
authored andcommitted
Display a better error design when the toolbar cannot be displayed
1 parent 9fc9cc4 commit ed3e403

File tree

2 files changed

+38
-10
lines changed

2 files changed

+38
-10
lines changed

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,3 +440,33 @@
440440
visibility: hidden;
441441
}
442442
}
443+
444+
/***** Error Toolbar *****/
445+
.sf-error-toolbar .sf-toolbarreset {
446+
background: #222;
447+
color: #f5f5f5;
448+
font: 13px/36px Arial, sans-serif;
449+
height: 36px;
450+
padding: 0 15px;
451+
text-align: left;
452+
}
453+
454+
.sf-error-toolbar .sf-toolbarreset svg {
455+
height: auto;
456+
}
457+
458+
.sf-error-toolbar .sf-toolbarreset a {
459+
color: #99cdd8;
460+
margin-left: 5px;
461+
text-decoration: underline;
462+
}
463+
464+
.sf-error-toolbar .sf-toolbarreset a:hover {
465+
text-decoration: none;
466+
}
467+
468+
.sf-error-toolbar .sf-toolbarreset .sf-toolbar-icon {
469+
float: left;
470+
padding: 5px 0;
471+
margin-right: 10px;
472+
}

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,15 @@
5757
}
5858
},
5959
function(xhr) {
60-
var errorToolbarHtml = '
61-
<style>
62-
.sfErrorToolbar { background: #222; bottom: 0; color: #f5f5f5; font: 13px/36px Arial, sans-serif; height: 36px; padding: 0 15px; position: fixed; width: 100%; }
63-
.sfErrorToolbar a { color: #99cdd8; margin-left: 5px; text-decoration: underline; }
64-
.sfErrorToolbar a:hover { text-decoration: none; }
65-
</style>
66-
<div class="sfErrorToolbar">An error occurred while loading the web debug toolbar. <a href="{{ path("_profiler", { "token": token }) }}">Open the web profiler.</a></div>
67-
';
68-
6960
if (xhr.status !== 0) {
70-
window.document.body.insertAdjacentHTML('beforeend', errorToolbarHtml);
61+
var sfwdt = document.getElementById('sfwdt{{ token }}');
62+
sfwdt.innerHTML = '\
63+
<div class="sf-toolbarreset">\
64+
<div class="sf-toolbar-icon"><svg width="26" height="28" xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" viewBox="0 0 26 28" enable-background="new 0 0 26 28" xml:space="preserve"><path fill="#FFFFFF" d="M13 0C5.8 0 0 5.8 0 13c0 7.2 5.8 13 13 13c7.2 0 13-5.8 13-13C26 5.8 20.2 0 13 0z M20 7.5 c-0.6 0-1-0.3-1-0.9c0-0.2 0-0.4 0.2-0.6c0.1-0.3 0.2-0.3 0.2-0.4c0-0.3-0.5-0.4-0.7-0.4c-2 0.1-2.5 2.7-2.9 4.8l-0.2 1.1 c1.1 0.2 1.9 0 2.4-0.3c0.6-0.4-0.2-0.8-0.1-1.3C18 9.2 18.4 9 18.7 8.9c0.5 0 0.8 0.5 0.8 1c0 0.8-1.1 2-3.3 1.9 c-0.3 0-0.5 0-0.7-0.1L15 14.1c-0.4 1.7-0.9 4.1-2.6 6.2c-1.5 1.8-3.1 2.1-3.8 2.1c-1.3 0-2.1-0.6-2.2-1.6c0-0.9 0.8-1.4 1.3-1.4 c0.7 0 1.2 0.5 1.2 1.1c0 0.5-0.2 0.6-0.4 0.7c-0.1 0.1-0.3 0.2-0.3 0.4c0 0.1 0.1 0.3 0.4 0.3c0.5 0 0.9-0.3 1.2-0.5 c1.3-1 1.7-2.9 2.4-6.2l0.1-0.8c0.2-1.1 0.5-2.3 0.8-3.5c-0.9-0.7-1.4-1.5-2.6-1.8c-0.8-0.2-1.3 0-1.7 0.4C8.4 10 8.6 10.7 9 11.1 l0.7 0.7c0.8 0.9 1.3 1.7 1.1 2.7c-0.3 1.6-2.1 2.8-4.3 2.1c-1.9-0.6-2.2-1.9-2-2.7c0.2-0.6 0.7-0.8 1.2-0.6 c0.5 0.2 0.7 0.8 0.6 1.3c0 0.1 0 0.1-0.1 0.3C6 15 5.9 15.2 5.9 15.3c-0.1 0.4 0.4 0.7 0.8 0.8c0.8 0.3 1.7-0.2 1.9-0.9 c0.2-0.6-0.2-1.1-0.4-1.2l-0.8-0.9c-0.4-0.4-1.2-1.5-0.8-2.8c0.2-0.5 0.5-1 0.9-1.4c1-0.7 2-0.8 3-0.6c1.3 0.4 1.9 1.2 2.8 1.9 c0.5-1.3 1.1-2.6 2-3.8c0.9-1 2-1.7 3.3-1.8C20 4.8 21 5.4 21 6.3C21 6.7 20.8 7.5 20 7.5z"/></svg></div>\
65+
An error occurred while loading the web debug toolbar. <a href="{{ path("_profiler", { "token": token }) }}">Open the web profiler.</a>\
66+
</div>\
67+
';
68+
sfwdt.setAttribute('class', 'sf-toolbar sf-error-toolbar');
7169
}
7270
},
7371
{'maxTries': 5}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy