From 59f0b3079954716a3be32a8537003be2540ad156 Mon Sep 17 00:00:00 2001 From: Sullivan SENECHAL Date: Fri, 30 Dec 2016 14:35:37 +0100 Subject: [PATCH] No icon when no call (#88) * Simplify error count Twig condition This is not necessary to specify `> 0`. * Do not show debug icon when no Guzzle call happen --- Resources/views/debug.html.twig | 65 ++++++++++++++++----------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/Resources/views/debug.html.twig b/Resources/views/debug.html.twig index 889a461..b0c039a 100644 --- a/Resources/views/debug.html.twig +++ b/Resources/views/debug.html.twig @@ -2,40 +2,39 @@ {% block toolbar %} - - {% if collector.callCount == 0 %} - {% set color = 'grey' %} - {% elseif collector.errorCount > 0 %} - {% set color = 'red' %} - {% else %} - {% set color = 'green' %} + {% if collector.callCount %} + {% if collector.errorCount %} + {% set color = 'red' %} + {% else %} + {% set color = 'green' %} + {% endif %} + + {% set icon %} + {{ include("@Guzzle/Icons/logo.svg.twig") }} + + {{ collector.callCount }} + + {% endset %} + + {% set text %} + +
+ API Calls + {{ collector.callCount }} +
+ +
+ Total time + {% if collector.totalTime > 1.0 %} + {{ '%0.2f'|format(collector.totalTime) }} s + {% else %} + {{ '%0.0f'|format(collector.totalTime * 1000) }} ms + {% endif %} +
+ {% endset %} + + {% include "WebProfilerBundle:Profiler:toolbar_item.html.twig" with { "link": profiler_url } %} {% endif %} - - {% set icon %} - {{ include("@Guzzle/Icons/logo.svg.twig") }} - - {{ collector.callCount }} - - {% endset %} - - {% set text %} - -
- API Calls - {{ collector.callCount }} -
- -
- Total time - {% if collector.totalTime > 1.0 %} - {{ '%0.2f'|format(collector.totalTime) }} s - {% else %} - {{ '%0.0f'|format(collector.totalTime * 1000) }} ms - {% endif %} -
- {% endset %} - - {% include "WebProfilerBundle:Profiler:toolbar_item.html.twig" with { "link": profiler_url } %} {% endblock %}