[FIX] web_editor, *: review assets organisation

* mass_mailing, point_of_sale, website

- Lib files were included twice
- Variables files were split but added multiple times in the same assets
  bundle
- Useless assets templates were defined or split
- ...

Part of https://github.com/odoo/odoo/pull/36068
Related to task-1942370
This commit is contained in:
qsm-odoo
2019-08-28 09:04:25 +00:00
parent 7acb22a5e5
commit b47f097feb
7 changed files with 51 additions and 66 deletions
+1 -3
View File
@@ -24,9 +24,7 @@
</template>
<template id="assets_mail_themes_edition"> <!-- maybe to remove and convert into a field dumy with attr invisible if the template is not selected -->
<t t-call="web._assets_helpers">
<link rel="stylesheet" type="text/scss" href="/web_editor/static/src/scss/wysiwyg_variables.scss"/>
</t>
<t t-call="web._assets_helpers"/>
<link rel="stylesheet" type="text/scss" href="/mass_mailing/static/src/scss/mass_mailing.ui.scss"/>
<link rel="stylesheet" type="text/scss" href="/web/static/src/scss/webclient.scss"/>
</template>
+1 -1
View File
@@ -75,7 +75,7 @@
</script>
</template>
<template id="pos_editor_assets" inherit_id="web_editor.wysiwyg_snippets">
<template id="pos_editor_assets" inherit_id="web_editor.assets_wysiwyg">
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/point_of_sale/static/src/js/pos.web_editor.js"/>
</xpath>
@@ -23,9 +23,6 @@ Wysiwyg.include({
init: function (parent, options) {
this._super.apply(this, arguments);
if (this.options.inIframe) {
if (!this.options.iframeCssAssets) {
this.options.iframeCssAssets = 'web_editor.wysiwyg_iframe_css_assets';
}
this._onUpdateIframeId = 'onLoad_' + this.id;
}
},
@@ -133,4 +130,4 @@ Wysiwyg.include({
},
});
});
});
@@ -48,6 +48,29 @@ $o-checklist-margin-left: 20px;
$o-checklist-checkmark-width: 2px;
$o-checklist-before-size: 13px;
$o-wysiwyg-zindex: 1000;
$o-wysiwyg-md-ease: cubic-bezier(0.19, 1, 0.22, 1) !default;
$o-wysiwyg-font-family: Roboto,
"Montserrat",
"Segoe UI",
"Helvetica Neue",
Helvetica,
Arial,
sans-serif;
$o-wysiwyg-toolbar-height: 32px;
$o-wysiwyg-color: #212629 !default;
$o-wysiwyg-color-light: #616669 !default;
$o-wysiwyg-color-danger: #912629 !default;
$o-wysiwyg-color-success: #219629 !default;
$o-wysiwyg-bg-color: #f7f7f7 !default;
$o-wysiwyg-bg-color-dark: #a7a7a7 !default;
$o-wysiwyg-border-color: #a9a9a9 !default;
// ============ 'Preview' component Mixins ===============
// Create a "preview" work-area to edit/customize specific elements
@@ -66,6 +89,26 @@ $o-checklist-before-size: 13px;
box-shadow: 0 0 15px 2px #000;
}
// Mixins for buttons with alpha bg-color
@mixin o-alpha-button-preview {
position: relative;
z-index: 1;
// Place an overlay that inherit the button's bg-color.
&::before {
content: "";
@include o-position-absolute(0, 0, 0, 0);
background-color: inherit;
}
&::after {
content: "";
@include o-position-absolute(0, 0, 0, 0);
z-index: -1;
background-image: url('/web_editor/static/src/img/transparent.png');
background-size: 10px auto;
}
}
// ============ Preservation mixins ===============
// Used to preserve web_editor and website UI from themes customizations
@@ -1,42 +0,0 @@
// Mixins for buttons with alpha bg-color
@mixin o-alpha-button-preview {
position: relative;
z-index: 1;
// Place an overlay that inherit the button's bg-color.
&::before {
content: "";
@include o-position-absolute(0, 0, 0, 0);
background-color: inherit;
}
&::after {
content: "";
@include o-position-absolute(0, 0, 0, 0);
z-index: -1;
background-image: url('/web_editor/static/src/img/transparent.png');
background-size: 10px auto;
}
}
$o-wysiwyg-zindex: 1000;
$o-wysiwyg-md-ease: cubic-bezier(0.19, 1, 0.22, 1) !default;
$o-wysiwyg-font-family: Roboto,
"Montserrat",
"Segoe UI",
"Helvetica Neue",
Helvetica,
Arial,
sans-serif;
$o-wysiwyg-toolbar-height: 32px;
$o-wysiwyg-color: #212629 !default;
$o-wysiwyg-color-light: #616669 !default;
$o-wysiwyg-color-danger: #912629 !default;
$o-wysiwyg-color-success: #219629 !default;
$o-wysiwyg-bg-color: #f7f7f7 !default;
$o-wysiwyg-bg-color-dark: #a7a7a7 !default;
$o-wysiwyg-border-color: #a9a9a9 !default;
+5 -15
View File
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="wysiwyg_iframe_css_assets" name="CSS assets for wysiwyg iframe content">
</template>
<template id="wysiwyg_iframe_editor_assets" name="Editor assets for wysiwyg iframe content">
<t t-call-assets="web.assets_common"/>
<t t-call-assets="web.assets_frontend" t-js="false"/>
@@ -27,7 +24,6 @@
<t t-call="web._assets_helpers">
<link rel="stylesheet" type="text/scss" href="/web_editor/static/src/scss/bootstrap_overridden.scss"/>
<link rel="stylesheet" type="text/scss" href="/web_editor/static/src/scss/wysiwyg_variables.scss"/>
</t>
<!-- integration -->
@@ -35,6 +31,8 @@
<link rel="stylesheet" type="text/scss" href="/web_editor/static/src/scss/wysiwyg.scss"/>
<link rel="stylesheet" type="text/scss" href="/web_editor/static/src/scss/wysiwyg_iframe.scss"/>
<link rel="stylesheet" type="text/scss" href="/web_editor/static/src/scss/wysiwyg_snippets.scss"/>
<script type="text/javascript" src="/web_editor/static/src/js/wysiwyg/fonts.js"/>
<script type="text/javascript" src="/web_editor/static/lib/nearest/jquery.nearest.js"/>
<script type="text/javascript" src="/web_editor/static/src/js/base.js"/>
@@ -54,6 +52,9 @@
<script type="text/javascript" src="/web_editor/static/src/js/wysiwyg/widgets/media_dialog.js"/>
<script type="text/javascript" src="/web_editor/static/src/js/wysiwyg/widgets/widgets.js"/>
<script type="text/javascript" src="/web_editor/static/src/js/editor/snippets.editor.js"/>
<script type="text/javascript" src="/web_editor/static/src/js/editor/snippets.options.js"/>
<!-- Launcher -->
<script type="text/javascript" src="/web_editor/static/src/js/wysiwyg/wysiwyg.js"/>
@@ -113,20 +114,9 @@
<link rel="stylesheet" type="text/css" href="/web_editor/static/lib/summernote/src/css/summernote.css"/>
</template>
<template id="wysiwyg_snippets" inherit_id="web_editor.assets_wysiwyg" name="Wysiwyg Editor additional snippets">
<xpath expr="script[@src='/web_editor/static/src/js/editor/rte.summernote.js']" position="after">
<link rel="stylesheet" type="text/scss" href="/web_editor/static/src/scss/wysiwyg_snippets.scss"/>
<script type="text/javascript" src="/web_editor/static/lib/nearest/jquery.nearest.js"/>
<script type="text/javascript" src="/web_editor/static/src/js/editor/snippets.editor.js"/>
<script type="text/javascript" src="/web_editor/static/src/js/editor/snippets.options.js"/>
</xpath>
</template>
<template id="_assets_primary_variables" inherit_id="web._assets_primary_variables">
<xpath expr="//link[last()]" position="after">
<link rel="stylesheet" type="text/scss" href="/web_editor/static/src/scss/web_editor.variables.scss"/>
<link rel="stylesheet" type="text/scss" href="/web_editor/static/src/scss/wysiwyg_variables.scss"/>
</xpath>
</template>
@@ -91,7 +91,6 @@
<template id="website.assets_wysiwyg" name="Website Editor Assets (used in website editor)">
<t t-call="web._assets_helpers">
<link rel="stylesheet" type="text/scss" href="/web_editor/static/src/scss/bootstrap_overridden.scss"/>
<link rel="stylesheet" type="text/scss" href="/web_editor/static/src/scss/wysiwyg_variables.scss"/>
</t>
<link rel="stylesheet" type="text/scss" href="/website/static/src/scss/website.wysiwyg.scss"/>
<link rel="stylesheet" type="text/scss" href="/website/static/src/scss/website.editor.ui.scss"/>