From 3e9b26ce56e753dceecd8050fc9b440842e36c8e Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Sun, 26 Jan 2025 19:13:14 +0100 Subject: [PATCH] Link indicator to tab --- src/DebugBar/Resources/debugbar.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/DebugBar/Resources/debugbar.js b/src/DebugBar/Resources/debugbar.js index 2f47412..05cb845 100644 --- a/src/DebugBar/Resources/debugbar.js +++ b/src/DebugBar/Resources/debugbar.js @@ -321,6 +321,13 @@ if (typeof(PhpDebugBar) == 'undefined') { } }); + var self = this; + this.bindAttr('link', function(link) { + this.$el.css('cursor', 'pointer').click(function() { + self.get('debugbar').showTab(link); + }) + }); + this.bindAttr(['title', 'data'], $('').addClass(csscls('text')).appendTo(this.$el)); this.$tooltip = $('').addClass(csscls('tooltip disabled')).appendTo(this.$el); @@ -865,10 +872,11 @@ if (typeof(PhpDebugBar) == 'undefined') { * @param {String} position "right" or "left", default is "right" * @return {Indicator} */ - createIndicator: function(name, icon, tooltip, position) { + createIndicator: function(name, icon, tooltip, position, link) { var indicator = new Indicator({ icon: icon, - tooltip: tooltip + tooltip: tooltip, + link: link }); return this.addIndicator(name, indicator, position); }, @@ -886,6 +894,8 @@ if (typeof(PhpDebugBar) == 'undefined') { throw new Error(name + ' already exists'); } + indicator.set('debugbar', this); + if (position == 'left') { indicator.$el.insertBefore(this.$headerLeft.children().first()); } else {