[REF] *: BS5: Migrate data attributes
> Data attributes for all JavaScript plugins are now namespaced to help > distinguish Bootstrap functionality from third parties and your own code. > For example, we use data-bs-toggle instead of data-toggle. https://getbootstrap.com/docs/5.1/migration/#javascript Task ID: 2766483 Part-of: odoo/odoo#95450
This commit is contained in:
@@ -64,7 +64,7 @@ export function useActionLinks({ resModel, reload }) {
|
||||
// the handler should have stopped the Event
|
||||
// But we still need to alert bootstrap if we need to
|
||||
// This function should be removed when we get rid of bootstrap as a JS framework
|
||||
if (target.dataset.toggle === "collapse") {
|
||||
if (target.dataset.bsToggle === "collapse") {
|
||||
$(target).trigger("click.bs.collapse.data-api");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ QUnit.module('LegacyViews', {
|
||||
</div>
|
||||
<div class="o_onboarding_container collapse show">
|
||||
<div class="o_onboarding_wrap">
|
||||
<a href="#" data-toggle="modal" data-target=".o_onboarding_modal"
|
||||
<a href="#" data-toggle="modal" data-bs-target=".o_onboarding_modal"
|
||||
class="float-right o_onboarding_btn_close">
|
||||
<i class="fa fa-times" title="Close the onboarding panel" />
|
||||
</a>
|
||||
|
||||
@@ -6079,7 +6079,7 @@ QUnit.module('LegacyViews', {
|
||||
"tooltip of first column should not defined, since group_by_tooltip title and the many2one field has no value");
|
||||
assert.ok(kanban.$('.o_kanban_group:eq(1) span.o_column_title:contains(hello)').length,
|
||||
"second column should have a title with a value from the many2one");
|
||||
assert.strictEqual(kanban.$('.o_kanban_group:eq(1) .o_kanban_header_title').data('original-title'),
|
||||
assert.strictEqual(kanban.$('.o_kanban_group:eq(1) .o_kanban_header_title').data('bs-original-title'),
|
||||
"<div>Kikou</br>hello</div>",
|
||||
"second column should have a tooltip with the group_by_tooltip title and many2one field value");
|
||||
|
||||
|
||||
@@ -1233,7 +1233,7 @@ var SnippetsMenu = Widget.extend({
|
||||
'.o_notification_manager',
|
||||
'.o_we_no_overlay',
|
||||
'.ui-autocomplete',
|
||||
'.modal .close',
|
||||
'.modal .btn-close',
|
||||
'.o_we_crop_widget',
|
||||
'.transfo-container',
|
||||
].join(', ');
|
||||
|
||||
@@ -1584,11 +1584,11 @@ options.registry.Carousel = options.Class.extend({
|
||||
_assignUniqueID: function () {
|
||||
const id = 'myCarousel' + Date.now();
|
||||
this.$target.attr('id', id);
|
||||
this.$target.find('[data-target]').attr('data-target', '#' + id);
|
||||
this.$target.find('[data-bs-target]').attr('data-bs-target', '#' + id);
|
||||
_.each(this.$target.find('[data-slide], [data-slide-to]'), function (el) {
|
||||
var $el = $(el);
|
||||
if ($el.attr('data-target')) {
|
||||
$el.attr('data-target', '#' + id);
|
||||
if ($el.attr('data-bs-target')) {
|
||||
$el.attr('data-bs-target', '#' + id);
|
||||
} else if ($el.attr('href')) {
|
||||
$el.attr('href', '#' + id);
|
||||
}
|
||||
@@ -1604,7 +1604,7 @@ options.registry.Carousel = options.Class.extend({
|
||||
this.$controls.removeClass('d-none');
|
||||
const $active = $items.filter('.active');
|
||||
this.$indicators.append($('<li>', {
|
||||
'data-target': '#' + this.$target.attr('id'),
|
||||
'data-bs-target': '#' + this.$target.attr('id'),
|
||||
'data-slide-to': $items.length,
|
||||
}));
|
||||
this.$indicators.append(' ');
|
||||
@@ -1924,11 +1924,11 @@ options.registry.collapse = options.Class.extend({
|
||||
|
||||
const tablistId = setUniqueId($tablist, 'myCollapse');
|
||||
$panel.attr('data-parent', '#' + tablistId);
|
||||
$panel.data('parent', '#' + tablistId);
|
||||
$panel.data('bs-parent', '#' + tablistId);
|
||||
|
||||
const panelId = setUniqueId($panel, 'myCollapseTab');
|
||||
$tab.attr('data-target', '#' + panelId);
|
||||
$tab.data('target', '#' + panelId);
|
||||
$tab.attr('data-bs-target', '#' + panelId);
|
||||
$tab.data('bs-target', '#' + panelId);
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ const WebsiteWysiwyg = Wysiwyg.extend({
|
||||
const $editableWindow = this.$editable[0].ownerDocument.defaultView;
|
||||
// Dropdown menu initialization: handle dropdown openings by hand
|
||||
var $dropdownMenuToggles = $editableWindow.$('.o_mega_menu_toggle, #top_menu_container .dropdown-toggle');
|
||||
$dropdownMenuToggles.removeAttr('data-toggle').dropdown('dispose');
|
||||
$dropdownMenuToggles.removeAttr('data-bs-toggle').dropdown('dispose');
|
||||
$dropdownMenuToggles.on('click.wysiwyg_megamenu', ev => {
|
||||
this.odooEditor.observerUnactive();
|
||||
var $toggle = $(ev.currentTarget);
|
||||
@@ -236,7 +236,7 @@ const WebsiteWysiwyg = Wysiwyg.extend({
|
||||
_restoreMegaMenus: function () {
|
||||
var $megaMenuToggles = this.$('.o_mega_menu_toggle');
|
||||
$megaMenuToggles.off('.wysiwyg_megamenu')
|
||||
.attr('data-toggle', 'dropdown')
|
||||
.attr('data-bs-toggle', 'dropdown')
|
||||
.dropdown({});
|
||||
return toggleDropdown($megaMenuToggles, false);
|
||||
},
|
||||
|
||||
@@ -22,7 +22,7 @@ options.registry.gallery = options.Class.extend({
|
||||
this.$target.on('image_changed', 'img', function (ev) {
|
||||
var $img = $(ev.currentTarget);
|
||||
var index = self.$target.find('.carousel-item.active').index();
|
||||
self.$('.carousel:first li[data-target]:eq(' + index + ')')
|
||||
self.$('.carousel:first li[data-bs-target]:eq(' + index + ')')
|
||||
.css('background-image', 'url(' + $img.attr('src') + ')');
|
||||
});
|
||||
|
||||
@@ -365,8 +365,8 @@ options.registry.gallery = options.Class.extend({
|
||||
this.$target.find('.carousel').attr('id', 'slideshow_' + uuid);
|
||||
_.each(this.$target.find('[data-slide], [data-slide-to]'), function (el) {
|
||||
var $el = $(el);
|
||||
if ($el.attr('data-target')) {
|
||||
$el.attr('data-target', '#slideshow_' + uuid);
|
||||
if ($el.attr('data-bs-target')) {
|
||||
$el.attr('data-bs-target', '#slideshow_' + uuid);
|
||||
} else if ($el.attr('href')) {
|
||||
$el.attr('href', '#slideshow_' + uuid);
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
</t>
|
||||
<a class="o_wevent_sponsor o_wevent_sponsor_card h-100" tabindex="0" role="button"
|
||||
t-att-data-publish="'on' if sponsor.website_published else 'off'"
|
||||
t-att-data-content="popover_content"
|
||||
data-html="true" data-trigger="focus" data-toggle="popover" data-placement="bottom">
|
||||
t-att-data-bs-content="popover_content"
|
||||
data-bs-html="true" data-bs-trigger="focus" data-bs-toggle="popover" data-bs-placement="bottom">
|
||||
<t t-call="website_event_exhibitor.event_sponsor_thumb_details"/>
|
||||
</a>
|
||||
</t>
|
||||
|
||||
@@ -652,7 +652,7 @@
|
||||
</div>
|
||||
<div t-if="uid and request.env.user.forum_waiting_posts_count"
|
||||
title="You already have a pending post"
|
||||
data-toggle="popover" data-trigger="hover" data-content="Please wait for a moderator to validate your previous post before continuing.">
|
||||
data-bs-toggle="popover" data-bs-trigger="hover" data-bs-content="Please wait for a moderator to validate your previous post before continuing.">
|
||||
<a class="disabled btn btn-secondary btn-block mb-3 mb-md-0" t-attf-href="/forum/#{slug(forum)}/ask">New Post</a>
|
||||
</div>
|
||||
<a t-else="" role="button" type="button" class="btn btn-primary btn-block o_forum_ask_btn mb-3 mb-md-0" t-att-href="uid and '/forum/' + slug(forum) + '/ask' or '/web/login'">New Post</a>
|
||||
@@ -1425,7 +1425,7 @@
|
||||
</t>
|
||||
|
||||
<div t-attf-class="o_wforum_author_box d-inline-flex #{display_info and 'o_show_info'} #{compact and 'o_compact align-items-center'} #{bio_popover_data and 'o_wforum_bio_popover'}"
|
||||
t-att-data-content="bio_popover_data">
|
||||
t-att-data-bs-content="bio_popover_data">
|
||||
<t t-set="user_profile_url" value="#"/>
|
||||
<t t-if="object.create_uid.id == request.session.uid or object.create_uid.sudo().website_published">
|
||||
<t t-set="user_profile_url" t-value="'/forum/%s/user/%s' % (slug(forum), object.create_uid.id) + '?forum_origin=' + request.httprequest.path"/>
|
||||
|
||||
@@ -123,7 +123,7 @@ tour.register('course_member', {
|
||||
{
|
||||
trigger: 'a:contains("Basics of Gardening")'
|
||||
}, {
|
||||
trigger: 'button[data-target="#ratingpopupcomposer"]'
|
||||
trigger: 'button[data-bs-target="#ratingpopupcomposer"]'
|
||||
}, {
|
||||
trigger: 'div.o_portal_chatter_composer_input i.fa:eq(2)',
|
||||
extra_trigger: 'div.modal_shown',
|
||||
|
||||
Reference in New Issue
Block a user