Added handles. Closes #137.

This commit is contained in:
Mike Jolley 2011-11-07 14:13:04 +00:00
parent b37439592f
commit 0d74014d4a
6 changed files with 18 additions and 5 deletions

View File

@ -185,6 +185,7 @@ function woocommerce_product_data_box() {
<table cellpadding="0" cellspacing="0" class="woocommerce_attributes">
<thead>
<tr>
<th>&nbsp;</th>
<th width="180"><?php _e('Attribute Name', 'woothemes'); ?></th>
<th><?php _e('Value(s)', 'woothemes'); ?>&nbsp;<a class="tips" tip="<?php _e('Add multiple attributes for text attributes by pipe (|) separating values.', 'woothemes'); ?>" href="#">[?]</a></th>
<th class="center" width="1%"><?php _e('Visible?', 'woothemes'); ?>&nbsp;<a class="tips" tip="<?php _e('Enable this to show the attribute on the product page.', 'woothemes'); ?>" href="#">[?]</a></th>
@ -221,6 +222,7 @@ function woocommerce_product_data_box() {
$has_terms = (is_wp_error($post_terms) || !$post_terms || sizeof($post_terms)==0) ? 0 : 1;
?><tr class="taxonomy <?php echo $attribute_taxonomy_name; ?>" rel="<?php echo $position; ?>" <?php if (!$has_terms) echo 'style="display:none"'; ?>>
<td class="handle"></td>
<td class="name">
<?php echo ($tax->attribute_label) ? $tax->attribute_label : $tax->attribute_name; ?>
<input type="hidden" name="attribute_names[<?php echo $i; ?>]" value="<?php echo esc_attr( $attribute_taxonomy_name ); ?>" />
@ -271,6 +273,7 @@ function woocommerce_product_data_box() {
$position = (isset($attribute['position'])) ? $attribute['position'] : 0;
?><tr rel="<?php if (isset($attribute['position'])) echo $attribute['position']; else echo '0'; ?>">
<td class="handle"></td>
<td>
<input type="text" name="attribute_names[<?php echo $i; ?>]" value="<?php echo esc_attr( $attribute['name'] ); ?>" />
<input type="hidden" name="attribute_position[<?php echo $i; ?>]" class="attribute_position" value="<?php echo esc_attr( $position ); ?>" />

View File

@ -131,11 +131,12 @@ div.taxrows .taxrow label.checkbox{line-height:1.5em;margin:0 8px;}div.taxrows .
.woocommerce_options_panel .short{width:20%;}
.woocommerce_options_panel .sized{width:auto !important;margin-right:6px;}
.woocommerce_options_panel .options_group{border-top:1px solid white;border-bottom:1px solid #DFDFDF;}
#woocommerce_attributes td.handle{vertical-align:middle;width:14px;background:url(../images/handle.png) no-repeat right center;cursor:move;padding-right:0;}
#woocommerce_attributes,#variable_product_options{padding:12px;}
.woocommerce_attributes_wrapper,.woocommerce_variable_attributes_wrapper{margin-bottom:7px;border:1px solid #ececec;}
table.woocommerce_attributes,table.woocommerce_variable_attributes{width:100%;}
table.woocommerce_attributes,table.woocommerce_variable_attributes{width:100%;position:relative;}
table.woocommerce_attributes thead th,table.woocommerce_variable_attributes thead th{background:#ececec;padding:7px 9px;font-size:11px;text-align:left;}
table.woocommerce_attributes td,table.woocommerce_variable_attributes td{padding:2px 9px;text-align:left;vertical-align:middle;border-bottom:1px dotted #ececec;cursor:move;}
table.woocommerce_attributes td,table.woocommerce_variable_attributes td{padding:2px 9px;text-align:left;vertical-align:middle;border-bottom:1px dotted #ececec;}
table.woocommerce_attributes td input,table.woocommerce_variable_attributes td input,table.woocommerce_variable_attributes td textarea{width:100%;}
table.woocommerce_attributes td select{width:100%;}
table.woocommerce_attributes td select.multiselect{height:8em !important;}

View File

@ -745,6 +745,13 @@ div.taxrows {
border-bottom: 1px solid #DFDFDF;
}
#woocommerce_attributes td.handle {
vertical-align: middle;
width: 14px;
background: url(../images/handle.png) no-repeat right center;
cursor: move;
padding-right: 0;
}
#woocommerce_attributes, #variable_product_options {
padding: 12px;
}
@ -754,6 +761,7 @@ div.taxrows {
}
table.woocommerce_attributes, table.woocommerce_variable_attributes {
width: 100%;
position: relative;
}
table.woocommerce_attributes thead th, table.woocommerce_variable_attributes thead th {
background: #ececec;
@ -766,7 +774,6 @@ table.woocommerce_attributes td, table.woocommerce_variable_attributes td {
text-align: left;
vertical-align: middle;
border-bottom: 1px dotted #ececec;
cursor: move;
}
table.woocommerce_attributes td input, table.woocommerce_variable_attributes td input, table.woocommerce_variable_attributes td textarea {
width: 100%;

BIN
assets/images/handle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

View File

@ -295,7 +295,7 @@ jQuery( function($){
if (product_type!='variable') enable_variation = 'style="display:none;"'; else enable_variation = '';
// Add custom attribute row
$('table.woocommerce_attributes tbody').append('<tr><td><input type="text" name="attribute_names[' + size + ']" /><input type="hidden" name="attribute_is_taxonomy[' + size + ']" value="0" /><input type="hidden" name="attribute_position[' + size + ']" class="attribute_position" value="' + size + '" /></td><td><input type="text" name="attribute_values[' + size + ']" /></td><td class="center"><input type="checkbox" checked="checked" name="attribute_visibility[' + size + ']" value="1" /></td><td class="center enable_variation" ' + enable_variation + '><input type="checkbox" name="attribute_variation[' + size + ']" value="1" /></td><td class="center"><button type="button" class="remove_row button">&times;</button></td></tr>');
$('table.woocommerce_attributes tbody').append('<tr><td class="handle"></td><td><input type="text" name="attribute_names[' + size + ']" /><input type="hidden" name="attribute_is_taxonomy[' + size + ']" value="0" /><input type="hidden" name="attribute_position[' + size + ']" class="attribute_position" value="' + size + '" /></td><td><input type="text" name="attribute_values[' + size + ']" /></td><td class="center"><input type="checkbox" checked="checked" name="attribute_visibility[' + size + ']" value="1" /></td><td class="center enable_variation" ' + enable_variation + '><input type="checkbox" name="attribute_variation[' + size + ']" value="1" /></td><td class="center"><button type="button" class="remove_row button">&times;</button></td></tr>');
} else {
@ -335,11 +335,13 @@ jQuery( function($){
items:'tr',
cursor:'move',
axis:'y',
handle: '.handle',
scrollSensitivity:40,
helper:function(e,ui){
ui.children().each(function(){
$(this).width($(this).width());
});
ui.css('left', '0');
return ui;
},
start:function(event,ui){

File diff suppressed because one or more lines are too long