diff options
| author | qsm-odoo <qsm@odoo.com> | 2018-03-12 16:24:31 +0100 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2018-04-18 15:59:19 +0200 |
| commit | 6e4db7d13a926845bf82f5b035afede42d6d5a89 (patch) | |
| tree | a9804dbe2b2844faff9359560102d222d0e37654 /addons/web/static/src/scss/variables.scss | |
| parent | fbfd0119041ca7dc830796e76d9ae5c303459d4f (diff) | |
[REF] *: review scss variables handling
Unlike LESS, SCSS variables are not lazy loaded. Our system has thus
to be updated. This commit creates new templates which are t-called
in assets bundles (to replace the old less_helpers template):
- web._assets_utils: regroups the mixins and functions which *can*
(and so should) be available in every asset bundle
- web._assets_primary_variables: regroups the variables (or mixins
used as variables) which *can* (and so should) be available in
every asset bundle
- web._assets_secondary_variables: same as above but provides an
environnement where all the 'primary' ones are accessible. This is
for example useful to handle the community/enterprise split:
// Community primary variables
$o-pink-color: pink; // enterprise color
$o-brand-primary: blue;
// Enterprise primary variables
$o-brand-primary: $o-pink-color;
// Community secondary variables
$o-my-darker-primary: darken($o-brand-primary, 5%);
=> If there was only one variable template, enterprise edition would
have been able to define its primary color at the end but the
darker primary would not have been updated. Using the "!default"
system and putting enterprise definition above would not have
solved the problem as the $o-pink-color would not have been
accessible.
- web._assets_backend_helpers: regroups the variables, mixins and
functions which *can* (and so should) be available in the backend
asset bundle only. This is especially (only?) useful for bootstrap
variables overriddes.
- web._assets_frontend_helpers: regroups the variables, mixins and
functions which *can* (and so should) be available in the frontend
asset bundle only. This is especially (only?) useful for bootstrap
variables overriddes.
Note: bootstrap variables are not accessible in any of those anymore.
If you have variables that should depend on bootstrap, you have 3
solutions:
- Find another way: your variable is probably useless, use bootstrap
variables directly or create a variable that will influence the
value of bootstrap variables. E.g. instead of declaring:
`$myvar: $bootstrapvar * 3`
and using $myvar alone, declare:
`$myvar: 3` and use `$myvar * $bootstrapvar` where needed.
- Declare a copy of the bootstrap variable and use that one. In that
case, you should also force-set the real bootstrap one to be sure
they match (this should be done in appropriate templates mentioned
above). E.g.
```
$o-boostrapvar: 5;
...
$boostrapvar: $o-bootstrapvar;
```
- Set your variable to null and set it to your bootstrap expression
in the file you will need it (where bootstrap variables are accessible)
without forgetting to add the !default flag to allow overriddes.
```
$myvar: null;
...
$myvar: $bootstrapvar * 5 !default;
```
This commit also partly changes the variable names to follow the
convention:
$o-<app_id>-<name> where 'app_id' is the current's app name or a
meaningful unique identifier ("theme" for all themes for example, as
no multiple themes can be installed).
Diffstat (limited to 'addons/web/static/src/scss/variables.scss')
| -rw-r--r-- | addons/web/static/src/scss/variables.scss | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/addons/web/static/src/scss/variables.scss b/addons/web/static/src/scss/variables.scss deleted file mode 100644 index 20180488042..00000000000 --- a/addons/web/static/src/scss/variables.scss +++ /dev/null @@ -1,82 +0,0 @@ -/// -/// This file regroups the variables that style odoo components. -/// They are available in every asset bundle. -/// - -// Font sizes -$odoo-font-size-base: 13px; - -// Colors -$odoo-brand-primary: #7c7bad; -$odoo-brand-optional: #7c7bad; -$odoo-brand-secondary: #f0eeee; -$odoo-brand-lightsecondary: #e2e2e0; -$odoo-color-silver: #F9F9F9; -$odoo-color-silver-dark: #E5E5E5; -$odoo-color-silver-darker: #d9d7d7; - -// Define $gray-lighter-dark as a minor bootstrap $gray-lighter variation used -// for design purposes only (e.g. cards' borders). We avoid to overwrite the -// default $gray-light because it is deeply used by bootstrap to define muted -// elements. -$gray-lighter-dark: $odoo-color-silver-dark; -$gray-lighter-darker: $odoo-color-silver-darker; - -$odoo-color-pink: #875A7B; // Enterprise $odoo-brand-primary -$odoo-main-color-muted: #a8a8a8; -$odoo-main-text-color: #4c4c4c; - -$odoo-view-background-color: white; -$odoo-shadow-color: #303030; - -$odoo-webclient-background-color: $odoo-color-silver; -$odoo-control-panel-background-color: $odoo-color-silver; -$odoo-form-lightsecondary: #ccc; - -$odoo-list-footer-color: $odoo-main-text-color; -$odoo-list-footer-bg-color: #eee; -$odoo-list-footer-font-weight: bold; - -$odoo-tooltip-background-color: black; -$odoo-tooltip-color: white; -$odoo-tooltip-arrow-color: black; -$odoo-tooltip-text-color: #777777; -$odoo-tooltip-title-text-color: #4c4c4c; - -// UI custom colors for tags, kanban records' colors, ...) -$odoo-nb-ui-color: 12; -$odoo-colors: $gray-light, #F06050, #F4A460, #F7CD1F, #6CC1ED, #814968, - #EB7E7F, #2C8397, #475577, #D6145F, #30C381, #9365B8; - -// Layout -$screen-xs-min: 475px; -$screen-xxs-max: ($screen-xs-min - 1); - -$screen-xl-min: 1534px; -$screen-lg-max: ($screen-xl-min - 1); - -$odoo-form-group-cols: 12; -$odoo-form-spacing-unit: 5px; -$odoo-horizontal-padding: 16px; -$odoo-innergroup-rpadding: 45px; -$odoo-dropdown-hpadding: 20px; - -$border-radius-base: 3px; - -$odoo-sheet-vpadding: 24px; - -// Needed for having no spacing between sheet and mail body in mass_mailing: -// Different required cancel paddings between web and web_enterprise -$odoo-sheet-cancel-tpadding: 0px; -$odoo-sheet-cancel-hpadding: $odoo-horizontal-padding; -$odoo-sheet-cancel-bpadding: $odoo-horizontal-padding; - -$odoo-avatar-size: 90px; - -$odoo-statusbar-height: 33px; -$odoo-statusbar-arrow-width: $odoo-statusbar-height/3; -$odoo-statusbar-disabled-bg: lighten($odoo-brand-lightsecondary, 7%); - -$odoo-label-font-size-factor: 0.8; -$odoo-navbar-height: 34px; -$odoo-navbar-inverse-link-hover-bg: $navbar-inverse-link-active-bg; |
