WordPress.org

Making WordPress.org

Changeset 7260


Ignore:
Timestamp:
06/01/2018 04:36:22 PM (4 years ago)
Author:
vedjain
Message:

WCPT: Enqueue select2 library and initialize select2 for all dropdowns in metaboxes.

This will improve searchability. This is only an UX change. Enqueue select library already added in meta.

Location:
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/javascript/wcpt-wordcamp/admin.js

    r4525 r7260  
    8989            self.updateMentor( $option );
    9090        });
     91
     92        if ( $.fn.hasOwnProperty( 'select2' ) ) {
     93            $select.select2();
     94        }
    9195    };
    9296
     
    110114    };
    111115
    112     /**
     116    /**
     117     * Initialize select2 for currency.
     118     */
     119    $( document ).ready( function initializeSelect2() {
     120        if ( ! $.fn.hasOwnProperty( 'select2' ) ) {
     121            return;
     122        }
     123        $( '#wcpt_information select' ).select2();
     124    });
     125
     126    /**
    113127     * Kick things off
    114     */
     128    */
    115129    $( document ).ready( function( $ ) {
    116130        self.initialize();
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php

    r7098 r7260  
    568568            );
    569569        }
     570        wp_enqueue_script( 'select2' );
    570571    }
    571572
     
    575576            wp_enqueue_style( 'wp-datepicker-skins' );
    576577        }
     578        wp_enqueue_style( 'select2' );
    577579    }
    578580
     
    12431245                                </select>
    12441246                            <?php else : ?>
    1245                                 <select name="<?php echo $object_name; ?>" id="<?php echo $object_name; ?>">
     1247                                <select name="<?php echo esc_attr( $object_name ); ?>" id="<?php echo esc_attr( $object_name ); ?>" class="select-currency">
    12461248                                    <?php foreach ( $currencies as $symbol => $name ) : ?>
    12471249                                        <option value="<?php echo esc_attr( $symbol ); ?>"<?php selected( $symbol, get_post_meta( $post_id, $key, true ) ); ?>>
Note: See TracChangeset for help on using the changeset viewer.