Changeset 59134
- Timestamp:
- 09/30/2024 06:22:36 PM (12 days ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/admin/common.js
r58449 r59134 1115 1115 } 1116 1116 1117 $document.on( 'wp-updates-notice-added wp-plugin-install-error wp-plugin-update-error wp-plugin-delete-error wp-theme-install-error wp-theme-delete-error ', makeNoticesDismissible );1117 $document.on( 'wp-updates-notice-added wp-plugin-install-error wp-plugin-update-error wp-plugin-delete-error wp-theme-install-error wp-theme-delete-error wp-notice-added', makeNoticesDismissible ); 1118 1118 1119 1119 // Init screen meta. … … 1276 1276 // Marry the secondary "Change role to" controls to the primary controls: 1277 1277 marryControls( $('#new_role'), $('#changeit'), $('#new_role2'), $('#changeit2') ); 1278 1279 var addAdminNotice = function( data ) { 1280 var $notice = $( data.selector ), 1281 $headerEnd = $( '.wp-header-end' ), 1282 type, 1283 dismissible, 1284 $adminNotice; 1285 1286 delete data.selector; 1287 1288 dismissible = ( data.dismissible && data.dismissible === true ) ? ' is-dismissible' : ''; 1289 type = ( data.type ) ? data.type : 'info'; 1290 1291 $adminNotice = '<div id="' + data.id + '" class="notice notice-' + data.type + dismissible + '"><p>' + data.message + '</p></div>'; 1292 1293 // Check if this admin notice already exists. 1294 if ( ! $notice.length ) { 1295 $notice = $( '#' + data.id ); 1296 } 1297 1298 if ( $notice.length ) { 1299 $notice.replaceWith( $adminNotice ); 1300 } else if ( $headerEnd.length ) { 1301 $headerEnd.after( $adminNotice ); 1302 } else { 1303 if ( 'customize' === pagenow ) { 1304 $( '.customize-themes-notifications' ).append( $adminNotice ); 1305 } else { 1306 $( '.wrap' ).find( '> h1' ).after( $adminNotice ); 1307 } 1308 } 1309 1310 $document.trigger( 'wp-notice-added' ); 1311 }; 1312 1313 $( '.bulkactions' ).parents( 'form' ).on( 'submit', function( event ) { 1314 var form = this, 1315 submitterName = event.originalEvent && event.originalEvent.submitter ? event.originalEvent.submitter.name : false; 1316 1317 // Observe submissions from posts lists for 'bulk_action' or users lists for 'new_role'. 1318 var bulkFieldRelations = { 1319 'bulk_action' : 'action', 1320 'changeit' : 'new_role' 1321 }; 1322 if ( ! Object.keys( bulkFieldRelations ).includes( submitterName ) ) { 1323 return; 1324 } 1325 1326 var values = new FormData(form); 1327 var value = values.get( bulkFieldRelations[ submitterName ] ) || '-1'; 1328 1329 // Check that the action is not the default one. 1330 if ( value !== '-1' ) { 1331 // Check that at least one item is selected. 1332 var itemsSelected = form.querySelectorAll( '.wp-list-table tbody .check-column input[type="checkbox"]:checked' ); 1333 1334 if ( itemsSelected.length > 0 ) { 1335 return; 1336 } 1337 } 1338 event.preventDefault(); 1339 event.stopPropagation(); 1340 $( 'html, body' ).animate( { scrollTop: 0 } ); 1341 1342 var errorMessage = __( 'Please select at least one item to perform this action on.' ); 1343 addAdminNotice( { 1344 id: 'no-items-selected', 1345 type: 'error', 1346 message: errorMessage, 1347 dismissible: true, 1348 } ); 1349 1350 wp.a11y.speak( errorMessage ); 1351 }); 1278 1352 1279 1353 /** -
trunk/src/js/_enqueues/admin/inline-edit-post.js
r59016 r59134 149 149 */ 150 150 $('#doaction').on( 'click', function(e){ 151 var n; 151 var n, 152 $itemsSelected = $( '#posts-filter .check-column input[type="checkbox"]:checked' ); 153 154 if ( $itemsSelected.length < 1 ) { 155 return; 156 } 152 157 153 158 t.whichBulkButtonId = $( this ).attr( 'id' ); -
trunk/src/js/_enqueues/wp/updates.js
r58957 r59134 2833 2833 // Bail if there were no items selected. 2834 2834 if ( ! itemsSelected.length ) { 2835 event.preventDefault(); 2836 $( 'html, body' ).animate( { scrollTop: 0 } ); 2837 2838 return wp.updates.addAdminNotice( { 2839 id: 'no-items-selected', 2840 className: 'notice-error is-dismissible', 2841 message: __( 'Please select at least one item to perform this action on.' ) 2842 } ); 2835 bulkAction = false; 2843 2836 } 2844 2837 -
trunk/src/wp-admin/includes/class-wp-list-table.php
r58745 r59134 626 626 echo "</select>\n"; 627 627 628 submit_button( __( 'Apply' ), 'action', ' ', false, array( 'id' => "doaction$two" ) );628 submit_button( __( 'Apply' ), 'action', 'bulk_action', false, array( 'id' => "doaction$two" ) ); 629 629 echo "\n"; 630 630 } -
trunk/src/wp-includes/script-loader.php
r59129 r59134 755 755 ); 756 756 757 $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array( 'jquery', 'hoverIntent', 'utils' ), false, 1 );757 $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array( 'jquery', 'hoverIntent', 'utils', 'wp-a11y' ), false, 1 ); 758 758 $scripts->set_translations( 'common' ); 759 759
Note: See TracChangeset
for help on using the changeset viewer.