Debug bar and configuration updates.

This commit is contained in:
James Cole
2014-06-28 09:50:42 +02:00
parent 885685815e
commit f4194368c9
28 changed files with 3394 additions and 170 deletions

View File

@@ -0,0 +1,23 @@
div.phpdebugbar-widgets-templates div.phpdebugbar-widgets-status {
font-family: monospace;
padding: 6px 6px;
border-bottom: 1px solid #ddd;
font-weight: bold;
color: #555;
background: #fafafa;
}
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-render_time {
float: right;
}
div.phpdebugbar-widgets-templates span.phpdebugbar-widgets-render_time:before {
content: "\f017";
font-family: FontAwesome;
font-size: 12px;
margin-right: 4px;
}
div.phpdebugbar-widgets-templates div.phpdebugbar-widgets-status span.phpdebugbar-widgets-render_time {
color: #555;
}

View File

@@ -0,0 +1,38 @@
(function($) {
var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-');
/**
* Widget for the displaying templates data
*
* Options:
* - data
*/
var TemplatesWidget = PhpDebugBar.Widgets.TemplatesWidget = PhpDebugBar.Widget.extend({
className: csscls('templates'),
render: function() {
this.$status = $('<div />').addClass(csscls('status')).appendTo(this.$el);
this.$list = new PhpDebugBar.Widgets.ListWidget({ itemRenderer: function(li, tpl) {
$('<span />').addClass(csscls('name')).text(tpl.name).appendTo(li);
if (tpl.render_time_str) {
$('<span title="Render time" />').addClass(csscls('render_time')).text(tpl.render_time_str).appendTo(li);
}
}});
this.$list.$el.appendTo(this.$el);
this.bindAttr('data', function(data) {
this.$list.set('data', data.templates);
var sentence = data.sentence || "templates were rendered";
this.$status.empty().append($('<span />').text(data.templates.length + " " + sentence));
if (data.accumulated_render_time_str) {
this.$status.append($('<span title="Accumulated render time" />').addClass(csscls('render_time')).text(data.accumulated_render_time_str));
}
});
}
});
})(PhpDebugBar.$);