Skip to content

Commit

Permalink
Fix #430: Allow to configure toolbar position via `Module::$toolbarPo…
Browse files Browse the repository at this point in the history
…sition` property
  • Loading branch information
sasha-x authored Feb 20, 2024
1 parent 6c7b822 commit b9a2bcc
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Yii Framework 2 debug extension Change Log
2.1.26 under development
------------------------

- Enh #430: Allow to configure toolbar position via `Module::$toolbarPosition` property (sasha-x)
- Bug #528: Fix `yii\debug\Panel::getTraceLine()` to handle backtrace for internal PHP functions (zymeli)


Expand Down
6 changes: 6 additions & 0 deletions src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ class Module extends \yii\base\Module implements BootstrapInterface
* @since 2.1.1
*/
public $defaultHeight = 50;
/**
* @var string toolbar position on web page. Use 'bottom' or 'upper'.
* You may add custom value via .yii-debug-toolbar_position_{yourValue} css.
* @since 2.1.14
*/
public $toolbarPosition = 'bottom';
/**
* @var bool whether to enable message logging for the requests about debug module actions.
* You normally do not want to keep these logs because they may distract you from the logs about your applications.
Expand Down
2 changes: 1 addition & 1 deletion src/assets/css/toolbar.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/assets/scss/toolbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@
margin: 0;
}

.yii-debug-toolbar_position_upper {
position: fixed;
right: 0;
top: 0;
margin: 0;
}

.yii-debug-toolbar_position_upper.yii-debug-toolbar_iframe_active {
border-bottom: 1px solid rgba(0, 0, 0, .11);

.yii-debug-toolbar__toggle-icon {
-webkit-transform: rotate(-90deg);
transform: rotate(-90deg);
}
}

.yii-debug-toolbar__bar {
position: relative;
padding: 0;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function actionToolbar($tag)
return $this->renderPartial('toolbar', [
'tag' => $tag,
'panels' => $this->module->panels,
'position' => 'bottom',
'position' => $this->module->toolbarPosition,
'defaultHeight' => $this->module->defaultHeight,
]);
}
Expand Down

0 comments on commit b9a2bcc

Please sign in to comment.