Skip to content

Commit

Permalink
minor syntax fixes from previous merge
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Apr 27, 2016
1 parent 30cecad commit e8b6591
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
29 changes: 17 additions & 12 deletions assets/js/controls/repeater.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,10 +748,10 @@ wp.customize.controlConstructor.repeater = wp.customize.Control.extend({
*
*/
initColorPicker: function() {
var control = this,
var control = this,
colorPicker = control.container.find( '.color-picker-hex' ),
options = {},
fieldId = colorPicker.data( 'field' );
options = {},
fieldId = colorPicker.data( 'field' );

// We check if the color palette parameter is defined.
if ( 'undefined' !== typeof fieldId && 'undefined' !== typeof control.params.fields[ fieldId ] && 'undefined' !== typeof control.params.fields[ fieldId ].palettes && 'object' === typeof control.params.fields[ fieldId ].palettes ) {
Expand All @@ -760,12 +760,15 @@ wp.customize.controlConstructor.repeater = wp.customize.Control.extend({

// When the color picker value is changed we update the value of the field
options.change = function( event, ui ) {
var currentPicker = jQuery( event.target );
var row = currentPicker.closest( '.repeater-row' );
var rowIndex = row.data( 'row' );
var currentSettings = control.getValue();

var currentPicker = jQuery( event.target ),
row = currentPicker.closest( '.repeater-row' ),
rowIndex = row.data( 'row' ),
currentSettings = control.getValue();

currentSettings[ rowIndex ][ currentPicker.data( 'field' ) ] = ui.color.toString();
control.setValue( currentSettings, true );

};

// Init the color picker
Expand All @@ -783,17 +786,17 @@ wp.customize.controlConstructor.repeater = wp.customize.Control.extend({
*
*/
initDropdownPages: function( theNewRow, data ) {
var control = this,
var control = this,
dropdown = theNewRow.container.find( '.repeater-dropdown-pages select' ),
$select,
selectize,
dataField;

if ( dropdown.length === 0 ) {
if ( 0 === dropdown.length ) {
return;
}

$select = jQuery( dropdown ).selectize();
$select = jQuery( dropdown ).selectize();
selectize = $select[0].selectize;
dataField = dropdown.data( 'field' );

Expand All @@ -802,13 +805,15 @@ wp.customize.controlConstructor.repeater = wp.customize.Control.extend({
}

this.container.on( 'change', '.repeater-dropdown-pages select', function( event ) {

var currentDropdown = jQuery( event.target ),
row = currentDropdown.closest( '.repeater-row' ),
rowIndex = row.data( 'row' ),
row = currentDropdown.closest( '.repeater-row' ),
rowIndex = row.data( 'row' ),
currentSettings = control.getValue();

currentSettings[ rowIndex ][ currentDropdown.data( 'field' ) ] = jQuery( this ).val();
control.setValue( currentSettings );

});
}

Expand Down
4 changes: 1 addition & 3 deletions includes/controls/class-kirki-controls-repeater-control.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ public function __construct( $manager, $id, $args = array() ) {
}
}
}

}

/**
Expand All @@ -215,7 +214,6 @@ public function to_json() {
if ( is_array( $this->filtered_value ) && ! empty( $this->filtered_value ) ) {
$this->json['value'] = $this->filtered_value;
}

}

/**
Expand Down Expand Up @@ -255,7 +253,7 @@ public function enqueue() {
protected function render_content() {
?>
<?php $l10n = Kirki_l10n::get_strings(); ?>
<?php if ( '' != $this->tooltip ) : ?>
<?php if ( '' !== $this->tooltip ) : ?>
<a href="#" class="tooltip hint--left" data-hint="<?php echo esc_html( $this->tooltip ); ?>"><span class='dashicons dashicons-info'></span></a>
<?php endif; ?>
<label>
Expand Down

0 comments on commit e8b6591

Please sign in to comment.