diff options
| author | Fabien Meghazi <fme@odoo.com> | 2016-09-07 16:01:16 +0200 |
|---|---|---|
| committer | Fabien Meghazi <fme@odoo.com> | 2016-09-09 18:03:08 +0200 |
| commit | 75f60f69416625713819c810d2da33db4dc0b06c (patch) | |
| tree | 11c1196aff2828d6619fbd36ff37a5848376ef86 /addons/web/static/lib/qweb/qweb-test-conditionals.xml | |
| parent | a00ea2755d93cef160a13d4652729e3c655fdbb8 (diff) | |
[ADD] web: Add extra condition branching (t-elif, t-else)
A new preprocess method is added to the template engine in order to do
preprocessing/sanitization of the templates before compilation.
This method can be overloaded in order to add new features such as
translation, ...
Diffstat (limited to 'addons/web/static/lib/qweb/qweb-test-conditionals.xml')
| -rw-r--r-- | addons/web/static/lib/qweb/qweb-test-conditionals.xml | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/addons/web/static/lib/qweb/qweb-test-conditionals.xml b/addons/web/static/lib/qweb/qweb-test-conditionals.xml index b1d54bcdcf0..782feb24249 100644 --- a/addons/web/static/lib/qweb/qweb-test-conditionals.xml +++ b/addons/web/static/lib/qweb/qweb-test-conditionals.xml @@ -16,16 +16,27 @@ </t> <result id="boolean-value-condition-missing"/> + <!-- TODO: activate this test when qweb.py implements t-elif + <t t-name="boolean-value-condition-elif"> + <t t-if="color == 'black'">black pearl</t> + <t t-elif="color == 'yellow'">yellow submarine</t> + <t t-elif="color == 'red'">red is dead</t> + <t t-else="">beer</t> + </t> + <params id="boolean-value-condition-elif">{"color": "red"}</params> + <result id="boolean-value-condition-elif">red is dead</result> + --> + <t t-name="boolean-value-condition-else"> <div><span>begin</span><t t-if="condition">ok</t> - <t t-else="t-else">ok-else</t><span>end</span></div> + <t t-else="">ok-else</t><span>end</span></div> </t> <params id="boolean-value-condition-else">{"condition": true}</params> <result id="boolean-value-condition-else"><![CDATA[<div><span>begin</span>ok<span>end</span></div>]]></result> <t t-name="boolean-value-condition-false-else"> <div><span>begin</span><t t-if="condition">fail</t> - <t t-else="t-else">fail-else</t><span>end</span></div> + <t t-else="">fail-else</t><span>end</span></div> </t> <params id="boolean-value-condition-false-else">{"condition": false}</params> <result id="boolean-value-condition-false-else"><![CDATA[<div><span>begin</span>fail-else<span>end</span></div>]]></result> |
