Ticket #47048: 47048-5.diff
File 47048-5.diff, 4.9 KB (added by , 5 years ago) |
---|
-
src/js/_enqueues/lib/nav-menu.js
diff --git src/js/_enqueues/lib/nav-menu.js src/js/_enqueues/lib/nav-menu.js index cd62acc..29ee93c 100644
208 208 // Add the items 209 209 api.addItemToMenu(menuItems, processMethod, function(){ 210 210 // Deselect the items and hide the ajax spinner 211 checkboxes.removeAttr('checked'); 211 checkboxes.removeAttr( 'checked' ); 212 t.find( '.button-controls .select-all' ).removeAttr( 'checked' ); 212 213 t.find( '.button-controls .spinner' ).removeClass( 'is-active' ); 213 214 }); 214 215 }); … … 1090 1091 } 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( 'area' ); 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.removeAttr( 'checked' ); 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-area="' + 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') ) { 1104 1118 api.registerChange(); … … 1226 1240 pattern = /menu-item[(\[^]\]*/, 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 1231 1246 if( ! $items.length ) { … … 1260 1275 $('.categorychecklist', panel).html( $items ); 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 1265 1284 /** -
src/wp-admin/includes/nav-menu.php
diff --git src/wp-admin/includes/nav-menu.php src/wp-admin/includes/nav-menu.php index 81b1d18..5dea0ea 100644
function wp_nav_menu_item_post_type_meta_box( $object, $box ) { 608 608 <?php endif; ?> 609 609 </div><!-- /.tabs-panel --> 610 610 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> 611 <p class="button-controls wp-clearfix" data-area="posttype-<?php echo esc_attr( $post_type_name ); ?>"> 612 <span class="list-controls hide-if-no-js"> 613 <input type="checkbox" id="<?php echo esc_attr( $post_type_name . '-tab' ); ?>" class="select-all" /> 614 <label for="<?php echo esc_attr( $post_type_name . '-tab' ); ?>"><?php _e( 'Select All' ); ?></label> 626 615 </span> 627 616 628 617 <span class="add-to-menu"> … … function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) { 848 837 </ul> 849 838 </div><!-- /.tabs-panel --> 850 839 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> 840 <p class="button-controls wp-clearfix" data-area="taxonomy-<?php echo esc_attr( $taxonomy_name ); ?>"> 841 <span class="list-controls hide-if-no-js"> 842 <input type="checkbox" id="<?php echo esc_attr( $taxonomy_name . '-tab' ); ?>" class="select-all" /> 843 <label for="<?php echo esc_attr( $taxonomy_name . '-tab' ); ?>"><?php _e( 'Select All' ); ?></label> 866 844 </span> 867 845 868 846 <span class="add-to-menu">