diff options
| author | Aaron Bohy <aab@odoo.com> | 2020-04-29 07:21:32 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2020-05-05 08:48:34 +0000 |
| commit | 56787d587858760355e6703f1afce54a66f7800f (patch) | |
| tree | 06627b0330690c06453edf38fab58565fef8703d /addons/web/static/src/js/views/basic | |
| parent | a1d3e224d874dcee966b2df97f24605e816d40d4 (diff) | |
[REF] web: field decoration
This commit refactors the way the decoration-xxx attributes are
applied to field widgets/components, in a way that it can be
overridden in a given field or component to generate the approriate
className. By default, 'decoration-x' applies className 'text-x'.
This will be necessary for the new 'FieldBadge' component, which
needs to apply 'bg-x' classNames instead of 'text-x'.
Part of task 2195254
Diffstat (limited to 'addons/web/static/src/js/views/basic')
| -rw-r--r-- | addons/web/static/src/js/views/basic/basic_view.js | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_view.js b/addons/web/static/src/js/views/basic/basic_view.js index 676c1225810..f1e093e0479 100644 --- a/addons/web/static/src/js/views/basic/basic_view.js +++ b/addons/web/static/src/js/views/basic/basic_view.js @@ -232,11 +232,10 @@ var BasicView = AbstractView.extend({ // process decoration attributes _.each(attrs, function (value, key) { - var splitKey = key.split('-'); - if (splitKey[0] === 'decoration') { + if (key.startsWith('decoration-')) { attrs.decorations = attrs.decorations || []; attrs.decorations.push({ - className: 'text-' + splitKey[1], + name: key, expression: pyUtils._getPyJSAST(value), }); } |
