Files
odoo_source/addons/mail/views/discuss_public_templates.xml
T
Gorash 5410b7c238 [IMP] base/web: XML templates are added into the asset bundles.
XML files are now declared in python module manifests. During the qweb
't-call-asset' directive, assetbundle will fetch the declared xml files,
apply the inheritance (t-inherit) and create a javascript service (for
eg: 'web.assets_backend.bundle.xml') which is added at the end of the
*.js mimifier file.

When the debug mode is activated, comments are added in the template
indicating which file the template comes from as well as the
inheritances applied to it.

****

JavaScript:

assets.js (module @web/core/assets) takes care of loading libraries,
javascripts and styles.
`loadJS(url)` (loads the javascript and returns a resolved promise when
the templates are also loaded via the '*.bundle.xml' service)
`loadCSS(url)` (loads the style a resolved promise when the file is
loaded)
`loadXML(xml, app=assets.defaultApp)` (load template into
application/owl, used by the `*.bundle.xml` services)
`getBundle(bundleName)` (get the bundle descriptor)
`loadBundle(desc)` (load the files and bundle from a descriptor)

templates (XML element content all owl templates)

A new `ready(serviceName)` method on boot.js lets you know when a
service is loaded are the require.

The xmlDependencies attribute no longer exists.

Python:

The xmls taken into account by assetbundle.py, applying `t-inherit`
inheritances and adding an `name_of_the_bundle.bundle.xml` service in
the generated JavaScript file.

****

Every manifest changes is into the next commit, except 'web_tour' in
this current commit as example.

Part-of: odoo/odoo#95500
2022-09-14 20:25:01 +02:00

55 lines
2.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="mail.discuss_public_layout">&lt;!DOCTYPE html&gt;
<html class="h-100">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<title t-esc="title or 'Odoo'"/>
<link type="image/x-icon" rel="shortcut icon" t-att-href="x_icon or '/web/static/img/favicon.ico'"/>
<script>
window.odoo = {
__session_info__: <t t-out="json.dumps(session_info)"/>,
csrf_token: "<t t-out="request.csrf_token(None)"/>",
debug: "<t t-out="debug"/>",
};
{
const { user_context, cache_hashes } = odoo.__session_info__;
fetch(`/web/webclient/translations/${cache_hashes.translations}?lang=${user_context.lang}`);
}
</script>
<t t-call-assets="mail.assets_common_discuss_public"/>
<t t-call-assets="mail.assets_discuss_public"/>
<t t-call-assets="mail.assets_discuss_public_test_tours" t-if="'tests' in debug or test_mode_enabled"/>
<t t-out="head or ''"/>
</head>
<body class="d-flex flex-column h-100">
<t t-out="body or ''"/>
</body>
</html>
</template>
<template id="mail.discuss_public_channel_template" name="Discuss Public Channel Template">
<t t-call="mail.discuss_public_layout">
<t t-set="head">
<style>
body {
direction: <t t-out="env['res.lang']._lang_get(lang or env.user.lang).direction or 'ltr'" />;
}
</style>
<script>
odoo.define('mail.discuss_public_channel_template', function() {
return {
data: <t t-out="json.dumps(data)"/>,
};
});
</script>
</t>
</t>
</template>
</odoo>