Changeset 46240
- Timestamp:
- 09/23/2019 12:41:14 PM (5 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/lib/nav-menu.js
r45869 r46240 209 209 api.addItemToMenu(menuItems, processMethod, function(){ 210 210 // Deselect the items and hide the ajax spinner 211 checkboxes.removeAttr('checked'); 211 checkboxes.prop( 'checked', false ); 212 t.find( '.button-controls .select-all' ).prop( 'checked', false ); 212 213 t.find( '.button-controls .spinner' ).removeClass( 'is-active' ); 213 214 }); … … 1062 1063 attachTabsPanelListeners : function() { 1063 1064 $('#menu-settings-column').bind('click', function(e) { 1064 var selectAreaMatch, panelId, wrapper, items,1065 var selectAreaMatch, selectAll, panelId, wrapper, items, 1065 1066 target = $(e.target); 1066 1067 … … 1072 1073 1073 1074 // upon changing tabs, we want to uncheck all checkboxes 1074 $( 'input', wrapper).removeAttr('checked');1075 $( 'input', wrapper ).prop( 'checked', false ); 1075 1076 1076 1077 $('.tabs-panel-active', wrapper).removeClass('tabs-panel-active').addClass('tabs-panel-inactive'); … … 1091 1092 1092 1093 e.preventDefault(); 1093 } else if ( target.hasClass('select-all') ) { 1094 selectAreaMatch = /#(.*)$/.exec(e.target.href); 1095 if ( selectAreaMatch && selectAreaMatch[1] ) { 1096 items = $('#' + selectAreaMatch[1] + ' .tabs-panel-active .menu-item-title input'); 1097 if( items.length === items.filter(':checked').length ) 1098 items.removeAttr('checked'); 1099 else 1100 items.prop('checked', true); 1101 return false; 1094 } else if ( target.hasClass( 'select-all' ) ) { 1095 selectAreaMatch = target.closest( '.button-controls' ).data( 'items-type' ); 1096 if ( selectAreaMatch ) { 1097 items = $( '#' + selectAreaMatch + ' .tabs-panel-active .menu-item-title input' ); 1098 1099 if ( items.length === items.filter( ':checked' ).length && ! target.is( ':checked' ) ) { 1100 items.prop( 'checked', false ); 1101 } else if ( target.is( ':checked' ) ) { 1102 items.prop( 'checked', true ); 1103 } 1104 } 1105 } else if ( target.hasClass( 'menu-item-checkbox' ) ) { 1106 selectAreaMatch = target.closest( '.tabs-panel-active' ).parent().attr( 'id' ); 1107 if ( selectAreaMatch ) { 1108 items = $( '#' + selectAreaMatch + ' .tabs-panel-active .menu-item-title input' ); 1109 selectAll = $( '.button-controls[data-items-type="' + selectAreaMatch + '"] .select-all' ); 1110 1111 if ( items.length === items.filter( ':checked' ).length && ! selectAll.is( ':checked' ) ) { 1112 selectAll.prop( 'checked', true ); 1113 } else if ( selectAll.is( ':checked' ) ) { 1114 selectAll.prop( 'checked', false ); 1115 } 1102 1116 } 1103 1117 } else if ( target.hasClass('submit-add-to-menu') ) { … … 1227 1241 $items = $('<div>').html(resp).find('li'), 1228 1242 wrapper = panel.closest( '.accordion-section-content' ), 1243 selectAll = wrapper.find( '.button-controls .select-all' ), 1229 1244 $item; 1230 1245 … … 1261 1276 $( '.spinner', panel ).removeClass( 'is-active' ); 1262 1277 wrapper.removeClass( 'has-no-menu-item' ); 1278 1279 if ( selectAll.is( ':checked' ) ) { 1280 selectAll.prop( 'checked', false ); 1281 } 1263 1282 }, 1264 1283 -
trunk/src/wp-admin/includes/nav-menu.php
r45932 r46240 594 594 $checkbox_items = walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $posts ), 0, (object) $args ); 595 595 596 if ( 'all' == $current_tab && ! empty( $_REQUEST['selectall'] ) ) {597 $checkbox_items = preg_replace( '/(type=(.)checkbox(\2))/', '$1 checked=$2checked$2', $checkbox_items );598 599 }600 601 596 echo $checkbox_items; 602 597 ?> … … 609 604 </div><!-- /.tabs-panel --> 610 605 611 <p class="button-controls wp-clearfix"> 612 <span class="list-controls"> 613 <a href=" 614 <?php 615 echo esc_url( 616 add_query_arg( 617 array( 618 $post_type_name . '-tab' => 'all', 619 'selectall' => 1, 620 ), 621 remove_query_arg( $removed_args ) 622 ) 623 ); 624 ?> 625 #posttype-<?php echo $post_type_name; ?>" class="select-all aria-button-if-js"><?php _e( 'Select All' ); ?></a> 606 <p class="button-controls wp-clearfix" data-items-type="posttype-<?php echo esc_attr( $post_type_name ); ?>"> 607 <span class="list-controls hide-if-no-js"> 608 <input type="checkbox" id="<?php echo esc_attr( $post_type_name . '-tab' ); ?>" class="select-all" /> 609 <label for="<?php echo esc_attr( $post_type_name . '-tab' ); ?>"><?php _e( 'Select All' ); ?></label> 626 610 </span> 627 611 … … 849 833 </div><!-- /.tabs-panel --> 850 834 851 <p class="button-controls wp-clearfix"> 852 <span class="list-controls"> 853 <a href=" 854 <?php 855 echo esc_url( 856 add_query_arg( 857 array( 858 $taxonomy_name . '-tab' => 'all', 859 'selectall' => 1, 860 ), 861 remove_query_arg( $removed_args ) 862 ) 863 ); 864 ?> 865 #taxonomy-<?php echo $taxonomy_name; ?>" class="select-all aria-button-if-js"><?php _e( 'Select All' ); ?></a> 835 <p class="button-controls wp-clearfix" data-items-type="taxonomy-<?php echo esc_attr( $taxonomy_name ); ?>"> 836 <span class="list-controls hide-if-no-js"> 837 <input type="checkbox" id="<?php echo esc_attr( $taxonomy_name . '-tab' ); ?>" class="select-all" /> 838 <label for="<?php echo esc_attr( $taxonomy_name . '-tab' ); ?>"><?php _e( 'Select All' ); ?></label> 866 839 </span> 867 840
Note: See TracChangeset
for help on using the changeset viewer.