diff options
| author | qsm-odoo <qsm@odoo.com> | 2018-07-16 16:48:59 +0200 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2018-07-27 12:36:54 +0200 |
| commit | c59380bac5bbd47bc7dcd92b38049af29a62c3d1 (patch) | |
| tree | d7d2597657a11138e243f228ebef98cd4ffc4cf6 /addons/web/static/src/js | |
| parent | 81f359c81c69af2a5ec0645602e2bb43b2e16721 (diff) | |
[REF] *: BS4, rename btn-default to btn-secondary
BS4 "btn-default" class was replaced with "btn-secondary", which makes
more sense.
Diffstat (limited to 'addons/web/static/src/js')
8 files changed, 21 insertions, 20 deletions
diff --git a/addons/web/static/src/js/core/dialog.js b/addons/web/static/src/js/core/dialog.js index 847845ae17e..9cca9c1127a 100644 --- a/addons/web/static/src/js/core/dialog.js +++ b/addons/web/static/src/js/core/dialog.js @@ -40,7 +40,7 @@ var Dialog = Widget.extend({ * button is added to allow closing the dialog * @param {string} [options.buttons[].text] * @param {string} [options.buttons[].classes] - * Default to 'btn-primary' if only one button, 'btn-default' + * Default to 'btn-primary' if only one button, 'btn-secondary' * otherwise * @param {boolean} [options.buttons[].close=false] * @param {function} [options.buttons[].click] @@ -123,7 +123,7 @@ var Dialog = Widget.extend({ _.each(buttons, function (buttonData) { var $button = dom.renderButton({ attrs: { - class: buttonData.classes || (buttons.length > 1 ? 'btn-default' : 'btn-primary'), + class: buttonData.classes || (buttons.length > 1 ? 'btn-secondary' : 'btn-primary'), disabled: buttonData.disabled, }, icon: buttonData.icon, diff --git a/addons/web/static/src/js/core/dom.js b/addons/web/static/src/js/core/dom.js index 81f5bfec5c0..ba3eebf9bea 100644 --- a/addons/web/static/src/js/core/dom.js +++ b/addons/web/static/src/js/core/dom.js @@ -208,7 +208,7 @@ return { * @param {Object} options * @param {Object} [options.attrs] - Attributes to put on the button element * @param {string} [options.attrs.type='button'] - * @param {string} [options.attrs.class='btn-default'] + * @param {string} [options.attrs.class='btn-secondary'] * Note: automatically completed with "btn btn-X" * (@see options.size for the value of X) * @param {string} [options.size] - @see options.attrs.class @@ -237,7 +237,7 @@ return { if (options.size) { jQueryParams.class += (' btn-' + options.size); } - jQueryParams.class += (' ' + (extraClasses || 'btn-default')); + jQueryParams.class += (' ' + (extraClasses || 'btn-secondary')); var $button = $('<button/>', jQueryParams); diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index c1c458d1935..73bcc1f1f35 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -968,7 +968,7 @@ var FieldX2Many = AbstractField.extend({ _renderButtons: function () { if (!this.isReadonly && this.view.arch.tag === 'kanban') { this.$buttons = $(qweb.render('KanbanView.buttons', { - btnClass: 'btn-default', + btnClass: 'btn-secondary', create_text: this.nodeOptions.create_text, })); this.$buttons.on('click', 'button.o-kanban-button-new', this._onAddRecord.bind(this)); diff --git a/addons/web/static/src/js/views/form/form_renderer.js b/addons/web/static/src/js/views/form/form_renderer.js index a96742bd0e2..5d4e2ad4cb5 100644 --- a/addons/web/static/src/js/views/form/form_renderer.js +++ b/addons/web/static/src/js/views/form/form_renderer.js @@ -159,9 +159,9 @@ var FormRenderer = BasicRenderer.extend({ .removeAttr('disabled'); }, /** - * Put the focus on the last activated widget. + * Put the focus on the last activated widget. * This function is used when closing a dialog to give the focus back to the - * form that has opened it and ensures that the focus is in the correct + * form that has opened it and ensures that the focus is in the correct * field. */ focusLastActivatedWidget: function () { @@ -396,12 +396,13 @@ var FormRenderer = BasicRenderer.extend({ // Current API of odoo for rendering buttons is "if classes are given // use those on top of the 'btn' and 'btn-{size}' classes, otherwise act - // as if 'btn-default' class was given". The problem is that, for header - // buttons only, we allowed users to only indicate their custom classes - // without having to explicitely ask for the 'btn-default' class to be - // added. We force it so here when no bootstrap btn type class is found. - if ($button.not('.btn-primary, .btn-default, .btn-link, .btn-success, .btn-info, .btn-warning, .btn-danger').length) { - $button.addClass('btn-default'); + // as if 'btn-secondary' class was given". The problem is that, for + // header buttons only, we allowed users to only indicate their custom + // classes without having to explicitely ask for the 'btn-secondary' + // class to be added. We force it so here when no bootstrap btn type + // class is found. + if ($button.not('.btn-primary, .btn-secondary, .btn-link, .btn-success, .btn-info, .btn-warning, .btn-danger').length) { + $button.addClass('btn-secondary'); } this._addOnClickAction($button, node); @@ -858,7 +859,7 @@ var FormRenderer = BasicRenderer.extend({ this.defs = defs; var $form = this._renderNode(this.arch).addClass(this.className); delete this.defs; - + return $.when.apply($, defs).then(function () { self._updateView($form.contents()); }, function () { @@ -866,7 +867,7 @@ var FormRenderer = BasicRenderer.extend({ }).then(function(){ if (self.lastActivatedFieldIndex >= 0) { self._activateNextFieldWidget(self.state, self.lastActivatedFieldIndex); - } + } }); }, /** diff --git a/addons/web/static/src/js/views/kanban/kanban_controller.js b/addons/web/static/src/js/views/kanban/kanban_controller.js index 26846e2c511..ab05fabd517 100644 --- a/addons/web/static/src/js/views/kanban/kanban_controller.js +++ b/addons/web/static/src/js/views/kanban/kanban_controller.js @@ -119,7 +119,7 @@ var KanbanController = BasicController.extend({ return this._super.apply(this, arguments); }, /** - * In grouped mode, set 'Create' button as btn-default if there is no column + * In grouped mode, set 'Create' button as btn-secondary if there is no column * (except if we can't create new columns) * * @private diff --git a/addons/web/static/src/js/views/search/search_view_mobile.js b/addons/web/static/src/js/views/search/search_view_mobile.js index 852a65c0a37..ea7fe33ad81 100644 --- a/addons/web/static/src/js/views/search/search_view_mobile.js +++ b/addons/web/static/src/js/views/search/search_view_mobile.js @@ -54,7 +54,7 @@ SearchView.include({ * @private */ _toggleMobileSearchView: function () { - this.$('.o_enable_searchview').toggleClass('btn-default', !!this.query.length); + this.$('.o_enable_searchview').toggleClass('btn-secondary', !!this.query.length); this.$('.o_mobile_search').toggleClass('o_hidden'); }, diff --git a/addons/web/static/src/js/views/view_dialogs.js b/addons/web/static/src/js/views/view_dialogs.js index ed0adf0ff3b..e99f81ccb08 100644 --- a/addons/web/static/src/js/views/view_dialogs.js +++ b/addons/web/static/src/js/views/view_dialogs.js @@ -109,7 +109,7 @@ var FormViewDialog = ViewDialog.extend({ options = options || {}; options.buttons = [{ text: (readonly ? _t("Close") : _t("Discard")), - classes: "btn-default o_form_button_cancel", + classes: "btn-secondary o_form_button_cancel", close: true, click: function () { if (!readonly) { @@ -360,7 +360,7 @@ var SelectCreateDialog = ViewDialog.extend({ // Set the dialog's buttons self.__buttons = [{ text: _t("Cancel"), - classes: "btn-default o_form_button_cancel", + classes: "btn-secondary o_form_button_cancel", close: true, }]; if (!self.options.no_create) { diff --git a/addons/web/static/src/js/widgets/dropdown_menu.js b/addons/web/static/src/js/widgets/dropdown_menu.js index 77dd7be10d0..410d915dc9a 100644 --- a/addons/web/static/src/js/widgets/dropdown_menu.js +++ b/addons/web/static/src/js/widgets/dropdown_menu.js @@ -49,7 +49,7 @@ var DropdownMenu = Widget.extend({ // the style used is the one used in the search view this.dropdownStyle = dropdownHeader.style || { el: {class: 'btn-group o_dropdown', attrs: {}}, - mainButton: {class: 'o_dropdown_toggler_btn btn btn-default dropdown-toggle'}, + mainButton: {class: 'o_dropdown_toggler_btn btn btn-secondary dropdown-toggle'}, }; this.items = items; _.each(this.items, this._prepareItem.bind(this)); |
