Changeset 12593
- Timestamp:
- 05/18/2023 03:25:32 AM (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/list-table/class-plugin-posts.php
r12591 r12593 549 549 550 550 /** 551 * Display the "actions" fields below the filters.551 * Display the additional filter fields. 552 552 */ 553 553 public function extra_tablenav( $which ) { … … 555 555 556 556 if ( 'top' === $which ) { 557 // The first is the reviewer filter, the second is the assign review bulk action.558 557 ?> 559 558 <fieldset class="alignleft actions filter-reviewer"> … … 569 568 ?> 570 569 </fieldset> 571 <fieldset class="alignleft actions hide-if-js bulk-plugin_assign" disabled="disabled">572 <?php573 wp_dropdown_users( [574 'name' => 'reviewer',575 'selected' => 0,576 'show_option_none' => __( 'Assign Review to ...', 'wporg-plugins' ),577 'option_none_value' => 0,578 'role__in' => [ 'plugin_admin', 'plugin_reviewer' ],579 ] );580 submit_button( __( 'Assign', 'wporg-plugins' ), 'primary', false, false );581 ?>582 </fieldset>583 570 <?php 584 571 } 585 586 // TODO: This shouldn't have inline CSS/JS. 587 572 } 573 574 /** 575 * Display the additional bulk action fields. 576 */ 577 protected function bulk_actions( $which = '' ) { 578 parent::bulk_actions( $which ); 579 580 $maybe_dash_two = 'top' === $which ? '' : '-2'; 581 582 ?> 583 <fieldset class="alignleft actions hide-if-js bulk-plugin_assign" disabled="disabled"> 584 <?php 585 wp_dropdown_users( [ 586 'name' => 'reviewer', 587 'id' => "reviewer{$maybe_dash_two}", 588 'selected' => 0, 589 'show_option_none' => __( 'Assign Review to ...', 'wporg-plugins' ), 590 'option_none_value' => 0, 591 'role__in' => [ 'plugin_admin', 'plugin_reviewer' ], 592 ] ); 593 ?> 594 </fieldset> 595 <fieldset class="alignleft actions hide-if-js bulk-plugin_close bulk-plugin_disable" disabled="disabled"> 596 <select name="close_reason" id="close_reason<?php echo $maybe_dash_two; ?>"> 597 <option disabled="disabled" value='' selected="selected"><?php esc_html_e( 'Close/Disable Reason:', 'wporg-plugins' ); ?></option> 598 <?php foreach ( Template::get_close_reasons() as $key => $label ) : ?> 599 <option value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $label ); ?></option> 600 <?php endforeach; ?> 601 </select> 602 </fieldset> 603 <?php 604 605 // Output the JS+CSS needed 588 606 if ( 'top' === $which ) { 589 607 ?> 590 <fieldset class="alignleft actions hide-if-js bulk-plugin_close bulk-plugin_disable" disabled="disabled">591 <select name="close_reason" id="close_reason">592 <option disabled="disabled" value='' selected="selected"><?php esc_html_e( 'Close/Disable Reason:', 'wporg-plugins' ); ?></option>593 <?php foreach ( Template::get_close_reasons() as $key => $label ) : ?>594 <option value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $label ); ?></option>595 <?php endforeach; ?>596 </select>597 <span class="actions bulk-plugin_close">598 <?php submit_button( __( 'Close', 'wporg-plugins' ), 'primary', 'bulk_close', false ); ?>599 </span>600 <span class="actions bulk-plugin_disable">601 <?php submit_button( __( 'Disable', 'wporg-plugins' ), 'primary', 'bulk_close', false ); ?>602 </span>603 </fieldset>604 608 <style> 605 609 #posts-filter fieldset.bulk-plugin_close { … … 611 615 $( '.bulkactions' ).on( 'change', function() { 612 616 var $this = $( this ), 613 val = $this.find(':selected').val(), 614 $tablenav = $this.parents('form').find( '.tablenav.top' ); 615 616 $tablenav.find( '.actions.bulk-plugin_close, .actions.bulk-plugin_disable, .actions.bulk-plugin_assign' ).prop( 'disabled', true ).hide(); 617 $tablenav.find( '.actions.bulk-' + val ).prop( 'disabled', false ).show(); 617 $select = $this.find( 'select[name^=action]' ), 618 val = $select.find(':selected').val(); 619 620 $( '.bulkactions .actions.bulk-plugin_close, .actions.bulk-plugin_disable, .actions.bulk-plugin_assign' ).prop( 'disabled', true ).hide(); 621 $( '.bulkactions .actions.bulk-' + val ).prop( 'disabled', false ).show(); 622 623 // Sync the values between the various selects in top+bottom. 624 $this.find('select').not( $select ).each( function() { 625 $( '.bulkactions' ).not( $this ).find( 'select[name="' + this.name + '"]' ).val( this.value ); 626 } ); 627 628 $( '.bulkactions input.action' ).toggleClass( 'button-primary', val != '-1' ); 618 629 } ); 619 630 } );
Note: See TracChangeset
for help on using the changeset viewer.