Skip to content

Conversation

@EdaCZ
Copy link
Contributor

@EdaCZ EdaCZ commented Oct 30, 2016

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
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
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
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
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' : '';

Copy link
Contributor Author

@EdaCZ EdaCZ Oct 30, 2016

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
Copy link
Member

dg commented Oct 30, 2016

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