[REF] playground: use t-foreach to reduce duplication

This commit is contained in:
Géry Debongnie
2019-05-16 12:04:50 +02:00
parent 042e376c2b
commit 46ba77d0cc
2 changed files with 6 additions and 3 deletions
+1
View File
@@ -115,6 +115,7 @@ body {
width: 34px;
text-align: center;
border-bottom: 2px solid transparent;
text-transform: uppercase;
}
.tab.active {
+5 -3
View File
@@ -1,9 +1,11 @@
<templates>
<div t-name="TabbedEditor" class="tabbed-editor">
<div class="tabBar" t-att-class="{resizeable: props.resizeable}" t-on-mousedown="onMouseDown">
<a t-if="props.js" class="tab flash" t-att-class="{active: state.currentTab==='js'}" t-on-click="setTab('js')">JS</a>
<a t-if="props.xml" class="tab flash" t-att-class="{active: state.currentTab==='xml'}" t-on-click="setTab('xml')">XML</a>
<a t-if="props.css" class="tab flash" t-att-class="{active: state.currentTab==='css'}" t-on-click="setTab('css')">CSS</a>
<t t-foreach="['js', 'xml', 'css']" t-as="tab">
<a t-if="props[tab]" class="tab flash" t-att-class="{active: state.currentTab===tab}" t-on-click="setTab(tab)">
<t t-esc="tab"/>
</a>
</t>
</div>
<div class="code-editor" t-ref="'editor'"></div>
</div>