Making WordPress.org

Changeset 5714


Ignore:
Timestamp:
07/26/2017 12:23:32 AM (7 years ago)
Author:
tellyworth
Message:

Plugin directory admin: restore Quick Edit and allow editing slugs from there. Props @SergeyBiryukov

Fixes #2249

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php

    r5691 r5714  
    3333        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
    3434        add_filter( 'admin_head-edit.php', array( $this, 'plugin_posts_list_table' ) );
    35         add_filter( 'post_row_actions', array( $this, 'plugin_row_actions' ) );
    3635        add_action( 'edit_form_top', array( $this, 'show_permalink' ) );
    3736        add_action( 'admin_notices', array( $this, 'add_post_status_notice' ) );
     
    166165
    167166    /**
    168      * Disables Quick Edit for plugins.
    169      *
    170      * @param array $actions An array of row action links.
    171      * @return array Filtered array of row action links.
    172      */
    173     public function plugin_row_actions( $actions ) {
    174         global $post_type;
    175 
    176         if ( 'plugin' === $post_type ) {
    177             unset( $actions['inline hide-if-no-js'] );
    178         }
    179 
    180         return $actions;
    181     }
    182 
    183     /**
    184167     * Rejects plugins in bulk.
    185168     */
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/list-table/class-plugin-posts.php

    r5709 r5714  
    251251
    252252    /**
    253      * Remove the Quick/Bulk Edit hidden row.
     253     * Outputs the hidden row displayed when inline editing.
     254     *
     255     * @global string $mode List table view mode.
    254256     */
    255257    public function inline_edit() {
     258        global $mode;
     259
     260        $screen = $this->screen;
     261
     262        $taxonomy_names = get_object_taxonomies( $screen->post_type );
     263        $hierarchical_taxonomies = array();
     264
     265        foreach ( $taxonomy_names as $taxonomy_name ) {
     266
     267            $taxonomy = get_taxonomy( $taxonomy_name );
     268
     269            if ( ! $taxonomy->show_in_quick_edit ) {
     270                continue;
     271            }
     272
     273            if ( $taxonomy->hierarchical ) {
     274                $hierarchical_taxonomies[] = $taxonomy;
     275            }
     276        }
     277
     278        $m = ( isset( $mode ) && 'excerpt' === $mode ) ? 'excerpt' : 'list';
     279    ?>
     280
     281    <form method="get"><table style="display: none"><tbody id="inlineedit">
     282
     283        <tr id="inline-edit"
     284            class="inline-edit-row inline-edit-row-post inline-edit-<?php echo $screen->post_type; ?> quick-edit-row quick-edit-row-post"
     285            style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
     286
     287        <fieldset class="inline-edit-col-left">
     288            <legend class="inline-edit-legend"><?php _e( 'Quick Edit', 'wporg-plugins' ); ?></legend>
     289            <div class="inline-edit-col">
     290
     291            <label>
     292                <span class="title"><?php _e( 'Slug', 'wporg-plugins' ); ?></span>
     293                <span class="input-text-wrap"><input type="text" name="post_name" value="" /></span>
     294            </label>
     295
     296        </div></fieldset>
     297
     298    <?php if ( count( $hierarchical_taxonomies ) ) : ?>
     299
     300        <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col">
     301
     302    <?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>
     303
     304            <span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ) ?></span>
     305            <input type="hidden" name="tax_input[<?php echo esc_attr( $taxonomy->name ); ?>][]" value="0" />
     306            <ul class="cat-checklist <?php echo esc_attr( $taxonomy->name )?>-checklist">
     307                <?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ) ?>
     308            </ul>
     309
     310    <?php endforeach; // $hierarchical_taxonomies as $taxonomy ?>
     311
     312        </div></fieldset>
     313
     314    <?php endif; // count( $hierarchical_taxonomies ) ?>
     315
     316        <p class="submit inline-edit-save">
     317            <button type="button" class="button cancel alignleft"><?php _e( 'Cancel', 'wporg-plugins' ); ?></button>
     318            <?php wp_nonce_field( 'inlineeditnonce', '_inline_edit', false ); ?>
     319            <button type="button" class="button button-primary save alignright"><?php _e( 'Update', 'wporg-plugins' ); ?></button>
     320            <span class="spinner"></span>
     321            <input type="hidden" name="post_view" value="<?php echo esc_attr( $m ); ?>" />
     322            <input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" />
     323            <span class="error" style="display:none"></span>
     324            <br class="clear" />
     325        </p>
     326        </td></tr>
     327
     328        </tbody></table></form>
     329<?php
    256330    }
    257331
Note: See TracChangeset for help on using the changeset viewer.