Changeset 41771
- Timestamp:
- 10/05/2017 02:55:11 AM (7 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/customize-controls.css
r41768 r41771 153 153 margin-top: 20px; 154 154 } 155 #customize-control-trash_changeset button{155 #customize-control-trash_changeset .button-link { 156 156 position: relative; 157 157 padding-left: 24px; 158 158 display: inline-block; 159 159 } 160 #customize-control-trash_changeset button:before {160 #customize-control-trash_changeset .button-link:before { 161 161 content: "\f182"; 162 162 font: normal 22px dashicons; -
trunk/src/wp-admin/js/customize-controls.js
r41768 r41771 3142 3142 3143 3143 initialize: function( id, options ) { 3144 var control = this, deferredSettingIds = [], settings, gatherSettings ;3144 var control = this, deferredSettingIds = [], settings, gatherSettings, standardTypes; 3145 3145 3146 3146 control.params = _.extend( {}, control.defaults ); … … 3175 3175 control.id = id; 3176 3176 control.selector = '#customize-control-' + id.replace( /\]/g, '' ).replace( /\[/g, '-' ); // Deprecated, likely dead code from time before #28709. 3177 control.templateSelector = control.params.templateId || 'customize-control-' + control.params.type + '-content';3178 3177 if ( control.params.content ) { 3179 3178 control.container = $( control.params.content ); 3180 3179 } else { 3181 3180 control.container = $( control.selector ); // Likely dead, per above. See #28709. 3181 } 3182 3183 standardTypes = [ 3184 'button', 3185 'checkbox', 3186 'color', 3187 'date', 3188 'datetime-local', 3189 'email', 3190 'month', 3191 'number', 3192 'password', 3193 'radio', 3194 'range', 3195 'search', 3196 'select', 3197 'tel', 3198 'time', 3199 'text', 3200 'textarea', 3201 'week', 3202 'url' 3203 ]; 3204 if ( control.params.templateId ) { 3205 control.templateSelector = control.params.templateId; 3206 } else if ( _.contains( standardTypes, control.params.type ) && control.container.is( ':empty' ) ) { 3207 control.templateSelector = 'customize-control-default-content'; 3208 } else { 3209 control.templateSelector = 'customize-control-' + control.params.type + '-content'; 3182 3210 } 3183 3211 … … 6447 6475 section: section.id, 6448 6476 priority: 30, 6449 templateId: 'customize-trash-changeset-control' 6477 inputAttrs: { 6478 'class': 'button-link button-link-delete', 6479 value: api.l10n.discardChanges 6480 } 6450 6481 } ); 6451 6482 api.control.add( trashControl ); 6452 6483 trashControl.deferred.embedded.done( function() { 6453 trashControl.container.find( ' button' ).on( 'click', function() {6484 trashControl.container.find( '.button-link' ).on( 'click', function() { 6454 6485 if ( confirm( api.l10n.trashConfirm ) ) { 6455 6486 wp.customize.previewer.trash(); -
trunk/src/wp-includes/class-wp-customize-control.php
r41768 r41771 483 483 $input_id = '_customize-input-' . $this->id; 484 484 $description_id = '_customize-description-' . $this->id; 485 $describedby_attr = ( ! empty( $this->description ) ) ? ' aria-describedby="' . esc_attr( $description_id ) . '"' : '';485 $describedby_attr = ( ! empty( $this->description ) ) ? ' aria-describedby="' . esc_attr( $description_id ) . '" ' : ''; 486 486 switch ( $this->type ) { 487 487 case 'checkbox': … … 521 521 <input 522 522 id="<?php echo esc_attr( $input_id . '-radio-' . $value ); ?>" 523 type="radio" <?php echo $describedby_attr; ?> 523 type="radio" 524 <?php echo $describedby_attr; ?> 524 525 value="<?php echo esc_attr( $value ); ?>" 525 526 name="<?php echo esc_attr( $name ); ?>" -
trunk/src/wp-includes/class-wp-customize-manager.php
r41768 r41771 3601 3601 $control->print_template(); 3602 3602 } 3603 3604 3603 ?> 3604 3605 <script type="text/html" id="tmpl-customize-control-default-content"> 3606 <# 3607 var inputId = _.uniqueId( 'customize-control-default-input-' ); 3608 var descriptionId = _.uniqueId( 'customize-control-default-description-' ); 3609 var describedByAttr = data.description ? ' aria-describedby="' + descriptionId + '" ' : ''; 3610 #> 3611 <# switch ( data.type ) { 3612 case 'checkbox': #> 3613 <span class="customize-inside-control-row"> 3614 <input 3615 id="{{ inputId }}" 3616 {{{ describedByAttr }}} 3617 type="checkbox" 3618 value="{{ data.value }}" 3619 data-customize-setting-key-link="default" 3620 > 3621 <label for="{{ inputId }}"> 3622 {{ data.label }} 3623 </label> 3624 <# if ( data.description ) { #> 3625 <span id="{{ descriptionId }}" class="description customize-control-description">{{{ data.description }}}</span> 3626 <# } #> 3627 </span> 3628 <# 3629 break; 3630 case 'radio': 3631 if ( ! data.choices ) { 3632 return; 3633 } 3634 #> 3635 <# if ( data.label ) { #> 3636 <label for="{{ inputId }}" class="customize-control-title"> 3637 {{ data.label }} 3638 </label> 3639 <# } #> 3640 <# if ( data.description ) { #> 3641 <span id="{{ descriptionId }}" class="description customize-control-description">{{{ data.description }}}</span> 3642 <# } #> 3643 <# _.each( data.choices, function( val, key ) { #> 3644 <span class="customize-inside-control-row"> 3645 <# 3646 var value, text; 3647 if ( _.isObject( val ) ) { 3648 value = val.value; 3649 text = val.text; 3650 } else { 3651 value = key; 3652 text = val; 3653 } 3654 #> 3655 <input 3656 id="{{ inputId + '-' + value }}" 3657 type="radio" 3658 value="{{ value }}" 3659 name="{{ inputId }}" 3660 data-customize-setting-key-link="default" 3661 {{{ describedByAttr }}} 3662 > 3663 <label for="{{ inputId + '-' + value }}">{{ text }}</label> 3664 </span> 3665 <# } ); #> 3666 <# 3667 break; 3668 default: 3669 #> 3670 <# if ( data.label ) { #> 3671 <label for="{{ inputId }}" class="customize-control-title"> 3672 {{ data.label }} 3673 </label> 3674 <# } #> 3675 <# if ( data.description ) { #> 3676 <span id="{{ descriptionId }}" class="description customize-control-description">{{{ data.description }}}</span> 3677 <# } #> 3678 3679 <# 3680 var inputAttrs = { 3681 id: inputId, 3682 'data-customize-setting-key-link': 'default' 3683 }; 3684 if ( 'textarea' === data.type ) { 3685 inputAttrs.rows = '5'; 3686 } else if ( 'button' === data.type ) { 3687 inputAttrs['class'] = 'button button-secondary'; 3688 inputAttrs.type = 'button'; 3689 } else { 3690 inputAttrs.type = data.type; 3691 } 3692 if ( data.description ) { 3693 inputAttrs['aria-describedby'] = descriptionId; 3694 } 3695 _.extend( inputAttrs, data.inputAttrs ); 3696 #> 3697 3698 <# if ( 'button' === data.type ) { #> 3699 <button 3700 <# _.each( _.extend( inputAttrs ), function( value, key ) { #> 3701 {{{ key }}}="{{ value }}" 3702 <# } ); #> 3703 >{{ inputAttrs.value }}</button> 3704 <# } else if ( 'textarea' === data.type ) { #> 3705 <textarea 3706 <# _.each( _.extend( inputAttrs ), function( value, key ) { #> 3707 {{{ key }}}="{{ value }}" 3708 <# }); #> 3709 >{{ inputAttrs.value }}</textarea> 3710 <# } else if ( 'select' === data.type ) { #> 3711 <select 3712 <# _.each( _.extend( inputAttrs ), function( value, key ) { #> 3713 {{{ key }}}="{{ value }}" 3714 <# }); #> 3715 > 3716 <# _.each( data.choices, function( val, key ) { #> 3717 <# 3718 var value, text; 3719 if ( _.isObject( val ) ) { 3720 value = val.value; 3721 text = val.text; 3722 } else { 3723 value = key; 3724 text = val; 3725 } 3726 #> 3727 <option value="{{ value }}">{{ text }}</option> 3728 <# } ); #> 3729 </select> 3730 <# } else { #> 3731 <input 3732 <# _.each( _.extend( inputAttrs ), function( value, key ) { #> 3733 {{{ key }}}="{{ value }}" 3734 <# }); #> 3735 > 3736 <# } #> 3737 <# } #> 3738 </script> 3739 3605 3740 <script type="text/html" id="tmpl-customize-notification"> 3606 3741 <li class="notice notice-{{ data.type || 'info' }} {{ data.alt ? 'notice-alt' : '' }} {{ data.dismissible ? 'is-dismissible' : '' }} {{ data.containerClasses || '' }}" data-code="{{ data.code }}" data-type="{{ data.type }}"> … … 3622 3757 </ul> 3623 3758 </script> 3759 3624 3760 <script type="text/html" id="tmpl-customize-preview-link-control" > 3625 3761 <# var elementPrefix = _.uniqueId( 'el' ) + '-' #> … … 3638 3774 <button class="customize-copy-preview-link preview-control-element button button-secondary" data-component="button" data-copy-text="<?php esc_attr_e( 'Copy' ); ?>" data-copied-text="<?php esc_attr_e( 'Copied' ); ?>" ><?php esc_html_e( 'Copy' ); ?></button> 3639 3775 </div> 3640 </script>3641 <script type="text/html" id="tmpl-customize-trash-changeset-control">3642 <button type="button" class="button-link button-link-delete"><?php _e( 'Discard changes' ); ?></button>3643 3776 </script> 3644 3777 <script type="text/html" id="tmpl-customize-selected-changeset-status-control"> -
trunk/src/wp-includes/script-loader.php
r41751 r41771 566 566 'close' => __( 'Close' ), 567 567 'action' => __( 'Action' ), 568 'discardChanges' => __( 'Discard changes' ), 568 569 'cheatin' => __( 'Cheatin’ uh?' ), 569 570 'notAllowed' => __( 'Sorry, you are not allowed to customize this site.' ),
Note: See TracChangeset
for help on using the changeset viewer.