diff options
| author | qsm-odoo <qsm@odoo.com> | 2018-04-18 16:14:28 +0200 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2018-04-18 16:14:28 +0200 |
| commit | e41bcb0e311bfa67c78a13e377ae5c4931ecf24e (patch) | |
| tree | 1bd69ec3142313684ee089d632fd9394f6f2fd16 /addons/web/static/src/js/views/basic/basic_renderer.js | |
| parent | 5ea27d471e3c4458361b2fc9862e9a4474b1278b (diff) | |
| parent | 16ddf4ae541e88bbd9ee0e40672d119b07922563 (diff) | |
[MERGE] *: use SCSS as language for design (instead of LESS)
The main reason this is done is to prepare the migration to bootstrap 4.
It has other advantages though, like speed to compute the css and more
convenient language features (if/else/maps/...).
Detailed information about this merge can be found in the merge's
sub-commits.
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_renderer.js')
| -rw-r--r-- | addons/web/static/src/js/views/basic/basic_renderer.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_renderer.js b/addons/web/static/src/js/views/basic/basic_renderer.js index 80cdd05bff5..c05d467052e 100644 --- a/addons/web/static/src/js/views/basic/basic_renderer.js +++ b/addons/web/static/src/js/views/basic/basic_renderer.js @@ -356,6 +356,9 @@ var BasicRenderer = AbstractRenderer.extend({ * @param {Object} node */ _handleAttributes: function ($el, node) { + if ($el.is('button')) { + return; + } if (node.attrs.class) { $el.addClass(node.attrs.class); } @@ -515,6 +518,35 @@ var BasicRenderer = AbstractRenderer.extend({ }); }, /** + * Renders a button according to a given node element. + * + * @private + * @param {Object} node + * @param {Object} [options] + * @param {string} [options.extraClass] + * @param {boolean} [options.textAsTitle=false] + * @returns {jQuery} + */ + _renderButtonFromNode: function (node, options) { + var btnOptions = { + attrs: _.omit(node.attrs, 'icon', 'string', 'type', 'name', 'attrs', 'modifiers', 'options'), + icon: node.attrs.icon, + }; + if (options && options.extraClass) { + var classes = btnOptions.attrs.class ? btnOptions.attrs.class.split(' ') : []; + btnOptions.attrs.class = _.uniq(classes.concat(options.extraClass.split(' '))).join(' '); + } + var str = (node.attrs.string || '').replace(/_/g, ''); + if (str) { + if (options && options.textAsTitle) { + btnOptions.attrs.title = str; + } else { + btnOptions.text = str; + } + } + return dom.renderButton(btnOptions); + }, + /** * Instantiates the appropriate AbstractField specialization for the given * node and prepares its rendering and addition to the DOM. Indeed, the * rendering of the widget will be started and the associated deferred will |
