From 2dcd8c8566df71fef03b16b9d0b0d94397ee73a6 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Fri, 26 Oct 2018 14:17:00 +0000 Subject: [PATCH] [REF] web, *: review the assets helpers organization * survey, website_slides While not changing their name or their amount, this commit reorganizes the assets helpers to: Avoid all file duplicates in different helpers ---------------------------------------------- Before, we had to put some files in different helpers, like our bootstrap mixin overrides which were in the _assets_utils template and in the _assets_bootstrap template. Enforce the use of an helper when using bootstrap ------------------------------------------------- Bootstrap functions, variables and mixins are now out of the _assets_bootstrap template, which now only contains bootstrap css rules and our bootstrap fixes and extensions. Allow using the correct bootstrap utils in all assets ----------------------------------------------------- In some assets (especially editor ones), we may want to use bootstrap variables even though bootstrap is not included in those. This worked before but using *default* bootstrap variables. Now, our overrides can be properly included if necessary. Note: this commit may also be a first step to allow for backend bootstrap and frontend bootstrap to co-exist. closes odoo/odoo#28204 --- addons/survey/views/assets.xml | 6 +++-- ...strap_part2.scss => import_bootstrap.scss} | 13 ++++++---- .../src/scss/import_bootstrap_part1.scss | 11 -------- addons/web/views/report_templates.xml | 7 +++--- addons/web/views/webclient_templates.xml | 25 ++++++++++--------- addons/website_slides/views/assets.xml | 4 +-- 6 files changed, 31 insertions(+), 35 deletions(-) rename addons/web/static/src/scss/{import_bootstrap_part2.scss => import_bootstrap.scss} (60%) delete mode 100644 addons/web/static/src/scss/import_bootstrap_part1.scss diff --git a/addons/survey/views/assets.xml b/addons/survey/views/assets.xml index 099877c34d6..93bfedf1b49 100644 --- a/addons/survey/views/assets.xml +++ b/addons/survey/views/assets.xml @@ -11,7 +11,9 @@ - + + + @@ -27,4 +29,4 @@ - \ No newline at end of file + diff --git a/addons/web/static/src/scss/import_bootstrap_part2.scss b/addons/web/static/src/scss/import_bootstrap.scss similarity index 60% rename from addons/web/static/src/scss/import_bootstrap_part2.scss rename to addons/web/static/src/scss/import_bootstrap.scss index c15793019ad..d3d033a3575 100644 --- a/addons/web/static/src/scss/import_bootstrap_part2.scss +++ b/addons/web/static/src/scss/import_bootstrap.scss @@ -1,11 +1,14 @@ // This file is importing bootstrap. While a simple "import "bootstrap";" -// should be enough, this does not allow overridding mixins. Overridding mixins -// is necessary for some of our need and allow to generate more efficient CSS -// than adding more rules. This file instead copies the second part of the -// content of the "bootstrap.scss" files to allow adding mixin overrides in -// between. +// should be enough, this does not allow overridding mixins/functions. +// Overridding those is necessary for some of our need and allow to generate +// more efficient CSS than adding more rules. This file instead copies the +// content of the "bootstrap.scss" files but do not import functions, variables +// and mixins which will be handled "by hand" in _assets_helpers. +// @import "functions"; +// @import "variables"; +// @import "mixins"; @import "root"; @import "reboot"; @import "type"; diff --git a/addons/web/static/src/scss/import_bootstrap_part1.scss b/addons/web/static/src/scss/import_bootstrap_part1.scss deleted file mode 100644 index 09f4d3579ac..00000000000 --- a/addons/web/static/src/scss/import_bootstrap_part1.scss +++ /dev/null @@ -1,11 +0,0 @@ - -// This file is importing bootstrap. While a simple "import "bootstrap";" -// should be enough, this does not allow overridding mixins. Overridding mixins -// is necessary for some of our need and allow to generate more efficient CSS -// than adding more rules. This file instead copies the first part of the -// content of the "bootstrap.scss" files to allow adding mixin overrides in -// between. - -@import "functions"; -@import "variables"; -@import "mixins"; diff --git a/addons/web/views/report_templates.xml b/addons/web/views/report_templates.xml index 7cd5b04a01f..b33f89cd929 100644 --- a/addons/web/views/report_templates.xml +++ b/addons/web/views/report_templates.xml @@ -3,10 +3,11 @@