Skip to content

Commit

Permalink
Fix debug bar on global search page (#16226)
Browse files Browse the repository at this point in the history
* fix debug bar on global search page

* load only requested lib on debug mode

---------

Co-authored-by: Cédric Anne <[email protected]>
  • Loading branch information
cconard96 and cedric-anne authored Jan 18, 2024
1 parent 3b109f8 commit cd46a36
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,12 @@ public static function includeHeader(
$tpl_vars['css_files'][] = ['path' => 'public/lib/photoswipe.css'];
Html::requireJs('photoswipe');

//on demand JS
if ($_SESSION['glpi_use_mode'] === Session::DEBUG_MODE) {
$tpl_vars['css_files'][] = ['path' => 'public/lib/codemirror.css'];
Html::requireJs('codemirror');
}

//on demand JS.
if ($sector != 'none' || $item != 'none' || $option != '') {
$jslibs = [];
if (isset($CFG_GLPI['javascript'][$sector])) {
Expand Down Expand Up @@ -1236,7 +1241,10 @@ public static function includeHeader(
Html::requireJs('charts');
}

if (in_array('codemirror', $jslibs) || $_SESSION['glpi_use_mode'] === Session::DEBUG_MODE) {
if (
in_array('codemirror', $jslibs)
&& $_SESSION['glpi_use_mode'] !== Session::DEBUG_MODE // codemirror is already loaded when debug mode is active
) {
$tpl_vars['css_files'][] = ['path' => 'public/lib/codemirror.css'];
Html::requireJs('codemirror');
}
Expand Down

0 comments on commit cd46a36

Please sign in to comment.