Commit Graph
72 Commits
Author SHA1 Message Date
Christophe Simonis d45c32baac [MERGE] forward port branch saas-15 up to bdd051bf78 2018-06-13 18:13:48 +02:00
Jeremy Kersten 51acdeba4f [ADD] qweb: add tests for widget=date with datetime
This commit is related to #24761
2018-06-12 15:48:21 +02:00
Adrien Dieudonne 599f6a762e [FIX] web: qweb: load template with non-http xhr
Since we are able to lazy load Qweb templates, there was
an issue to generate Awesome Timesheet iOS native app with
Cordova properly. It seems that under Cordova, iOS always
returns 0 for the status on a xml http request object.

The problem is that native applications are requesting
a local file from something that isn't a webserver.

The local file is delivered with no http headers that means no
"200 OK" header and no "404 Not Found" errors.

In this case, the request is still be completing as intended even
if the status code used by browsers is 0.

For more info, see:
https://developer.mozilla.org/fr/docs/Web/API/XMLHttpRequest
https://bugzilla.mozilla.org/show_bug.cgi?id=331610
2018-03-05 14:06:23 +01:00
Xavier Morel 7f6d32d5e0 Revert "[FIX] qwebjs: add tests to test suite" 2017-10-10 15:39:39 +02:00
Xavier Morel 6e646bc8bd [FIX] web: make qwebjs tests pass again
A bunch of features had been added to the qweb test files and qwebjs
did not pass them as features were either implemented differently or
not implemented at all:

* Fixed wonky and not cross-impl tests
  - added ``not`` word replacemenet to qwebjs as I wasn't sure how to
    handle that one cross-impl
* fixed t-esc/t-raw to render content *inside* the host node e.g.
  span@t-esc should render as <span>{contents of esc}</span>
* added fallback to body content if t-esc/t-raw yields an empty result
* process t-att in order with t-att-* and t-attf-* rather than before
  them both
* suppress attribute generation entirely in case of falsy value
2017-10-10 14:25:19 +02:00
Xavier Morel 1e3c76f41d [IMP] web: add web tests to regular JS suite
Remove old tests page as it was obviously unmaintained and did not run
at all...
2017-10-10 14:25:19 +02:00
Christophe Matthieu 27ff895dfd [IMP] web: extend qweb to allow dynamic templates in t-call
Before this change the t-call can use only receive a literal as parameters:
<t t-call="template.name17" />
This call render the template 'template.name17' with the current context.

Now, we can defined an expression with braces (same syntax that t-attf):
<t t-call="template.name{{ 10 + 7 }}" />
This call render the template 'template.name17' with the current context.

This change allows for greater flexibility for applications using qweb.
(The performance due to this change is unchanged during rendering time.)
2017-05-04 17:19:25 +02:00
Christophe Simonis 814c550913 [MERGE] forward port branch saas-11 up to a0ff1f2ad8 2017-04-21 14:34:11 +02:00
Christophe Simonis 8de514f805 [MERGE] forward port branch saas-6 up to b084ffd7f1 2017-04-21 14:07:02 +02:00
Christophe Simonis b084ffd7f1 [MERGE] forward port branch 8.0 up to 716ceede16 2017-04-21 14:05:52 +02:00
Nicolas Lempereur 716ceede16 [FIX] web_enterprise: kanban_state_selection ie
On IE (from 9.0 up to at least IE EDGE 14) we have this behavior
for the method serializeToString of XMLSerializer:

> (new XMLSerializer()).serializeToString($('<b>"</b>')[0])
  '<b xmlns="http://www.w3.org/1999/xhtml">"</b>'
> (new XMLSerializer()).serializeToString($('<b>"</b>')[0].firstChild)
  '&quot;'

Whilst browser such as chromium or firefox have:

> (new XMLSerializer()).serializeToString($('<b>"</b>')[0])
  '<b xmlns="http://www.w3.org/1999/xhtml">"</b>'
> (new XMLSerializer()).serializeToString($('<b>"</b>')[0].firstChild)
  '"'

Hence for IE9 and over, if in a `<t t-extend/>` a `t-jquery`
sub-directive (without `t-operation`) is available, we can have
broken javascript if a " is transformed into an &quot; at a unfortunate
location.

This commit favour node.data over XMLSerializer serializeToString to
avoid the possibility of this issue when a text node is processed.

opw-727283
2017-04-20 17:08:17 +02:00
Denis Ledoux cde8668034 [FIX] web: IE <= 11.0 doesn't support ChildNode.remove
IE 11.0 doesn't support `Childnode.remove`:
http://caniuse.com/#feat=childnode-remove

As a workaround, we use `Node.removeChild`,
which is more widely supported.

opw-710617
2017-03-06 18:21:06 +01:00
Fabien Meghazi 38ec6d7522 [FIX] qweb2.js: fix erratic object type detection in foreach (Fixes #15655)
Could not add a test as the qweb js testsuite is broken and it's xml
test files have been modified in order to test qweb.py specific cases.
2017-02-28 13:00:54 +01:00
Christophe Matthieu 0777af3e60 [IMP] qweb: Add extra condition branching (t-elif) (closes #3b3dbcd)
To have the same feature client and server side (t-elif was added in the qWeb client side)
2016-09-19 11:24:56 +02:00
Fabien Meghazi 75f60f6941 [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, ...
2016-09-09 18:03:08 +02:00
Christophe Matthieu 5aac400e33 [IMP] qweb: use CDATA in test and remove stringify_children method 2016-06-27 14:29:04 +02:00
Christophe Matthieu 15e1f88a73 [FIX] qweb: fix t-if and t-else and add test
Can not use remove with the loop for in (in _compile_directive_content)
2016-06-27 08:08:00 +02:00
Christophe Matthieu 956bb2b6e9 [IMP] base ir.qweb: add and update tests for the new ir.qweb 2016-06-14 09:46:25 +02:00
Géry Debongnie 06e583e1fd [FIX] web: change qweb to work around phantomjs bug
This commit does not actually fix qweb2.js, but it works around a
phantomjs bug.  The problem with phantomjs is that in some situations,
the xmlhttprequests are dropped with a status 0.  It is most likely
related to the issue:

    https://github.com/ariya/phantomjs/issues/11195

In our testing framework, it seems to appear when requests sent before
the 'load' event of phantomjs are received after, and also when those
requests are listened with the onreadystatechange handler.

The bug does not appear if we use addEventListener with the 'load' event (at
least, not for a few builds)

This commit does not worsen qweb, and it is also a small improvement in
style (in my opinion).
2016-01-26 14:22:56 +01:00
Richard Mathot c9c08adbd0 [FIX] qweb2.js: improve debugging 2016-01-05 09:27:51 +01:00
Christophe Simonis 56a442e205 [MERGE] forward port of branch saas-6 up to dade7e3 2015-11-25 13:26:02 +01:00
Denis Ledoux 32fd520d97 [MERGE] forward port of branch 8.0 up to 6f29cbe 2015-11-23 17:40:15 +01:00
Xavier Morel c6d6ae8aec [FIX] qweb: handle unicode tags and attributes
closes #8895
2015-11-19 14:59:44 +01:00
Christophe Matthieu 8f1bb1f72b [IMP] qweb2.js: display with console.debug the error message and the template name when the qweb try to compute a wrong template 2015-06-11 17:11:21 +02:00
Jeremy Kersten 4a698da8b3 [IMP] qweb: Allow to propagate value to variables outside the loop.
If the variable was existing outside the context of the ``foreach``,
the value is copied at the end of the foreach into the global context.

Fix #4461 - Q74531 - Q71486 - Q71675
2015-01-30 14:26:48 +01:00
Jeremy Kersten b2c0b4e9ed [IMP] qweb: Allow to propagate value to variables outside the loop.
If the variable was existing outside the context of the ``foreach``,
the value is copied at the end of the foreach into the global context.

Fix #4461 - Q74531 - Q71486 - Q71675
2015-01-30 14:09:02 +01:00
Christophe Simonis 4eb385fc0b [MERGE] forward port of branch 8.0 up to 0ec3c75 2015-01-23 14:57:07 +01:00
Aaron Bohy 629572cb76 [FIX] Web: qweb-test.js.html: use local copy of jquery and qunit
Use the local copy of those libraries instead of fetching them at runtime.
This fix was required for Debian packaging. It fixes the
privacy-breach-may-use-debian-package lintian error.
2015-01-23 11:11:27 +01:00
Richard Mathot 7b763176ba [REM] modelines: Gotta catch 'em all 2015-01-08 11:38:58 +01:00
Fabien Meghazi 75dfa9a356 [ADD] QWeb2: add support for operation='attributes' in a t-extend
Same syntax as server's position='attributes' on view inheritance
2014-10-16 10:25:57 +02:00
Xavier Morel b9fdb93bec [FIX] implementation of t-call's 0-index in qweb-js
Had expected regularity, had not noticed the Python version is really an
ignoble hack where the string "0" (exactly) is interpreted in a specific
manner when used in t-raw and format strings, *and nowhere else*.

Had special-cased the expression everywhere which broke e.g.
<t-set="xxx" t-value="0"/>. Reproduce Python behavior more closely,
and strongly consider swapping out both for something different e.g.
[[content]] or something like that, which doesn't cause problems in
Python but doesn't have to be so specially cased either.
2014-10-14 16:20:29 +02:00
Xavier Morel d5e3d121e3 [ADD] qweb: call directive's body
* __content__ can't be used in Python implementation because safe_eval, so use
  ``0`` from Python implementation instead
* remove postfix from t-call tests because due to implementation details all
  whitespace crap following a t-name is added to rendered template in Python
  impl, and don't want to normalize whitespace.
2014-10-06 19:13:45 +02:00
Xavier Morel 494dcbd0e3 [IMP] qweb doc, tests
* document qweb based (mostly) on JS version
* convert JS qweb tests to (mostly) language-independent XML so they can be
  used for JS and Python implementations
* add some more tests (e.g. precedence between t-value and body in t-set)
* remove ``t-import``
* fix parity in foreach(dict) (and rename some variables to make array and
  object versions more similar)
2014-10-06 19:13:43 +02:00
Xavier Morel bed6b01c53 [ADD] qweb-js: escf, rawf for parity with Python version 2014-10-06 19:13:42 +02:00
Xavier Morel 4fb49a67f3 [ADD] qweb-js: jinja-style interpolation pattern 2014-10-06 19:13:41 +02:00
Xavier Morel 35f5fb46e7 [IMP] qweb-js: reimplement string interpolation compilation as a single pass 2014-10-06 19:13:40 +02:00
Xavier Morel 9fe71a5d18 [IMP] update qweb-js tests
* latest qunit
* template loading (handle async)
* add format tests
2014-10-06 19:13:40 +02:00
Fabien Meghazi 4373f85773 [FIX] Do not self close empty elements that are not html void elements
bzr revid: fme@openerp.com-20140507121413-o7jqhexbm1wmitt6
2014-05-07 14:14:13 +02:00
Fabien Meghazi 84a840a38c [REM] Removed useless QWeb t-escf and t-rawf
bzr revid: fme@openerp.com-20140115182018-d7q3e6elm6uqh0ox
2014-01-15 19:20:18 +01:00
Fabien Meghazi 3ddeaee79c [MERGE] upstream
bzr revid: fme@openerp.com-20130814164422-l0h0ueue0fwk94uu
bzr revid: chm@openerp.com-20130828165815-a901l9gx66lj0pj1
bzr revid: fme@openerp.com-20130924125103-65bngr3rnm6k7u3a
2013-09-24 14:51:03 +02:00
niv-openerp 3210d02d8f [REVERT] reverted 3812 because it's an incorrect way to upgrade an external dependency of OpenERP
bzr revid: nicolas.vanhoren@openerp.com-20130819092940-9vqh5036p7rf2azv
2013-08-19 11:29:40 +02:00
Fabien Meghazi 81e028b791 [ADD] QWeb: add async api (backward compatible)
bzr revid: fme@openerp.com-20130814164322-cny24d0i6tg4ftvn
2013-08-14 18:43:22 +02:00
niv-openerp c8142aa421 Updated qweb
bzr revid: nicolas.vanhoren@openerp.com-20130731141139-7ssepci9vxnp9hpf
2013-07-31 16:11:39 +02:00
Fabien Meghazi 173a8b9d4d [FIX] QWeb: purge compiled template when template is added
bzr revid: fme@openerp.com-20121206132115-6fyedomrrchrxc43
2012-12-06 14:21:15 +01:00
Christophe Simonis 56ee9f011b [FIX] qweb: <t t-log> action was generating invalid code
bzr revid: chs@openerp.com-20121121155001-7gwb3w3mxqevxibm
2012-11-21 16:50:01 +01:00
Fabien Meghazi 8a7ccd3c76 [ADD] Add 'window' in QWeb reserved words
bzr revid: fme@openerp.com-20120925141558-zlj6f328oya3z5oy
2012-09-25 16:15:58 +02:00
Fabien Meghazi f2b5d602bc [ADD] QWeb2: added 'void' reserved keyword
bzr revid: fme@openerp.com-20120521114038-tz48ac3cgg8zjmti
2012-05-21 13:40:38 +02:00
Fabien Meghazi f12e598b59 [FIX] QWeb2: Array-like character access in String is not supported in IE<8
bzr revid: fme@openerp.com-20120213144234-dtdw5e8ho4x85frj
2012-02-13 15:42:34 +01:00
Fabien Meghazi ce65bc3ac3 [IMP] Add QWeb preprocess_node callback. Translate @label, @title and @alt attributes in web client
bzr revid: fme@openerp.com-20120207132901-ifwnfj6c4mp451tl
2012-02-07 14:29:01 +01:00
Fabien Meghazi 8abe9402e2 [REM] QWeb: removed xpath support
bzr revid: fme@openerp.com-20120201132217-h2i9a3g082i9ui9y
2012-02-01 14:22:17 +01:00