Merge pull request #13909 from woocommerce/fix/prevent-only-color-picker-to-flip

Prevent RTL flip only color picker inputs
This commit is contained in:
Claudio Sanches 2017-04-05 21:21:38 -03:00 committed by GitHub
commit 168a4a3096
4 changed files with 31 additions and 19 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3156,6 +3156,7 @@ img.help_tip {
border: 1px solid #ddd;
/* rtl:ignore */
border-right: 0;
margin-left: -3px;
}
.colorpick {

View File

@ -291,41 +291,52 @@ class WC_Admin_Settings {
case 'text':
case 'email':
case 'number':
case 'color' :
case 'password' :
$type = $value['type'];
$option_value = self::get_option( $value['id'], $value['default'] );
if ( 'color' === $value['type'] ) {
$type = 'text';
$value['class'] .= 'colorpick';
$description .= '<div id="colorPickerDiv_' . esc_attr( $value['id'] ) . '" class="colorpickdiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div>';
}
?><tr valign="top">
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
<?php echo $tooltip_html; ?>
</th>
<td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>">
&lrm;
<?php
if ( 'color' == $value['type'] ) {
echo '<span class="colorpickpreview" style="background: ' . esc_attr( $option_value ) . ';"></span>';
}
?>
<input
name="<?php echo esc_attr( $value['id'] ); ?>"
id="<?php echo esc_attr( $value['id'] ); ?>"
type="<?php echo esc_attr( $type ); ?>"
dir="ltr"
type="<?php echo esc_attr( $value['type'] ); ?>"
style="<?php echo esc_attr( $value['css'] ); ?>"
value="<?php echo esc_attr( $option_value ); ?>"
class="<?php echo esc_attr( $value['class'] ); ?>"
placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>"
<?php echo implode( ' ', $custom_attributes ); ?>
/> <?php echo $description; ?>
</td>
</tr><?php
break;
// Color picker.
case 'color' :
$option_value = self::get_option( $value['id'], $value['default'] );
?><tr valign="top">
<th scope="row" class="titledesc">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?></label>
<?php echo $tooltip_html; ?>
</th>
<td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>">&lrm;
<span class="colorpickpreview" style="background: <?php echo esc_attr( $option_value ); ?>"></span>
<input
name="<?php echo esc_attr( $value['id'] ); ?>"
id="<?php echo esc_attr( $value['id'] ); ?>"
type="text"
dir="ltr"
style="<?php echo esc_attr( $value['css'] ); ?>"
value="<?php echo esc_attr( $option_value ); ?>"
class="<?php echo esc_attr( $value['class'] ); ?>colorpick"
placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>"
<?php echo implode( ' ', $custom_attributes ); ?>
/>&lrm; <?php echo $description; ?>
<div id="colorPickerDiv_<?php echo esc_attr( $value['id'] ); ?>" class="colorpickdiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div>
</td>
</tr><?php
break;