Skip to content
Snippets Groups Projects
Commit d238b019 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge branch 'F16990_ignore_history_btn' into 'develop'

F16990: Implemented new eventListener for custom buttons with attribute...

See merge request !652
parents 74588e05 a82eb3fd
No related branches found
No related tags found
2 merge requests!691New version v24.3.0,!652F16990: Implemented new eventListener for custom buttons with attribute...
Pipeline #11739 passed
......@@ -1056,6 +1056,16 @@ Text before / after link
}
.. _ignoreHistory:
Ignore/Skip browser history
^^^^^^^^^^^^^^^^^^^^^^^^^^^
To ignore/skip adding a browser history entry when clicking on a link, add the attribute `data-ignore-history`::
'data-ignore-history'
Example: 10.sql = SELECT 'p:{{pageSlug:T}}?form=test_form&r=2&variable1=test|s|b|t:Button|A:data-ignore-history' AS _link
.. _column_pageX:
......
......@@ -205,8 +205,44 @@ $(document).ready( function () {
});
};
n.initializeIgnoreHistoryBtn = function () {
// Attaching the event listener to the document
document.addEventListener('click', function(event) {
var element = event.target;
// Traverse up to find the element with 'data-ignore-history'
while (element && !element.hasAttribute('data-ignore-history')) {
element = element.parentNode;
if (element === document) {
return; // Exit if reached the document without finding the target
}
}
if (element) {
handleIgnoreHistoryClick(event, element);
}
});
};
function handleIgnoreHistoryClick(event, element) {
event.preventDefault();
let alertButton = document.querySelector('.alert-interactive .btn-group button:first-child');
let url = element.href;
if (alertButton) {
alertButton.onclick = function() {
if (url) {
window.location.replace(url);
}
};
} else {
window.location.replace(url);
}
}
n.initializeQfqClearMe();
n.initializeDatetimepicker();
n.initializeIgnoreHistoryBtn();
n.Helper.calendar();
FilePond.registerPlugin(FilePondPluginFileValidateSize);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment