mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N°3136 - Add creation and modification of n-n objects in object details (#378)
* Rebase onto develop * Use exit condition instead of englobing condition * Add informative modals that can be called from modal toolbox * Refactor "apply_modify" and "apply_new" into own controller, handle ajax requests with a json response and handle these responses in linkset creation/edition * Fix merge issues * Remove inverted condition * Move linkset create button to a better place, still needs to fix duplicate "New" button caused by a refactor * Handle "Cancel" button in modals * Do not display relations when editing an object in a modal * More elegant way to add "New" button to relations lists * Factorize vertical highlights in alerts and modal in a single mixin * Replace button name with dict entry code * Change route name to snake case * More elegant way to add "Create in modal" button to relations lists * Replace triple if with in_array * Move listener to body * Rename variable to match boolean rules * Rename event * Rename extra param * Add phpdoc * Revert changes * Check indirect linkset rights before allowing creation in modal
This commit is contained in:
@@ -201,6 +201,7 @@ CombodoModal._InstantiateModal = function(oModalElem, oOptions) {
|
||||
width: 'auto',
|
||||
height: 'auto',
|
||||
modal: oOptions.extra_options.modal ?? true,
|
||||
classes: oOptions.classes ?? {},
|
||||
close: oOptions.extra_options.callback_on_modal_close,
|
||||
autoOpen: oOptions.auto_open,
|
||||
title: oOptions.title,
|
||||
@@ -326,14 +327,17 @@ CombodoModal._InstantiateModal = function(oModalElem, oOptions) {
|
||||
*/
|
||||
CombodoModal._ConvertButtonDefinition = function(aButtonsDefinitions){
|
||||
const aConverted = [];
|
||||
if(aButtonsDefinitions === null) {
|
||||
return aConverted
|
||||
}
|
||||
aButtonsDefinitions.forEach(element => {
|
||||
const aButton = {
|
||||
text: element.text,
|
||||
class: element.class,
|
||||
click: element.callback_on_click
|
||||
const aButton = {
|
||||
text: element.text,
|
||||
class: element.class,
|
||||
click: element.callback_on_click
|
||||
}
|
||||
aConverted.push(aButton);
|
||||
}
|
||||
aConverted.push(aButton);
|
||||
}
|
||||
);
|
||||
return aConverted;
|
||||
}
|
||||
@@ -428,6 +432,42 @@ CombodoModal.OpenConfirmationModal = function(oOptions, aData) {
|
||||
CombodoModal.OpenModal(oOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a standard informative modal.
|
||||
*
|
||||
* @param sMessage string Informative message to be displayed in the modal
|
||||
* @param sSeverity string Severity of the information. Default values are success, information, warning, error.
|
||||
* @param oOptions array @see CombodoModal.OpenModal
|
||||
*/
|
||||
CombodoModal.OpenInformativeModal = function(sMessage, sSeverity, oOptions) {
|
||||
let sFirstLetterUppercaseSeverity = sSeverity.charAt(0).toUpperCase() + sSeverity.slice(1);
|
||||
// Merge external options with confirmation modal default options
|
||||
oOptions = $.extend({
|
||||
title: Dict.S('UI:Modal:Informative' + sFirstLetterUppercaseSeverity + ':Title'),
|
||||
classes : {
|
||||
'ui-dialog-content': 'ibo-is-informative ibo-is-'+sSeverity,
|
||||
},
|
||||
content: sMessage,
|
||||
extra_options: {
|
||||
callback_on_modal_close: function () {
|
||||
$(this).dialog( "destroy" );
|
||||
}
|
||||
},
|
||||
buttons: [
|
||||
{
|
||||
text: Dict.S('UI:Button:Ok'),
|
||||
class: 'ibo-is-regular ibo-is-neutral',
|
||||
callback_on_click: function () {
|
||||
$(this).dialog('close');
|
||||
}
|
||||
},
|
||||
],
|
||||
}, oOptions);
|
||||
|
||||
// Open modal
|
||||
CombodoModal.OpenModal(oOptions);
|
||||
}
|
||||
|
||||
// Processing on each pages of the backoffice
|
||||
$(document).ready(function(){
|
||||
// Initialize global keyboard shortcuts
|
||||
|
||||
Reference in New Issue
Block a user