Permalink
Browse files

Add "delete" action for editing conditionals.

Closes #25
  • Loading branch information...
1 parent f3bcd60 commit 254a05a2056b298615e037001c6fdde56ca54a55 @danielbachhuber danielbachhuber committed Apr 30, 2012
Showing with 31 additions and 7 deletions.
  1. +21 −5 common/css/acm.css
  2. +9 −1 common/js/acm.js
  3. +1 −1 common/lib/acm-wp-list-table.php
View
@@ -19,15 +19,23 @@ tr:hover .row-actions {
}
.conditional-single-field {
- clear: left;
+ clear: both;
+}
+
+.acm-remove-conditional {
+ float: right;
+ color: #D54E21;
}
.conditional-single-field .conditional-function {
float: left;
+}
+
+#add-adcode .conditional-single-field .conditional-function {
width: 50%;
}
-.conditional-single-field .conditional-arguments {
+#add-adcode .conditional-single-field .conditional-arguments {
float: left;
width: 45%;
margin-bottom: 5px;
@@ -61,10 +69,18 @@ tr:hover .row-actions {
min-width: 270px;
}
+.inline-edit-col .acm-conditional-fields .conditional-arguments {
+ margin-left: 140px;
+}
+
+.inline-edit-col .acm-conditional-fields .conditional-arguments input {
+ width: 70%;
+ margin-bottom: 5px;
+}
+
.inline-edit-col .acm-conditional-fields .form-add-more {
- padding-top: 5px;
- padding-bottom: 4px;
- clear: left;
+ margin-top: 10px;
+ clear: both;
}
#add-adcode .form-add-more {
View
@@ -8,9 +8,9 @@ inlineEditAdCodes = {
$('.acm-ajax-edit').live('click', function(){
inlineEditAdCodes.edit(this);
- console.log( 'y' );
jQuery('.add-more-conditionals').off( 'click.acm_add_more_conditionals', acm_add_more_conditionals );
jQuery('.add-more-conditionals').on( 'click.acm_add_more_conditionals', acm_add_more_conditionals );
+ jQuery('.acm-remove-conditional').on( 'click.acm_remove_conditional', acm_remove_conditional );
return false;
});
@@ -115,7 +115,15 @@ $(document).ready(function(){inlineEditAdCodes.init();});
var acm_add_more_conditionals = function() {
var temp = jQuery( 'div#conditional-single-field-master').clone( false );
temp.removeAttr('id');
+ jQuery(temp).find('.conditional-arguments').append( '<a href="#" class="acm-remove-conditional">Remove</a>' );
jQuery(this).closest('.acm-conditional-fields').find('.form-new-row').append(temp);
+ jQuery('.acm-remove-conditional').off( 'click.acm_remove_conditional', acm_remove_conditional );
+ jQuery('.acm-remove-conditional').on( 'click.acm_remove_conditional', acm_remove_conditional );
+ return false;
+}
+
+var acm_remove_conditional = function() {
+ jQuery(this).closest('.conditional-single-field').remove();
return false;
}
@@ -158,7 +158,7 @@ function column_id( $item ) {
$output .= '</select>';
$output .= '</div><div class="conditional-arguments">';
$output .= '<input name="acm-arguments[]" type="text" value="' . esc_attr( implode( ';', $arguments ) ) .'" size="20" />';
- $output .= '</div></div>';
+ $output .= '<a href="#" class="acm-remove-conditional">Remove</a></div></div>';
}
}
$output .= '</div><div class="form-field form-add-more"><a href="#" class="button button-secondary add-more-conditionals">' . __( 'Add more', 'ad-code-manager' ) . '</a></div>';

0 comments on commit 254a05a

Please sign in to comment.