summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/core
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2018-02-16 14:54:40 +0100
committerqsm-odoo <qsm@odoo.com>2018-04-18 14:47:42 +0200
commite88913bd28379206f1a21cfc3934360a3008a066 (patch)
tree782b8dbe9f68d05ca0a365697aa11b2c4a42f86e /addons/web/static/src/js/core
parent374af562e86d8f534665ff793478f7a8b0f4ede2 (diff)
[IMP] web, *: do not use 'oe_highlight' and 'oe_link' class in the DOM
* test_main_flows The style of a primary/link button is given by the 'btn-primary'/'btn-link' class. The old 'oe_highlight'/'oe_link' class should still be supported in views but not rendered in the DOM.
Diffstat (limited to 'addons/web/static/src/js/core')
-rw-r--r--addons/web/static/src/js/core/dialog.js18
-rw-r--r--addons/web/static/src/js/core/dom.js7
2 files changed, 15 insertions, 10 deletions
diff --git a/addons/web/static/src/js/core/dialog.js b/addons/web/static/src/js/core/dialog.js
index 5ba24f57cad..7d4796886b7 100644
--- a/addons/web/static/src/js/core/dialog.js
+++ b/addons/web/static/src/js/core/dialog.js
@@ -158,9 +158,9 @@ var Dialog = Widget.extend({
/**
* Show a dialog
- *
+ *
* @param {Object} options
- * @param {boolean} options.shouldFocusButtons if true, put the focus on
+ * @param {boolean} options.shouldFocusButtons if true, put the focus on
* the first button primary when the dialog opens
*/
open: function (options) {
@@ -194,7 +194,7 @@ var Dialog = Widget.extend({
if (this.isDestroyed()) {
return;
}
- var isFocusSet = this._focusOnClose();
+ var isFocusSet = this._focusOnClose();
this._super();
@@ -214,7 +214,7 @@ var Dialog = Widget.extend({
}
},
/**
- * adds the keydown behavior to the dialogs after external files modifies
+ * adds the keydown behavior to the dialogs after external files modifies
* its DOM.
*/
rebindButtonBehavior: function () {
@@ -226,7 +226,7 @@ var Dialog = Widget.extend({
/**
* Manages the focus when the dialog closes. The default behavior is to set the focus on the top-most opened popup.
* The goal of this function is to be overridden by all children of the dialog class.
- *
+ *
* @returns: boolean should return true if the focus has already been set else false.
*/
_focusOnClose: function() {
@@ -237,7 +237,7 @@ var Dialog = Widget.extend({
//--------------------------------------------------------------------------
/**
* Moves the focus to the first button primary in the footer of the dialog
- *
+ *
* @private
* @param {odooEvent} e
*/
@@ -250,17 +250,17 @@ var Dialog = Widget.extend({
}
},
/**
- * Manages the TAB key on the buttons. If you the focus is on a primary
+ * Manages the TAB key on the buttons. If you the focus is on a primary
* button and the users tries to tab to go to the next button, display
* a tooltip
- *
+ *
* @param {jQueryEvent} e
* @private
*/
_onFooterButtonKeyDown: function (e) {
switch(e.which) {
case $.ui.keyCode.TAB:
- if (!e.shiftKey && (e.target.classList.contains("btn-primary") || e.target.classList.contains("oe_highlight"))) {
+ if (!e.shiftKey && e.target.classList.contains("btn-primary")) {
e.preventDefault();
var $primaryButton = $(e.target);
$primaryButton.tooltip({
diff --git a/addons/web/static/src/js/core/dom.js b/addons/web/static/src/js/core/dom.js
index 274f82bcc53..5335ef8e954 100644
--- a/addons/web/static/src/js/core/dom.js
+++ b/addons/web/static/src/js/core/dom.js
@@ -221,7 +221,12 @@ return {
renderButton: function (options) {
var params = options.attrs || {};
params.type = params.type || 'button';
- params.class = 'btn btn-' + (options.size || 'sm') + ' ' + (params.class || 'btn-default');
+ var classes = 'btn-default';
+ if (params.class) {
+ classes = params.class.replace(/\boe_highlight\b/g, 'btn-primary')
+ .replace(/\boe_link\b/g, 'btn-link');
+ }
+ params.class = 'btn btn-' + (options.size || 'sm') + ' ' + classes;
var $button = $('<button/>', params);
if (options.icon) {
if (options.icon.substr(0, 3) === 'fa-') {