Added buttons to edit cutomcode directly from where it is added in other areas around the component. This will improve the customcode workflow in JCB.
This commit is contained in:
@ -965,7 +965,8 @@ jQuery(document).ready(function()
|
||||
setTimeout(setDisplays2, 2500);
|
||||
setTimeout(setDisplays3, 3500);
|
||||
|
||||
// very basic I know... but it will have to do for now.
|
||||
// check and load all the customcode edit buttons
|
||||
setTimeout(getEditCustomCodeButtons, 400);
|
||||
});
|
||||
|
||||
function getAjaxDisplay(type){
|
||||
@ -1011,6 +1012,45 @@ function dasboardSwitch(value){
|
||||
}
|
||||
|
||||
|
||||
function getEditCustomCodeButtons_server(id){
|
||||
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod;
|
||||
if(token.length > 0 && id > 0){
|
||||
var request = 'token='+token+'&id='+id+'&return_here='+return_here;
|
||||
}
|
||||
return jQuery.ajax({
|
||||
type: 'GET',
|
||||
url: getUrl,
|
||||
dataType: 'json',
|
||||
data: request,
|
||||
jsonp: false
|
||||
});
|
||||
}
|
||||
|
||||
function getEditCustomCodeButtons(){
|
||||
// get the id
|
||||
id = jQuery("#jform_id").val();
|
||||
getEditCustomCodeButtons_server(id).done(function(result) {
|
||||
if(isObject(result)){
|
||||
jQuery.each(result, function( field, buttons ) {
|
||||
jQuery('<div class="control-group"><div class="control-label"><label>Edit Customcode</label></div><div class="controls control-customcode-buttons-'+field+'"></div></div>').insertBefore(".control-wrapper-"+ field);
|
||||
jQuery.each(buttons, function( name, button ) {
|
||||
jQuery(".control-customcode-buttons-"+field).append(button);
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// check object is not empty
|
||||
function isObject(obj) {
|
||||
for(var prop in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function addButtonID_server(type, size){
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButtonID&format=json&raw=true&vdm="+vastDevMod);
|
||||
if(token.length > 0 && type.length > 0 && size > 0){
|
||||
|
Reference in New Issue
Block a user