Skip to content

Ability to set whether bluescreen panel is collapsed or not#232

Merged
dg merged 1 commit into
nette:masterfrom
EdaCZ:master
Oct 30, 2016
Merged

Ability to set whether bluescreen panel is collapsed or not#232
dg merged 1 commit into
nette:masterfrom
EdaCZ:master

Conversation

@EdaCZ

@EdaCZ EdaCZ commented Oct 30, 2016

Copy link
Copy Markdown
Contributor

Purpose of this pull request is to give user-defined panels in bluescreen possibility to declare whether they want to be collapsed or expanded.

Now, if you implement Bluescreen panel, you must return from your callback array with two keys - panel and tab. After this PR we will support third optional key - collapsed.

<?php $bottomPanels = [] ?>
<?php foreach ($this->renderPanels(NULL) as $panel): ?>
<?php if (!empty($panel->bottom)) { $bottomPanels[] = $panel; continue; } ?>
<?php $collapsed = isset($panel->collapsed) ? (bool) $panel->collapsed : true; ?>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the (bool) cast is unnecessary; true should be written in uppercase (TRUE)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it is better to create $collapseClass than bool $collapse

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bool cast removed.

Used $collapseClass.

<?php $bottomPanels = [] ?>
<?php foreach ($this->renderPanels(NULL) as $panel): ?>
<?php if (!empty($panel->bottom)) { $bottomPanels[] = $panel; continue; } ?>
<?php $collapsedClass = (isset($panel->collapsed) ? $panel->collapsed : TRUE) ? ' tracy-collapsed' : ''; ?>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be simplified to

$collapsedClass = !isset($panel->collapsed) || $panel->collapsed ? ' tracy-collapsed' : '';

@EdaCZ EdaCZ Oct 30, 2016

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Anything else? :-)

@dg dg merged commit d8eaf19 into nette:master Oct 30, 2016
@dg

dg commented Oct 30, 2016

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants