Skip to content

Commit

Permalink
Fix bug bainternet#96.
Browse files Browse the repository at this point in the history
Added back .parent() removed for bug bainternet#92 fix.
Added class re-control markups missing for newly created repeater blocks. That way, HTML markup is more consistent between newly and already added (after post updating) blocks, and nesting level is the same for all blocks.
  • Loading branch information
smeric committed Dec 4, 2013
1 parent a9fc8aa commit 6bcf3a5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions meta-box-class/my-meta-box-class.php
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,9 @@ public function show_field_repeater( $field, $meta ) {
if ($field['inline']){
echo '</tr>';
}
echo '</table><img src="'.$plugin_path.'/images/remove.png" alt="'.__('Remove','mmb').'" title="'.__('Remove','mmb').'" id="remove-'.$field['id'].'"></div>';
echo '</table>
<span class="re-control"><img src="'.$plugin_path.'/images/remove.png" alt="'.__('Remove','mmb').'" title="'.__('Remove','mmb').'" id="remove-'.$field['id'].'"></span>
<span class="re-control-clear"></span></div>';
$counter = 'countadd_'.$field['id'];
$js_code = ob_get_clean ();
$js_code = str_replace("\n","",$js_code);
Expand All @@ -471,11 +473,11 @@ public function show_field_repeater( $field, $meta ) {
jQuery(this).before(\''.$js_code.'\');
update_repeater_fields();
});
jQuery("#remove-'.$field['id'].'").live(\'click\', function() {
jQuery(this).parent().remove();
});
jQuery("#remove-'.$field['id'].'").live(\'click\', function() {
jQuery(this).parent().parent().remove();
});
</script>';
});
</script>';
$this->show_field_end($field, $meta);
}

Expand Down

1 comment on commit 6bcf3a5

@BobbyRuby
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

righteo.

Please sign in to comment.