Skip to content

Commit

Permalink
Merge pull request #35 from lserwatka/EZP-21901
Browse files Browse the repository at this point in the history
Fixed EZP-21901: DemoBundle: Convert all zone templates from legacy code to Twig
  • Loading branch information
lolautruche committed Nov 6, 2013
2 parents 560cf7c + b1ca1e1 commit 1c866e6
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 8 deletions.
12 changes: 4 additions & 8 deletions Resources/config/ezpage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ ezpage:
layouts:
GlobalZoneLayout:
name: Global zone layout
template: globalzonelayout.tpl
template: "eZDemoBundle:zone:globalzonelayout.html.twig"
2ZonesLayout1:
name: 2 zones (layout 1)
template: "eZDemoBundle:zone:2zoneslayout1.html.twig"
Expand All @@ -110,16 +110,13 @@ ezpage:
template: "eZDemoBundle:zone:2zoneslayout2.html.twig"
2ZonesLayout3:
name: 2 zones (layout 3)
template: 2zoneslayout3.tpl
template: "eZDemoBundle:zone:2zoneslayout3.html.twig"
3ZonesLayout1:
name: 3 zones (layout 1)
template: 3zoneslayout1.tpl
template: "eZDemoBundle:zone:3zoneslayout1.html.twig"
3ZonesLayout2:
name: 3 zones (layout 2)
template: 3zoneslayout2.tpl
CallForActionLayout:
name: Call For Action zone layout
template: callforactionlayout.tpl
template: "eZDemoBundle:zone:3zoneslayout2.html.twig"

enabledLayouts:
- GlobalZoneLayout
Expand All @@ -128,7 +125,6 @@ ezpage:
- 2ZonesLayout3
- 3ZonesLayout1
- 3ZonesLayout2
- CallForActionLayout

# List of blocks provided by the DemoBundle
blocks:
Expand Down
36 changes: 36 additions & 0 deletions Resources/views/zone/2zoneslayout3.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<div class="zone-layout-{{ zone_layout|lower }} row">
<div class="span12">
<section class="content-view-block">
{# Iterating over available blocks in 1st zone. #}
{# Blocks are added in the admin interface. #}
{% if zones[0].blocks %}
{% for block in zones[0].blocks %}
{{ render(
controller(
"ez_page:viewBlock",
{
'block': block
}
)
) }}
{% if not loop.last %}
<div class="block-separator"></div>
{% endif %}
{% endfor %}
{% endif %}
</section>
</div>
<div class="span12">
<section class="content-view-block">
{# Iterating over available blocks in 2nd zone. #}
{% if zones[1].blocks %}
{% for block in zones[1].blocks %}
{{ render( controller( "ez_page:viewBlock", {'block': block} ) ) }}
{% if not loop.last %}
<div class="block-separator"></div>
{% endif %}
{% endfor %}
{% endif %}
</section>
</div>
</div>
51 changes: 51 additions & 0 deletions Resources/views/zone/3zoneslayout1.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<div class="zone-layout-{{ zone_layout|lower }} row">
<div class="span8">
<section class="content-view-block">
{# Iterating over available blocks in 1st zone. #}
{# Blocks are added in the admin interface. #}
{% if zones[0].blocks %}
{% for block in zones[0].blocks %}
{{ render(
controller(
"ez_page:viewBlock",
{
'block': block
}
)
) }}
{% if not loop.last %}
<div class="block-separator"></div>
{% endif %}
{% endfor %}
{% endif %}
</section>
</div>
<div class="span4">
<aside>
<section class="content-view-block content-view-aside">
{# Iterating over available blocks in 2nd zone. #}
{% if zones[1].blocks %}
{% for block in zones[1].blocks %}
{{ render( controller( "ez_page:viewBlock", {'block': block} ) ) }}
{% if not loop.last %}
<div class="block-separator"></div>
{% endif %}
{% endfor %}
{% endif %}
</section>
</aside>
</div>
<div class="span12">
<section class="content-view-block">
{# Iterating over available blocks in 3rd zone. #}
{% if zones[2].blocks %}
{% for block in zones[2].blocks %}
{{ render( controller( "ez_page:viewBlock", {'block': block} ) ) }}
{% if not loop.last %}
<div class="block-separator"></div>
{% endif %}
{% endfor %}
{% endif %}
</section>
</div>
</div>
51 changes: 51 additions & 0 deletions Resources/views/zone/3zoneslayout2.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<div class="zone-layout-{{ zone_layout|lower }} row">
<div class="span4">
<aside>
<section class="content-view-block content-view-aside">
{# Iterating over available blocks in 1st zone. #}
{# Blocks are added in the admin interface. #}
{% if zones[0].blocks %}
{% for block in zones[0].blocks %}
{{ render(
controller(
"ez_page:viewBlock",
{
'block': block
}
)
) }}
{% if not loop.last %}
<div class="block-separator"></div>
{% endif %}
{% endfor %}
{% endif %}
</section>
</aside>
</div>
<div class="span8">
<section>
{# Iterating over available blocks in 2nd zone. #}
{% if zones[1].blocks %}
{% for block in zones[1].blocks %}
{{ render( controller( "ez_page:viewBlock", {'block': block} ) ) }}
{% if not loop.last %}
<div class="block-separator"></div>
{% endif %}
{% endfor %}
{% endif %}
</section>
</div>
<div class="span12">
<section class="content-view-block">
{# Iterating over available blocks in 3rd zone. #}
{% if zones[2].blocks %}
{% for block in zones[2].blocks %}
{{ render( controller( "ez_page:viewBlock", {'block': block} ) ) }}
{% if not loop.last %}
<div class="block-separator"></div>
{% endif %}
{% endfor %}
{% endif %}
</section>
</div>
</div>
19 changes: 19 additions & 0 deletions Resources/views/zone/globalzonelayout.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<section class="content-view-block content-view-aside">
{# Iterating over available blocks in 1st zone. #}
{# Blocks are added in the admin interface. #}
{% if zones[0].blocks %}
{% for block in zones[0].blocks %}
{{ render(
controller(
"ez_page:viewBlock",
{
'block': block
}
)
) }}
{% if not loop.last %}
<div class="block-separator"></div>
{% endif %}
{% endfor %}
{% endif %}
</section>

0 comments on commit 1c866e6

Please sign in to comment.