From 711775f6a6e40c8677c21de1ab47a70bdc1e75d1 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 29 Jun 2015 18:43:38 +0200 Subject: [PATCH] Fixed a missing 'forced_title_callback' and improved the function which creates new macro rows --- pandora_console/include/javascript/pandora_modules.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js index 1c1b88c27f..86ee03e9d1 100644 --- a/pandora_console/include/javascript/pandora_modules.js +++ b/pandora_console/include/javascript/pandora_modules.js @@ -475,7 +475,10 @@ function delete_macro(prefix) { var $row3 = $('#'+prefix+nrow3).remove(); } -function new_macro(prefix) { +// The callback parameter is for a callback function +// that will receive the 3 rows (function(row1, row2, row3)) +// to edit them before the new_macro function ends. +function new_macro(prefix, callback) { $('#delete_macro_button').show(); var next_row = parseInt($('#next_row').html()); @@ -539,6 +542,9 @@ function new_macro(prefix) { $('#text-field' + next_number + '_value').val(''); $('#radio-field' + next_number + '_hide').val(0); + if (typeof callback === 'function') + callback($row1, $row2, $row3); + function changeTdId() { switch(this.id) { case prefix + (nrow1) + '-0': @@ -677,6 +683,9 @@ function load_plugin_macros_fields(row_model_id) { add_macro_field(macro, row_model_id); } }); + + // Add again the hover event to the 'force_callback' elements + forced_title_callback(); } } });