WordPress.org

Plugin Directory

Changeset 542945


Ignore:
Timestamp:
05/11/12 16:20:23 (2 years ago)
Author:
Omicron7
Message:

Version 1.0.1 release

Location:
advanced-custom-fields-address-field-add-on/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • advanced-custom-fields-address-field-add-on/trunk/address-field.js

    r502762 r542945  
    3030        }); 
    3131    } 
    32      
    33     // This sets the default values, ACF clears them on new fields 
    34     // see http://www.advancedcustomfields.com/support/discussion/1247/field-input-defaults-removed-when-clicking-add-field. 
    35     $('#acf_fields #add_field').live('click',function(){ 
    36          
    37         setTimeout(function() { 
    38             var new_field = $('#acf_fields div.field_clone').prev('.field'); 
    39              
    40             $('.address_label:input, .address_default_value:input, .address_class:input, .address_separator:input', new_field).each(function() { 
    41                 var $this = $(this), 
    42                     names = split_acf_name($this.attr('name')), 
    43                     component = ''; 
    44                  
    45                 if($this.hasClass('address_label')) 
    46                     component = 'label'; 
    47                 else if($this.hasClass('address_default_value')) 
    48                     component = 'default_value'; 
    49                 else if($this.hasClass('address_class')) 
    50                     component = 'class'; 
    51                 else 
    52                     component = 'separator'; 
    53  
    54                 $this.val( acf_address_field_defaults[ names[2] ][ component ] ); 
    55                      
    56             }).change(); 
    57              
    58         }, 100); 
    59              
    60     }); 
    6132     
    6233    $('#acf_fields .address_enabled input[type="checkbox"]').live('change', function() { 
     
    10778    } 
    10879     
     80    //Initialize existing address fields or fields that have changed to address fields 
    10981    $('#acf_fields .field_type select.select').live('change', function() { 
    11082        var $this = $(this), 
     
    11284         
    11385        if($this.val() == 'address-field') { 
    114             init_address_layout( $('.address_layout', field) ); 
     86            //If address-field already exists, initialize it 
     87            if($('.field_option_address-field', field).exists() ) { 
     88                init_address_layout( $('.address_layout', field) ); 
     89            } 
    11590        } 
    11691    }); 
    11792     
     93    //Listen to ajax requests and initialize and new address fields 
     94    $(document).bind('ajaxSuccess', function(e, xhr, settings) { 
     95        if( settings.url == ajaxurl && settings.data.indexOf('field_type=address-field') != -1 ) { 
     96            init_address_layout( $('.address_layout' ) ); 
     97        } 
     98    }); 
     99     
     100    //Trigger change even to initialize all address fields on document.ready event. 
     101    $(function(){ 
     102        $('#acf_fields .field_type select.select').trigger('change'); 
     103    }) 
     104     
    118105})(jQuery) 
  • advanced-custom-fields-address-field-add-on/trunk/address-field.php

    r502762 r542945  
    66* Author:      Brian Zoetewey 
    77* Author URI:  https://github.com/GCX 
    8 * Version:     1.0 
     8* Version:     1.0.1 
    99* Text Domain: acf-address-field 
    1010* Domain Path: /languages/ 
     
    5353 *  
    5454 * @author Brian Zoetewey <brian.zoetewey@ccci.org> 
    55  * @version 1.0 
     55 * @version 1.0.1 
    5656 */ 
    5757class ACF_Address_Field extends acf_Field { 
     
    9494        $this->l10n_domain = ACF_Address_Field_Helper::L10N_DOMAIN; 
    9595         
    96         $this->base_dir = rtrim( dirname( realpath( __FILE__ ) ), '/' ); 
     96        $this->base_dir = rtrim( dirname( realpath( __FILE__ ) ), DIRECTORY_SEPARATOR ); 
    9797         
    9898        //Build the base relative uri by searching backwards until we encounter the wordpress ABSPATH 
    99         $root = array_pop( explode( '/', rtrim( ABSPATH, '/' ) ) ); 
    100         $path_parts = explode( '/', $this->base_dir ); 
     99        $root = array_pop( explode( DIRECTORY_SEPARATOR, rtrim( ABSPATH, DIRECTORY_SEPARATOR ) ) ); 
     100        $path_parts = explode( DIRECTORY_SEPARATOR, $this->base_dir ); 
    101101        $parts = array(); 
    102102        while( $part = array_pop( $path_parts ) ) { 
     
    147147        wp_register_script( 'acf-address-field', $this->base_uri_abs . '/address-field.js', array( 'jquery-ui-sortable' ) ); 
    148148         
    149         // This passes the defaults for the address field into javascript so we can use them there. 
    150         $defaults = array(); 
    151         $this->set_field_defaults( $defaults ); 
    152         wp_localize_script( 'acf-address-field', 'acf_address_field_defaults', $defaults[ 'address_components' ] ); 
    153  
    154149        if( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) { 
    155150            wp_enqueue_script( 'acf-address-field' ); 
  • advanced-custom-fields-address-field-add-on/trunk/readme.txt

    r502762 r542945  
    33Tags: acf, acf add-on, address, custom field, address field 
    44Requires at least: 3.0 
    5 Tested up to: 3.3.1 
    6 Stable tag: 1.0 
     5Tested up to: 3.3.2 
     6Stable tag: 1.0.1 
    77 
    88Adds an Address Field to Advanced Custom Fields. Pick and choose the components and layout of the address. 
     
    5353== Changelog == 
    5454 
     55= 1.0.1 = 
     56* Fixed issue with path and URI generation on Windows hosts. 
     57* Fixed issue caused by ACF loading new fields with AJAX. Drag and Drop should work again. 
     58 
    5559= 1.0 = 
    5660* Initial Release 
Note: See TracChangeset for help on using the changeset viewer.