mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
N°6154 N°6219 - Relations Read - tooltip, confirmation title and message (#486)
N°6154 - n:n Read - tooltip, confirmation title and message on Add-Edit-Remove N°6219 - 1:n Read: tooltip, modal title and message on Add-Edit-Remove-Delete
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
// for each row action...
|
||||
{% for aAction in oUIBlock.GetRowActions() %}
|
||||
|
||||
|
||||
// register action buttons click
|
||||
$('body').on('click', 'button[data-table-id="{{ oUIBlock.GetId() }}"][data-action-id="{{ loop.index0 }}"]', function() {
|
||||
|
||||
@@ -13,21 +14,41 @@
|
||||
let sLabel = $(this).data('label');
|
||||
let iActionId = $(this).data('action-id');
|
||||
let aRowData = oDatatable.row(oTrElement).data();
|
||||
let sConfirmButtonClass = 'ibo-is-primary';
|
||||
|
||||
{% if aAction.confirmation.confirm_button_class is not empty %}
|
||||
sConfirmButtonClass = '{{ aAction.confirmation.confirm_button_class }}';
|
||||
{% endif %}
|
||||
|
||||
{% if aAction.confirmation is defined %}
|
||||
|
||||
// Prepare confirmation title
|
||||
let sTitle = `{{ 'UI:Datatables:RowActions:ConfirmationDialog'|dict_s|raw }}`;
|
||||
{% if aAction.confirmation.title is defined %}
|
||||
sTitle = `{{ aAction.confirmation.title|dict_s|raw }}`;
|
||||
{% endif %}
|
||||
sTitle = sTitle.replaceAll('{item}', aRowData['{{ aAction.confirmation.row_data }}']);
|
||||
|
||||
// Prepare confirmation message
|
||||
let sMessage = `{{ 'UI:Datatables:RowActions:ConfirmationMessage'|dict_s|raw }}`;
|
||||
{% if aAction.confirmation.message is defined %}
|
||||
sMessage = `{{ aAction.confirmation.message|dict_s|raw }}`;
|
||||
{% endif %}
|
||||
sMessage = sMessage.replaceAll('{item}', aRowData['{{ aAction.confirmation.row_data }}']);
|
||||
|
||||
// Handle action row with confirmation modal
|
||||
CombodoModal.OpenConfirmationModal({
|
||||
title: '{{ 'UI:Datatables:RowActions:ConfirmationDialog'|dict_s }}',
|
||||
content: sMessage.replaceAll('{item}', aRowData['{{ aAction.confirmation.message_row_data }}']),
|
||||
confirm_button_label: sLabel,
|
||||
callback_on_confirm: ActionRowFunction{{ oUIBlock.GetId() }}{{ loop.index0 }},
|
||||
title: sTitle,
|
||||
content: sMessage,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: sLabel,
|
||||
classes: [sConfirmButtonClass],
|
||||
callback_on_click:{
|
||||
ActionRowFunction{{ oUIBlock.GetId() }}{{ loop.index0 }}
|
||||
}
|
||||
}
|
||||
},
|
||||
{% if aAction.confirmation.do_not_show_again_pref_key is defined %}
|
||||
do_not_show_again_pref_key: '{{ aAction.confirmation.do_not_show_again_pref_key }}',
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user