1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-07-28 04:00:43 +02:00

Merge pull request #56 from GuimDev/master

ResponsiveCSS for debugbar
This commit is contained in:
Maxime Bouroumeau-Fuseau
2013-12-27 04:33:52 -08:00
14 changed files with 97 additions and 2 deletions

View File

@@ -84,6 +84,7 @@ class DoctrineCollector extends DataCollector implements Renderable
{
return array(
"database" => array(
"icone" => "arrow-right",
"widget" => "PhpDebugBar.Widgets.SQLQueriesWidget",
"map" => "doctrine",
"default" => "[]"

View File

@@ -104,6 +104,7 @@ class MonologCollector extends AbstractProcessingHandler implements DataCollecto
$name = $this->getName();
return array(
$name => array(
"icone" => "suitcase",
"widget" => "PhpDebugBar.Widgets.MessagesWidget",
"map" => "$name.records",
"default" => "[]"

View File

@@ -266,6 +266,7 @@ class PropelCollector extends DataCollector implements BasicLogger, Renderable
{
return array(
"propel" => array(
"icon" => "bolt",
"widget" => "PhpDebugBar.Widgets.SQLQueriesWidget",
"map" => "propel",
"default" => "[]"

View File

@@ -73,6 +73,7 @@ class SwiftMailCollector extends DataCollector implements Renderable
{
return array(
'emails' => array(
'icone' => 'inbox',
'widget' => 'PhpDebugBar.Widgets.MailsWidget',
'map' => 'swiftmailer_mails.mails',
'default' => '[]',

View File

@@ -73,9 +73,14 @@ class TwigCollector extends DataCollector implements Renderable
{
return array(
'twig' => array(
'icon' => 'leaf',
'widget' => 'PhpDebugBar.Widgets.TemplatesWidget',
'map' => 'twig',
'default' => '[]'
),
'twig:badge' => array(
'map' => 'twig.nb_templates',
'default' => 0
)
);
}

View File

@@ -67,6 +67,7 @@ class ConfigCollector extends DataCollector implements Renderable
$name = $this->getName();
return array(
"$name" => array(
"icon" => "gear",
"widget" => "PhpDebugBar.Widgets.VariableListWidget",
"map" => "$name",
"default" => "{}"

View File

@@ -87,6 +87,7 @@ class ExceptionsCollector extends DataCollector implements Renderable
{
return array(
'exceptions' => array(
'icon' => 'bug',
'widget' => 'PhpDebugBar.Widgets.ExceptionsWidget',
'map' => 'exceptions.exceptions',
'default' => '[]'

View File

@@ -128,6 +128,7 @@ class MessagesCollector extends AbstractLogger implements DataCollectorInterface
$name = $this->getName();
return array(
"$name" => array(
'icon' => 'list-alt',
"widget" => "PhpDebugBar.Widgets.MessagesWidget",
"map" => "$name.messages",
"default" => "[]"

View File

@@ -161,6 +161,7 @@ class PDOCollector extends DataCollector implements Renderable
{
return array(
"database" => array(
"icon" => "inbox",
"widget" => "PhpDebugBar.Widgets.SQLQueriesWidget",
"map" => "pdo",
"default" => "[]"

View File

@@ -47,6 +47,7 @@ class RequestDataCollector extends DataCollector implements Renderable
{
return array(
"request" => array(
"icon" => "tags",
"widget" => "PhpDebugBar.Widgets.VariableListWidget",
"map" => "request",
"default" => "{}"

View File

@@ -188,6 +188,7 @@ class TimeDataCollector extends DataCollector implements Renderable
"default" => "'0ms'"
),
"timeline" => array(
"icon" => "tasks",
"widget" => "PhpDebugBar.Widgets.TimelineWidget",
"map" => "time",
"default" => "{}"

View File

@@ -74,6 +74,11 @@ a.phpdebugbar-tab.phpdebugbar-active {
color: #555;
font-weight: normal;
text-shadow: none;
vertical-align: middle;
}
a.phpdebugbar-tab i {
display: none;
vertical-align: middle;
}
a.phpdebugbar-tab span.phpdebugbar-badge.phpdebugbar-important {
background: #ed6868;
@@ -95,6 +100,7 @@ a.phpdebugbar-open-btn {
.phpdebugbar-indicator {
position: relative;
cursor: pointer;
}
.phpdebugbar-indicator span.phpdebugbar-text {
margin-left: 5px;
@@ -110,6 +116,9 @@ a.phpdebugbar-open-btn {
font-size: 11px;
padding: 2px 3px;
z-index: 1000;
text-align: center;
width: 200%;
right: 0;
}
.phpdebugbar-indicator:hover span.phpdebugbar-tooltip:not(.phpdebugbar-disabled) {
display: block;
@@ -138,7 +147,7 @@ div.phpdebugbar-body {
width: 100%;
background: #fff;
border-top: 1px solid #ccc;
cursor: move;
cursor: n-resize;
position: absolute;
top: -33px;
}
@@ -154,3 +163,29 @@ div.phpdebugbar-panel {
div.phpdebugbar-panel.phpdebugbar-active {
display: block;
}
/* -------------------------------------- */
div.phpdebugbar-mini-design a.phpdebugbar-tab {
position: relative;
border-right: 1px solid #ddd;
}
div.phpdebugbar-mini-design a.phpdebugbar-tab span.phpdebugbar-text {
display: none;
}
div.phpdebugbar-mini-design a.phpdebugbar-tab:hover span.phpdebugbar-text {
display: block;
position: absolute;
top: -30px;
background: #efefef;
opacity: .7;
border: 1px solid #ccc;
color: #555;
font-size: 11px;
padding: 2px 3px;
z-index: 1000;
text-align: center;
right: 0;
}
div.phpdebugbar-mini-design a.phpdebugbar-tab i {
display:inline-block;
}

View File

@@ -244,6 +244,16 @@ if (typeof(PhpDebugBar) == 'undefined') {
render: function() {
this.$tab = $('<a href="javascript:" />').addClass(csscls('tab'));
this.$icon = $('<i />').appendTo(this.$tab);
this.bindAttr('icon', function(icon) {
if (icon) {
this.$icon.attr('class', 'fa fa-' + icon);
} else {
this.$icon.attr('class', '');
}
});
this.bindAttr('title', $('<span />').addClass(csscls('text')).appendTo(this.$tab));
this.$badge = $('<span />').addClass(csscls('badge')).appendTo(this.$tab);
@@ -390,6 +400,41 @@ if (typeof(PhpDebugBar) == 'undefined') {
this.firstTabName = null;
this.activePanelName = null;
this.datesetTitleFormater = new DatasetTitleFormater(this);
this.registerResizeHandler();
},
/**
* Register resize event, for resize debugbar with reponsive css.
*
* @this {DebugBar}
*/
registerResizeHandler: function() {
var self = this, f = null;
self.respCSSSize = 0;
$(window).resize(f = function () {
var $ = PhpDebugBar.$;
var header = $(".phpdebugbar-header");
var contentSize = self.respCSSSize;
if (self.respCSSSize == 0) {
$(header).find("> *:visible").each(function () {
contentSize += $(this).outerWidth();
});
}
var currentSize = $(header).width();
var cssClass = "phpdebugbar-mini-design", bool = $(header).hasClass(cssClass);
if (currentSize <= contentSize && !bool) {
self.respCSSSize = contentSize;
$(header).addClass(cssClass);
} else if (contentSize < currentSize && bool) {
self.respCSSSize = 0;
$(".phpdebugbar-header").removeClass(cssClass);
}
});
setTimeout(f, 20);
},
/**

View File

@@ -1,7 +1,7 @@
<script type="text/javascript">
jQuery.noConflict(true);
var phpdebugbar = new PhpDebugBar.DebugBar();
phpdebugbar.addTab("messages", new PhpDebugBar.DebugBar.Tab({"title":"Messages", "widget": new PhpDebugBar.Widgets.MessagesWidget()}));
phpdebugbar.addTab("messages", new PhpDebugBar.DebugBar.Tab({"icon":"list-alt","title":"Messages", "widget": new PhpDebugBar.Widgets.MessagesWidget()}));
phpdebugbar.addIndicator("time", new PhpDebugBar.DebugBar.Indicator({"icon":"time"}));
phpdebugbar.setDataMap({
"messages": ["messages.messages", []],