Minor fix when create a template and add components

This commit is contained in:
Jose Gonzalez 2020-04-01 17:26:04 +02:00
parent 1b8fa26193
commit c31a288cfd
1 changed files with 17 additions and 13 deletions

View File

@ -151,8 +151,8 @@ class ModuleTemplates extends HTML
// Capture all parameters before start. // Capture all parameters before start.
$this->id_np = get_parameter('id_np', -1); $this->id_np = get_parameter('id_np', -1);
$this->action = get_parameter('action_button', ''); $this->action = get_parameter('action_button', '');
// Profile exists. Set the attributes with the info.
if ($this->id_np > 0 || empty($this->action)) { if ($this->id_np > 0 || empty($this->action)) {
// Profile exists. Set the attributes with the info.
$this->setNetworkProfile(); $this->setNetworkProfile();
} }
@ -907,17 +907,20 @@ class ModuleTemplates extends HTML
], ],
]; ];
// Adding components button. if ($createNewBlock === false) {
$inputs[] = [ // Adding components button.
'arguments' => [ $inputs[] = [
'name' => 'add_components_button', 'arguments' => [
'label' => __('Add components'), 'name' => 'add_components_button',
'type' => 'button', 'label' => __('Add components'),
'attributes' => 'class="sub cog"', 'type' => 'button',
'script' => 'showAddComponent();', 'attributes' => 'class="sub cog"',
'return' => true, 'script' => 'showAddComponent();',
], 'return' => true,
]; ],
];
}
// Required for PEN field. // Required for PEN field.
ui_require_jquery_file('tag-editor'); ui_require_jquery_file('tag-editor');
ui_require_css_file('jquery.tag-editor'); ui_require_css_file('jquery.tag-editor');
@ -1190,7 +1193,8 @@ class ModuleTemplates extends HTML
if (!failed) { if (!failed) {
$(".ui-dialog-content").dialog("close"); $(".ui-dialog-content").dialog("close");
$(".info").hide(); $(".info").hide();
location.reload(); var id_np = <?php echo $this->id_np; ?>;
window.location = window.location.href+'&id_np='+id_np;
} else { } else {
$(this).dialog("close"); $(this).dialog("close");
} }