[FIX] web_editor: restore backend colors

Commit https://github.com/odoo/odoo/commit/52ec536cef2ec84af0b36746f19a8cdf9f23fe2a
made a mistake which made the backend use the website colors. This is
because the web_editor app adds its bootstrap_overridden.scss file in
both backend and frontend assets as the backend needs the editor colors
(alpha, beta, ...). However, the 'primary', 'secondary', etc that the
backend customizes should not be overridden by the web_editor. Therefore
the file contained a hack to determine if it is the backend or not...
hack which did not work anymore with the new system the mentioned
commit implements.

Also some comments were not adapted correctly by the mentioned commit.

closes odoo/odoo#29935
This commit is contained in:
qsm-odoo
2019-01-04 11:27:07 +00:00
parent c2c5785940
commit 70f35620ba
4 changed files with 10 additions and 16 deletions
+4 -16
View File
@@ -1,6 +1,3 @@
// Hacky way to detect if its the backend or not
$-is-backend: variable-exists('primary');
// Use auto threshold for yiq colors
$yiq-contrasted-threshold: false !default;
@@ -9,22 +6,13 @@ $colors: () !default;
$colors: map-merge($o-color-palette, $colors);
// Automatically extend bootstrap to create theme background/text/button classes
$-palette: $o-theme-color-palette;
@if $-is-backend {
$-palette: map-remove($-palette, 'primary', 'secondary', 'success', 'info', 'warning', 'danger', 'light', 'dark');
}
$theme-colors: () !default;
$theme-colors: map-merge($-palette, $theme-colors);
$theme-colors: map-merge($o-theme-color-palette, $theme-colors);
// Extend grays with transparent ones (for some reason, BS4 create black-50 and
// white-50 but does not allow overridding that with variables), also use the
// theme gray palette (which is supposed to at least declare white and black).
$-palette: $o-gray-color-palette;
@if $-is-backend {
$-palette: map-remove($-palette, '100', '200', '300', '400', '500', '600', '700', '800', '900');
}
// Automatically extend bootstrap gray palette (the theme palette is supposed to
// at least declare white and black)
$grays: () !default;
$grays: map-merge($-palette, $grays);
$grays: map-merge($o-gray-color-palette, $grays);
// Bootstrap use standard variables to define individual colors which are then
// placed into a map which is then used to get the value of each individual
@@ -0,0 +1,3 @@
$o-theme-color-palette: map-remove($o-theme-color-palette, 'primary', 'secondary', 'success', 'info', 'warning', 'danger', 'light', 'dark');
$o-gray-color-palette: map-remove($o-gray-color-palette, '100', '200', '300', '400', '500', '600', '700', '800', '900');
@@ -30,6 +30,8 @@ $o-theme-color-palette: map-merge((
}
// Gray colors
// Extend grays with transparent ones (for some reason, BS4 create black-50 and
// white-50 but does not allow overridding that with variables).
$o-gray-color-palette: nth($o-gray-color-palettes, $o-gray-color-palette-number) !default;
$o-gray-color-palette: map-merge($o-transparent-grays, $o-gray-color-palette);
@function palette-gray($key) {
+1
View File
@@ -74,6 +74,7 @@
<template id="_assets_backend_helpers" inherit_id="web._assets_backend_helpers">
<xpath expr="//link" position="before">
<link rel="stylesheet" type="text/scss" href="/web_editor/static/src/scss/bootstrap_overridden_backend.scss"/>
<link rel="stylesheet" type="text/scss" href="/web_editor/static/src/scss/bootstrap_overridden.scss"/>
</xpath>
</template>