From cf4554d1dd7805a6a737dcb0f620c80d36850108 Mon Sep 17 00:00:00 2001 From: erikn69 Date: Mon, 17 Jul 2023 10:04:38 -0500 Subject: [PATCH] Reverting #1359 unnecessary file (#1427) --- src/DataCollector/ViewCollector.php | 2 +- src/JavascriptRenderer.php | 1 - src/Resources/templates/widget.js | 98 ----------------------------- 3 files changed, 1 insertion(+), 100 deletions(-) delete mode 100644 src/Resources/templates/widget.js diff --git a/src/DataCollector/ViewCollector.php b/src/DataCollector/ViewCollector.php index 2e898e15..1cefe5c7 100644 --- a/src/DataCollector/ViewCollector.php +++ b/src/DataCollector/ViewCollector.php @@ -62,7 +62,7 @@ public function getWidgets() return [ 'views' => [ 'icon' => 'leaf', - 'widget' => 'PhpDebugBar.Widgets.LaravelViewTemplatesWidget', + 'widget' => 'PhpDebugBar.Widgets.TemplatesWidget', 'map' => 'views', 'default' => '[]' ], diff --git a/src/JavascriptRenderer.php b/src/JavascriptRenderer.php index 9c967909..428b15a9 100644 --- a/src/JavascriptRenderer.php +++ b/src/JavascriptRenderer.php @@ -23,7 +23,6 @@ public function __construct(DebugBar $debugBar, $baseUrl = null, $basePath = nul $this->cssVendors['fontawesome'] = __DIR__ . '/Resources/vendor/font-awesome/style.css'; $this->jsFiles['laravel-sql'] = __DIR__ . '/Resources/sqlqueries/widget.js'; $this->jsFiles['laravel-cache'] = __DIR__ . '/Resources/cache/widget.js'; - $this->jsFiles['laravel-view'] = __DIR__ . '/Resources/templates/widget.js'; $theme = config('debugbar.theme', 'auto'); switch ($theme) { diff --git a/src/Resources/templates/widget.js b/src/Resources/templates/widget.js deleted file mode 100644 index bb39188b..00000000 --- a/src/Resources/templates/widget.js +++ /dev/null @@ -1,98 +0,0 @@ -(function($) { - - var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-'); - - /** - * Widget for the displaying templates data - * - * Options: - * - data - */ - var TemplatesWidget = PhpDebugBar.Widgets.LaravelViewTemplatesWidget = PhpDebugBar.Widget.extend({ - - className: csscls('templates'), - - render: function() { - this.$status = $('
').addClass(csscls('status')).appendTo(this.$el); - - this.$list = new PhpDebugBar.Widgets.ListWidget({ itemRenderer: function(li, tpl) { - $('').addClass(csscls('name')).text(tpl.name).appendTo(li); - - if (typeof tpl.editorLink !== 'undefined' && tpl.editorLink !== null) { - $('') - .addClass(csscls('editor-link')) - .on('click', function (event) { - event.stopPropagation(); - }) - .appendTo(li); - } - if (typeof tpl.xdebug_link !== 'undefined' && tpl.xdebug_link !== null) { - if (tpl.xdebug_link.ajax) { - $('').on('click', function () { - $.ajax(tpl.xdebug_link.url); - }).addClass(csscls('editor-link')).appendTo(li); - } else { - $('').addClass(csscls('editor-link')).appendTo(li); - } - } - if (tpl.render_time_str) { - $('').addClass(csscls('render-time')).text(tpl.render_time_str).appendTo(li); - } - if (tpl.memory_str) { - $('').addClass(csscls('memory')).text(tpl.memory_str).appendTo(li); - } - if (typeof(tpl.param_count) != 'undefined') { - $('').addClass(csscls('param-count')).text(tpl.param_count).appendTo(li); - } - if (typeof(tpl.type) != 'undefined' && tpl.type) { - $('').addClass(csscls('type')).text(tpl.type).appendTo(li); - } - if (tpl.params && !$.isEmptyObject(tpl.params)) { - var table = $('
Params
').addClass(csscls('params')).appendTo(li); - for (var key in tpl.params) { - if (typeof tpl.params[key] !== 'function') { - table.append('' + key + '
' + tpl.params[key] + '
'); - } - } - li.css('cursor', 'pointer').click(function() { - if (table.is(':visible')) { - table.hide(); - } else { - table.show(); - } - }); - } - }}); - this.$list.$el.appendTo(this.$el); - this.$callgraph = $('
').addClass(csscls('callgraph')).appendTo(this.$el); - - this.bindAttr('data', function(data) { - this.$list.set('data', data.templates); - this.$status.empty(); - this.$callgraph.empty(); - - var sentence = data.sentence || "templates were rendered"; - $('').text(data.nb_templates + " " + sentence).appendTo(this.$status); - - if (data.accumulated_render_time_str) { - this.$status.append($('').addClass(csscls('render-time')).text(data.accumulated_render_time_str)); - } - if (data.memory_usage_str) { - this.$status.append($('').addClass(csscls('memory')).text(data.memory_usage_str)); - } - if (data.nb_blocks > 0) { - $('
').text(data.nb_blocks + " blocks were rendered").appendTo(this.$status); - } - if (data.nb_macros > 0) { - $('
').text(data.nb_macros + " macros were rendered").appendTo(this.$status); - } - if (typeof data.callgraph !== 'undefined') { - this.$callgraph.html(data.callgraph); - } - }); - } - - }); - -})(PhpDebugBar.$);