Skip to content

Commit

Permalink
Set up select2 and selectWoo
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiulodro committed Jul 6, 2017
1 parent e8bd694 commit a2867fa
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ exclude_paths:
- assets/js/jquery-*
- assets/js/prettyPhoto/*
- assets/js/round/*
- assets/js/select2/*
- assets/js/selectWoo/*
- assets/js/stupidtable/*
- assets/js/zeroclipboard/*
1 change: 0 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ module.exports = function( grunt ) {
'<%= dirs.js %>/photoswipe/photoswipe.min.js': ['<%= dirs.js %>/photoswipe/photoswipe.js'],
'<%= dirs.js %>/photoswipe/photoswipe-ui-default.min.js': ['<%= dirs.js %>/photoswipe/photoswipe-ui-default.js'],
'<%= dirs.js %>/round/round.min.js': ['<%= dirs.js %>/round/round.js'],
'<%= dirs.js %>/select2/select2.min.js': ['<%= dirs.js %>/select2/select2.js'],
'<%= dirs.js %>/stupidtable/stupidtable.min.js': ['<%= dirs.js %>/stupidtable/stupidtable.js'],
'<%= dirs.js %>/zeroclipboard/jquery.zeroclipboard.min.js': ['<%= dirs.js %>/zeroclipboard/jquery.zeroclipboard.js']
}
Expand Down
3 changes: 2 additions & 1 deletion includes/admin/class-wc-admin-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ public function admin_scripts() {
wp_register_script( 'wc-shipping-zones', WC()->plugin_url() . '/assets/js/admin/wc-shipping-zones' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-ui-sortable', 'wc-enhanced-select', 'wc-backbone-modal' ), WC_VERSION );
wp_register_script( 'wc-shipping-zone-methods', WC()->plugin_url() . '/assets/js/admin/wc-shipping-zone-methods' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-ui-sortable', 'wc-backbone-modal' ), WC_VERSION );
wp_register_script( 'wc-shipping-classes', WC()->plugin_url() . '/assets/js/admin/wc-shipping-classes' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone' ), WC_VERSION );
wp_register_script( 'select2', WC()->plugin_url() . '/assets/js/selectWoo/selectWoo.full' . $suffix . '.js', array( 'jquery' ), '5.0.0' );
wp_register_script( 'select2', WC()->plugin_url() . '/assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), '4.0.3' );
wp_register_script( 'selectWoo', WC()->plugin_url() . '/assets/js/selectWoo/selectWoo.full' . $suffix . '.js', array( 'jquery' ), '1.0.0' );
wp_register_script( 'wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select' . $suffix . '.js', array( 'jquery', 'select2' ), WC_VERSION );
wp_localize_script( 'wc-enhanced-select', 'wc_enhanced_select_params', array(
'i18n_no_matches' => _x( 'No matches found', 'enhanced select', 'woocommerce' ),
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/class-wc-admin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public static function output() {

do_action( 'woocommerce_settings_start' );

wp_enqueue_script( 'woocommerce_settings', WC()->plugin_url() . '/assets/js/admin/settings' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'iris', 'select2' ), WC()->version, true );
wp_enqueue_script( 'woocommerce_settings', WC()->plugin_url() . '/assets/js/admin/settings' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'iris', 'selectWoo' ), WC()->version, true );

wp_localize_script( 'woocommerce_settings', 'woocommerce_settings_params', array(
'i18n_nav_warning' => __( 'The changes you made will be lost if you navigate away from this page.', 'woocommerce' ),
Expand Down
4 changes: 2 additions & 2 deletions includes/admin/class-wc-admin-setup-wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ public function setup_wizard() {
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';

wp_register_script( 'jquery-blockui', WC()->plugin_url() . '/assets/js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array( 'jquery' ), '2.70', true );
wp_register_script( 'select2', WC()->plugin_url() . '/assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), '4.0.3' );
wp_register_script( 'wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select' . $suffix . '.js', array( 'jquery', 'select2' ), WC_VERSION );
wp_register_script( 'selectWoo', WC()->plugin_url() . '/assets/js/selectWoo/selectWoo.full' . $suffix . '.js', array( 'jquery' ), '1.0.0' );
wp_register_script( 'wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select' . $suffix . '.js', array( 'jquery', 'selectWoo' ), WC_VERSION );
wp_localize_script( 'wc-enhanced-select', 'wc_enhanced_select_params', array(
'i18n_no_matches' => _x( 'No matches found', 'enhanced select', 'woocommerce' ),
'i18n_ajax_error' => _x( 'Loading failed', 'enhanced select', 'woocommerce' ),
Expand Down
9 changes: 7 additions & 2 deletions includes/class-wc-frontend-scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,14 @@ private static function register_scripts() {
'version' => WC_VERSION,
),
'select2' => array(
'src' => self::get_asset_url( 'assets/js/select2/select2.full' . $suffix . '.js' ),
'deps' => array( 'jquery' ),
'version' => '4.0.3',
),
'selectWoo' => array(
'src' => self::get_asset_url( 'assets/js/selectWoo/selectWoo.full' . $suffix . '.js' ),
'deps' => array( 'jquery' ),
'version' => '5.0.0',
'version' => '1.0.0',
),
'wc-address-i18n' => array(
'src' => self::get_asset_url( 'assets/js/frontend/address-i18n' . $suffix . '.js' ),
Expand Down Expand Up @@ -367,7 +372,7 @@ public static function load_scripts() {
self::enqueue_script( 'wc-cart' );
}
if ( is_checkout() || is_account_page() ) {
self::enqueue_script( 'select2' );
self::enqueue_script( 'selectWoo' );
self::enqueue_style( 'select2' );

// Password strength meter. Load in checkout, account login and edit account page.
Expand Down

0 comments on commit a2867fa

Please sign in to comment.