Fixed rendering issue in layout if all blocks next to each other are Fixed Size and some of them have nothing in them

This commit is contained in:
Matias Griese
2016-04-22 15:46:30 +03:00
parent 67b6dab2c5
commit 52ae396b8f
6 changed files with 23 additions and 7 deletions
+4 -1
View File
@@ -1,8 +1,11 @@
# 5.2.15
## XX/XX/2016
1. [Common](#common)
3. [](#bugfix)
- Fixed rendering issue in layout if all blocks next to each other are `Fixed Size` and some of them have nothing in them
2. [Joomla](#joomla)
1. [](#new)
2. [](#improved)
- Enable HTML5 document support from Joomla
# 5.2.14
@@ -10,7 +10,7 @@
{% endfor %}
{% endset %}
{% if html|trim %}
{% if segment.attributes.sticky or html|trim %}
{% set classes = segment.attributes.class ? ' ' ~ segment.attributes.class|e %}
{% set attr_extra = '' %}
@@ -15,7 +15,7 @@
{% endfor %}
{% endset %}
{% if offcanvas|trim %}
{% if segment.attributes.sticky or offcanvas|trim %}
<div id="g-offcanvas" {{ attr_class|raw }}{{ attr_extra|raw }} data-g-offcanvas-swipe="{{ segment.attributes.swipe|default('1') }}" data-g-offcanvas-css3="{{ segment.attributes.css3animation|default('1') }}">
{{ offcanvas|raw }}
</div>
@@ -23,7 +23,7 @@
{% endif %}
{% endset %}
{% if html|trim %}
{% if segment.attributes.sticky or html|trim %}
{% if boxed is not null and (boxed == 0 or boxed == 2) %}
{% set html %}
<div class="g-container">{{ html|raw }}</div>
@@ -4,7 +4,7 @@
{% endfor %}
{% endset %}
{% if html|trim %}
{% if segment.attributes.sticky or html|trim %}
{% set id = segment.attributes.id|default('g-' ~ segment.id) %}
{% set attr_extra = '' %}
@@ -477,17 +477,25 @@ trait ThemeTrait
* Action is needed before displaying the layout as it recalculates block widths based on the visible content.
*
* @param array $items
* @param bool $temporary
* @param bool $sticky
* @internal
*/
protected function prepareLayout(array &$items)
protected function prepareLayout(array &$items, $temporary = false, $sticky = false)
{
foreach ($items as $i => &$item) {
// Non-numeric items are meta-data which should be ignored.
if (((string)(int) $i !== (string) $i) || !is_object($item)) {
continue;
}
if (!empty($item->children)) {
$this->prepareLayout($item->children);
$fixed = true;
foreach ($item->children as $child) {
$fixed &= !empty($child->attributes->fixed);
}
$this->prepareLayout($item->children, $fixed, $temporary);
}
// TODO: remove hard coded types.
@@ -508,6 +516,11 @@ trait ThemeTrait
break;
default:
if ($sticky) {
$item->attributes->sticky = 1;
break;
}
if (empty($item->children)) {
unset($items[$i]);
break;