mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 06:28:46 +02:00
N°5904 - Use attribute linked set edit mode to enable actions (#440)
* Add corresponding buttons depending on old edit mode (need to check with piR pour récuperer l'ancienne valeur. * N°5904 - Handle attribute linked set edit_mode * N°5904 Move calls to private jquery widget methods to public * N°5904 - Worker improvements add button on link tagset * Change itop set widget to new set block UI (5) * Change itop set widget to new set block UI (5) * Renommage variables JS avec le prefix combodo * Search dialog block id conflict with form id * add moved js files in iTopWebPage compatibility list --------- Co-authored-by: Stephen Abello <stephen.abello@combodo.com>
This commit is contained in:
60
js/objects/objects_worker.js
Normal file
60
js/objects/objects_worker.js
Normal file
@@ -0,0 +1,60 @@
|
||||
let ObjectWorker = new function(){
|
||||
|
||||
// defines
|
||||
const ROUTER_BASE_URL = '../pages/ajax.render.php';
|
||||
const ROUTE_MODIFY_OBJECT = 'object.modify';
|
||||
const ROUTE_GET_OBJECT = 'object.get';
|
||||
|
||||
/**
|
||||
* CallAjaxModifyObject.
|
||||
*
|
||||
* @param {string} sObjectClass
|
||||
* @param {string} sObjectKey
|
||||
* @param oOnModalCloseCallback
|
||||
* @param oOnFormSubmittedCallback
|
||||
* @constructor
|
||||
*/
|
||||
const CallAjaxModifyObject = function(sObjectClass, sObjectKey, oOnModalCloseCallback, oOnFormSubmittedCallback){
|
||||
|
||||
let oOptions = {
|
||||
title: Dict.S('UI:Links:ActionRow:Modify:Modal:Title'),
|
||||
content: {
|
||||
endpoint: `${ROUTER_BASE_URL}?route=${ROUTE_MODIFY_OBJECT}`,
|
||||
data: {
|
||||
class: sObjectClass,
|
||||
id: sObjectKey,
|
||||
},
|
||||
},
|
||||
extra_options: {
|
||||
callback_on_modal_close: oOnModalCloseCallback
|
||||
},
|
||||
}
|
||||
|
||||
const oModal = CombodoModal.OpenModal(oOptions);
|
||||
if(oOnFormSubmittedCallback !== null){
|
||||
oModal.on('itop.form.submitted', 'form', oOnFormSubmittedCallback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* CallAjaxGetObject.
|
||||
*
|
||||
* @param {string} sObjectClass
|
||||
* @param {string} sObjectKey
|
||||
* @param oOnResponseCallback
|
||||
* @constructor
|
||||
*/
|
||||
const CallAjaxGetObject = function(sObjectClass, sObjectId, oOnResponseCallback){
|
||||
|
||||
$.post(`${ROUTER_BASE_URL}?route=${ROUTE_GET_OBJECT}`, {
|
||||
object_class: sObjectClass,
|
||||
object_key: sObjectId,
|
||||
}, oOnResponseCallback);
|
||||
};
|
||||
|
||||
|
||||
return {
|
||||
ModifyObject: CallAjaxModifyObject,
|
||||
GetObject: CallAjaxGetObject
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user