N°3817 - Audit and fix calls to deprecated jQuery method

This commit is contained in:
Anne-Cath
2025-08-06 19:47:57 +02:00
parent 1667f834b9
commit 5b9e0a1d4f
66 changed files with 188 additions and 211 deletions

View File

@@ -12,7 +12,7 @@ oWelcomePopupDialogElem.dialog({
title: oWelcomePopupDialogElem.attr('data-title'),
open: function () {
// Focus on acknowledge button
const oAckButton = oWelcomePopupDialogElem.closest('[role="dialog"]').find('.ui-dialog-buttonset .ibo-is-primary:first');
const oAckButton = oWelcomePopupDialogElem.closest('[role="dialog"]').find('.ui-dialog-buttonset .ibo-is-primary').first();
oAckButton.trigger('focus');
// Count stack items and change button label to close if there is only one
@@ -75,13 +75,13 @@ oWelcomePopupDialogElem
oWelcomePopupDialogElem.find('[data-role="ibo-welcome-popup--stack-item"][data-uuid="' + sUUIDEscapedForSelector + '"]').addClass('ibo-is-acknowledged');
// Display next message if any
const oNextStackItemElem = oWelcomePopupDialogElem.find('[data-role="ibo-welcome-popup--stack-item"]:not(.ibo-is-acknowledged):first');
const oNextStackItemElem = oWelcomePopupDialogElem.find('[data-role="ibo-welcome-popup--stack-item"]:not(.ibo-is-acknowledged)').first();
if (oNextStackItemElem.length > 0) {
oNextStackItemElem.trigger('click');
// Count non acknowledged stack items and change button label to close if there is only one
if (oWelcomePopupDialogElem.find('[data-role="ibo-welcome-popup--stack-item"]:not(.ibo-is-acknowledged)').length === 1) {
const oAckButton = oWelcomePopupDialogElem.closest('[role="dialog"]').find('.ui-dialog-buttonset .ibo-is-primary:first');
const oAckButton = oWelcomePopupDialogElem.closest('[role="dialog"]').find('.ui-dialog-buttonset .ibo-is-primary').first();
oAckButton.text({{ 'UI:WelcomePopup:Button:AcknowledgeAndClose'|dict_s|json_encode|raw }});
}
} else {

View File

@@ -1,7 +1,7 @@
{# @copyright Copyright (C) 2010-2024 Combodo SAS #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
{% if oUIBlock.GetShowFilename() %}
$('#{{ oUIBlock.GetId() }}').bind('change', function() {
$('#{{ oUIBlock.GetId() }}').on('change', function() {
var fileName = $(this).val().replace(/^.*[\\\/]/, '');
fileName = $('<div/>').text(fileName).html();
$('#{{ oUIBlock.GetId() }}-file-name').html(fileName);

View File

@@ -5,7 +5,7 @@
{% include "base/components/input/inputlabel.html.twig" %}
{% endif %}
<select id="{{ oUIBlock.GetId() }}" name="{{ oUIBlock.GetName() }}"
{% if oUIBlock.GetSubmitOnChange() %} onChange="this.form.submit();" {% endif %}
{% if oUIBlock.GetSubmitOnChange() %} onChange="this.form.trigger('submit');" {% endif %}
{% if oUIBlock.IsMultiple() %} multiple {% endif %}
class="{% if oUIBlock.IsHidden() %}ibo-is-hidden{% endif %}{% if oUIBlock.GetAdditionalCSSClassesAsString() %} {{ oUIBlock.GetAdditionalCSSClassesAsString() }}{% endif %}"
{% if oUIBlock.GetDataAttributes() %}

View File

@@ -15,12 +15,12 @@
$('#{{ oUIBlock.GetId() }}').on('edit_object', function(){
let oFavoriteButton = $(this).find('#UIMenuModify');
if(oFavoriteButton[0]){
oFavoriteButton[0].click();
oFavoriteButton[0].trigger('click');
}
else{
let oPopupItemButton = $('[data-role="ibo-popover-menu"]').find('[data-resource-id="UI:Menu:Modify"]');
if(oPopupItemButton[0]){
oPopupItemButton[0].click();
oPopupItemButton[0].trigger('click');
}
}
});
@@ -28,12 +28,12 @@
$('#{{ oUIBlock.GetId() }}').on('delete_object', function(){
let oFavoriteButton = $(this).find('#UIMenuDelete');
if(oFavoriteButton[0]){
oFavoriteButton[0].click();
oFavoriteButton[0].trigger('click');
}
else{
let oPopupItemButton = $('[data-role="ibo-popover-menu"]').find('[data-resource-id="UI:Menu:Delete"]');
if(oPopupItemButton[0]){
oPopupItemButton[0].click();
oPopupItemButton[0].trigger('click');
}
}
});
@@ -41,22 +41,22 @@
$('#{{ oUIBlock.GetId() }}').on('new_object', function(){
let oFavoriteButton = $(this).find('#UIMenuNew');
if(oFavoriteButton[0]){
oFavoriteButton[0].click();
oFavoriteButton[0].trigger('click');
}
else{
let oPopupItemButton = $('[data-role="ibo-popover-menu"]').find('[data-resource-id="UI:Menu:New"]');
if(oPopupItemButton[0]){
oPopupItemButton[0].click();
oPopupItemButton[0].trigger('click');
}
}
});
{% if oUIBlock.GetObjectMode() == constant('cmdbAbstractObject::ENUM_DISPLAY_MODE_EDIT') or oUIBlock.GetObjectMode() == constant('cmdbAbstractObject::ENUM_DISPLAY_MODE_CREATE') %}
$('#{{ oUIBlock.GetId() }}').on('save_object', function(){
$(this).find('button[type="submit"][name=""][value=""]').click();
$(this).find('button[type="submit"][name=""][value=""]').trigger('click');
});
{% elseif oUIBlock.GetObjectMode() == constant('cmdbAbstractObject::ENUM_DISPLAY_MODE_STIMULUS') %}
$('#{{ oUIBlock.GetId() }}').on('save_object', function(){
$(this).find('button[type="submit"][name="submit"][value="submit"]').click();
$(this).find('button[type="submit"][name="submit"][value="submit"]').trigger('click');
});
{% endif %}
{% endblock %}

View File

@@ -1,4 +1,4 @@
{# @copyright Copyright (C) 2010-2024 Combodo SAS #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
$("#user").focus();
$("#user").trigger('focus');