Fixed a missing 'forced_title_callback' and improved the function which creates new macro rows

This commit is contained in:
Alejandro Gallardo Escobar 2015-06-29 18:43:38 +02:00
parent 3498e9e1e7
commit 711775f6a6

View File

@ -475,7 +475,10 @@ function delete_macro(prefix) {
var $row3 = $('#'+prefix+nrow3).remove(); 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(); $('#delete_macro_button').show();
var next_row = parseInt($('#next_row').html()); var next_row = parseInt($('#next_row').html());
@ -539,6 +542,9 @@ function new_macro(prefix) {
$('#text-field' + next_number + '_value').val(''); $('#text-field' + next_number + '_value').val('');
$('#radio-field' + next_number + '_hide').val(0); $('#radio-field' + next_number + '_hide').val(0);
if (typeof callback === 'function')
callback($row1, $row2, $row3);
function changeTdId() { function changeTdId() {
switch(this.id) { switch(this.id) {
case prefix + (nrow1) + '-0': case prefix + (nrow1) + '-0':
@ -677,6 +683,9 @@ function load_plugin_macros_fields(row_model_id) {
add_macro_field(macro, row_model_id); add_macro_field(macro, row_model_id);
} }
}); });
// Add again the hover event to the 'force_callback' elements
forced_title_callback();
} }
} }
}); });