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:
bdalsass
2022-12-06 10:18:59 +01:00
committed by GitHub
parent 98a53a46f0
commit dbe7fae82e
29 changed files with 322 additions and 345 deletions

View File

@@ -28,7 +28,4 @@
{% if oUIBlock.HasRowActions() %}
{{ render_block(oUIBlock.GetRowActionsTemplate()) }}
{% if not oUIBlock.GetRowActionsConfirmDialogInitializedFlag() %}
{{ render_block(oUIBlock.GetRowActionsConfirmDialog()) }}
{% endif %}
{% endif %}

View File

@@ -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'))

View File

@@ -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 %}

View File

@@ -21,7 +21,4 @@
{% if oUIBlock.HasRowActions() %}
{{ render_block(oUIBlock.GetRowActionsTemplate()) }}
{% if not oUIBlock.GetRowActionsConfirmDialogInitializedFlag() %}
{{ render_block(oUIBlock.GetRowActionsConfirmDialog()) }}
{% endif %}
{% endif %}

View File

@@ -48,7 +48,4 @@
{% if oUIBlock.HasRowActions() %}
{{ render_block(oUIBlock.GetRowActionsTemplate()) }}
{% if not oUIBlock.GetRowActionsConfirmDialogInitializedFlag() %}
{{ render_block(oUIBlock.GetRowActionsConfirmDialog()) }}
{% endif %}
{% endif %}