mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 10:38:45 +02:00
Feature/modals - generic modal API (#373)
Default modal JS Implementation: Add title option Add buttons option Change template cloning Confirmation Modal: Add implementation Do not show again functionality Web Page: Add blocks array with twig loop insertion
This commit is contained in:
@@ -28,7 +28,4 @@
|
||||
|
||||
{% if oUIBlock.HasRowActions() %}
|
||||
{{ render_block(oUIBlock.GetRowActionsTemplate()) }}
|
||||
{% if not oUIBlock.GetRowActionsConfirmDialogInitializedFlag() %}
|
||||
{{ render_block(oUIBlock.GetRowActionsConfirmDialog()) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
@@ -420,6 +420,7 @@ var aOptions{{ sListIDForVarSuffix }} = {
|
||||
oData: {{ oUIBlock.GetJsonAjaxData() |raw }},
|
||||
oDefaultSettings: {{ oUIBlock.GetOption("oDefaultSettings")|raw }},
|
||||
oLabels: {moveup: "{{ 'UI:Button:MoveUp'|dict_s }}", movedown: "{{ 'UI:Button:MoveDown'|dict_s }}"},
|
||||
bHasRowActions: {{ oUIBlock.HasRowActions()|var_export }},
|
||||
};
|
||||
|
||||
if ($('#datatable_dlg_{{ oUIBlock.GetId() }}').hasClass('itop-datatable'))
|
||||
|
||||
@@ -15,23 +15,21 @@
|
||||
|
||||
{% if aAction.confirmation is defined %}
|
||||
|
||||
// Handle action row with confirmation
|
||||
let sTitle = '{{ 'UI:Datatables:RowActions:ConfirmationDialog'|dict_s }}';
|
||||
// Prepare confirmation message
|
||||
let sMessage = '{{ 'UI:Datatables:RowActions:ConfirmationMessage'|dict_s }}';
|
||||
{% if aAction.confirmation.message is defined %}
|
||||
sMessage = '{{ aAction.confirmation.message|dict_s|raw }}';
|
||||
sMessage = sMessage.replaceAll('{item}', aRowData['{{ aAction.confirmation.message_row_data }}']);
|
||||
{% endif %}
|
||||
let sPrefKey = null;
|
||||
{% if aAction.confirmation.remember_choice_pref_key is defined %}
|
||||
sPrefKey = '{{ aAction.confirmation.remember_choice_pref_key }}';
|
||||
{% endif %}
|
||||
HandleActionRowConfirmation (sTitle, sMessage, sPrefKey, ActionRowFunction{{ oUIBlock.GetId() }}{{ loop.index0 }}, {
|
||||
action_id: iActionId,
|
||||
datatable: oDatatable,
|
||||
tr_element: oTrElement,
|
||||
row_data: aRowData
|
||||
});
|
||||
|
||||
// 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 }}']),
|
||||
callback_on_confirm: 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 %}
|
||||
}, [oDatatable, oTrElement, iActionId, aRowData]);
|
||||
|
||||
{% else %}
|
||||
|
||||
|
||||
@@ -21,7 +21,4 @@
|
||||
|
||||
{% if oUIBlock.HasRowActions() %}
|
||||
{{ render_block(oUIBlock.GetRowActionsTemplate()) }}
|
||||
{% if not oUIBlock.GetRowActionsConfirmDialogInitializedFlag() %}
|
||||
{{ render_block(oUIBlock.GetRowActionsConfirmDialog()) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
@@ -48,7 +48,4 @@
|
||||
|
||||
{% if oUIBlock.HasRowActions() %}
|
||||
{{ render_block(oUIBlock.GetRowActionsTemplate()) }}
|
||||
{% if not oUIBlock.GetRowActionsConfirmDialogInitializedFlag() %}
|
||||
{{ render_block(oUIBlock.GetRowActionsConfirmDialog()) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user