summaryrefslogtreecommitdiff
path: root/addons/web/static/src/scss
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2020-07-08 12:56:40 +0000
committerqsm-odoo <qsm@odoo.com>2020-07-09 18:09:59 +0000
commit7be1429656af3c96ac30caed28a27f5b9590009f (patch)
tree57ffa777265c75b052a3e18e31b80bfcc251d936 /addons/web/static/src/scss
parent3a34e39caa8544059dfb1888edc29c62c3efde31 (diff)
[REF] website, *: review how available fonts are defined in scss
*: web, web_editor Instead of three lists + one map to define font information and user choices saved as the index of the related fonts in those lists, the fonts are now stored in an unique map <font-name> -> <data> and the user choices are saved as the font name. This allow to have a visually better definition of the fonts and allows to reorder fonts in the UI without losing user customization (and actually simplify some code). Unfortunately any user font customization < 14.0 will be lost, but this is a small price to pay (users can still rechoose the same font in the editor UI where they will go anyway to discover all the new shiny features we are introducing there). Part of https://github.com/odoo/odoo/pull/54065 task-2291398 closes odoo/odoo#54065 Related: odoo/design-themes#269 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web/static/src/scss')
-rw-r--r--addons/web/static/src/scss/utils.scss14
1 files changed, 14 insertions, 0 deletions
diff --git a/addons/web/static/src/scss/utils.scss b/addons/web/static/src/scss/utils.scss
index a3b41471777..cdba348e36b 100644
--- a/addons/web/static/src/scss/utils.scss
+++ b/addons/web/static/src/scss/utils.scss
@@ -242,6 +242,20 @@
@return set-nth($list, $j, $tmp);
}
+// Function to get an element of a list with a default value in case the index
+// is out-of-bounds; also return that value if the retrieved value is null.
+@function o-safe-nth($list, $index, $default: null) {
+ $value: if($index > 0 and $index <= length($list), nth($list, $index), null);
+ @return if($value != null, $value, $default);
+}
+
+// Function to get an element of a map with a default value in case the key
+// does not exist; also return that value if the retrieved value is null.
+@function o-safe-get($map, $key, $default: null) {
+ $value: map-get($map, $key);
+ @return if($value != null, $value, $default);
+}
+
// ------- Kanban grouped mixins -------
@mixin o-kanban-icon($base-opacity: 0.5) {
display: block;