Open rvalyi opened 8 years ago
note, you can see the Javascript implementation of Odoo here (they implemented qweb both in Javascript and Python but the Python inheritance system is a bit older and probably more clumsy to understand): https://github.com/OpenERP/qweb/blob/master/qweb2.js#L411
Hello @did,
Something that seems both easy and extremely useful to borrow from Odoo templating system: more option when inheriting a template ( https://github.com/locomotivecms/steam/blob/master/lib/locomotive/steam/liquid/tags/inherited_block.rb )
See the "t-operation" attribute in the Odooqweb inheritance block at in the "template inheritance" section here: https://www.odoo.com/documentation/8.0/reference/qweb.html
append
the node's body is appended at the end of the context node (after the context node's last child)
prepend
the node's body is prepended to the context node (inserted before the context node's first child)
before
the node's body is inserted right before the context node
after
the node's body is inserted right after the context node
inner
the node's body replaces the context node's children
replace
the node's body is used to replace the context node
These were initially inspire by Django template inheritance system I believe. They made the success of the Odoo ERP and were kept in their web templating system.
I believe this is easy to implement, this should just determine were the content is inserted instead of always replacing the inherited block as it is by default. May be some care should be taken with the enclosing HTML markup of the inherited block.
What do you think?
cc @sebastienbeau