Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Disable and hide yii-debug-toolbar when jQuery is not defined. #87

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kachar
Copy link

@kachar kachar commented Jun 19, 2013

Console error which halts the javascript on the whole page.
Uncaught ReferenceError: jQuery is not defined.

Review on Reviewable

Console error which halts the javascript on the whole page.
Uncaught ReferenceError: jQuery is not defined.
@Panoptik
Copy link

Panoptik commented Nov 8, 2013

Temporary quick solution is to exclude debug-toolbar scripts from script map
For example if you exclude jquery.js from script map. You may also exclude these scripgs

this code is in Controller::init

$cs = Yii::app()->clientScript;
$cs->scriptMap["jquery.js"] = false;

$cs->scriptMap['yii.debugtoolbar.js'] = false;
$cs->scriptMap['yii.debugtoolbar.css'] = false;

but there is another problem that toolbar generate service info that contains in layout
I solve this problem (in my case it is at module, but you also can do it at the same Controller::init) by disabling debug toolbar

/* @var CLogRouter $log */
$log = Yii::app()->log;
foreach($log->routes as $logRoute) {
if($logRoute instanceof YiiDebugToolbarRoute) {
$logRoute->enabled = false;
}
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants