Make WordPress Core

Ticket #28326: 28326.diff

File 28326.diff, 2.7 KB (added by wonderboymusic, 9 years ago)
  • src/wp-admin/edit.php

     
    303303
    304304<input type="hidden" name="post_status" class="post_status_page" value="<?php echo !empty($_REQUEST['post_status']) ? esc_attr($_REQUEST['post_status']) : 'all'; ?>" />
    305305<input type="hidden" name="post_type" class="post_type_page" value="<?php echo $post_type; ?>" />
    306 <?php if ( ! empty( $_REQUEST['show_sticky'] ) ) { ?>
    307 <input type="hidden" name="show_sticky" value="1" />
    308 <?php } ?>
     306<input type="hidden" name="show_sticky" class="show_sticky_page" value="<?php
     307        echo ! empty( $_REQUEST['show_sticky'] ) && 1 === (int) $_REQUEST['show_sticky'] ? 1 : 0;
     308?>" />
    309309
    310310<?php $wp_list_table->display(); ?>
    311311
  • src/wp-admin/includes/ajax-actions.php

     
    15301530        // update the post
    15311531        edit_post();
    15321532
     1533        if ( ! empty( $data['sticky_page'] ) && empty( $data['sticky'] ) ) {
     1534                wp_send_json( array( 'action' => 'remove-sticky' ) );
     1535        }
     1536
    15331537        $wp_list_table = _get_list_table( 'WP_Posts_List_Table', array( 'screen' => $_POST['screen'] ) );
    15341538
    15351539        $level = 0;
  • src/wp-admin/js/inline-edit-post.js

     
    239239        },
    240240
    241241        save : function(id) {
    242                 var params, fields, page = $('.post_status_page').val() || '';
     242                var params, fields,
     243                        page = $('.post_status_page').val() || '',
     244                        sticky = $('.show_sticky_page').val() || '';
    243245
    244246                if ( typeof(id) === 'object' ) {
    245247                        id = this.getId(id);
     
    252254                        post_type: typenow,
    253255                        post_ID: id,
    254256                        edit_date: 'true',
    255                         post_status: page
     257                        post_status: page,
     258                        sticky_page: sticky
    256259                };
    257260
    258261                fields = $('#edit-'+id).find(':input').serialize();
     
    261264                // make ajax request
    262265                $.post( ajaxurl, params,
    263266                        function(r) {
     267                                var el, count;
    264268                                $('table.widefat .spinner').hide();
    265269
    266270                                if (r) {
     271                                        if ( 0 === r.indexOf('{') ) {
     272                                                r = $.parseJSON(r);
     273                                                switch (r.action) {
     274                                                        case 'remove-sticky':
     275                                                                $(inlineEditPost.what+id).remove();
     276                                                                $('#edit-'+id).remove();
     277
     278                                                                el = $('.subsubsub .sticky .count');
     279                                                                count = parseInt(el.text().replace(/\(|\)/, ''), 10) - 1;
     280                                                                el.text( '(' + count + ')' );
     281                                                        break;
     282                                                }
     283
     284                                                return false;
     285                                        }
     286
    267287                                        if ( -1 !== r.indexOf( '<tr' ) ) {
    268288                                                $(inlineEditPost.what+id).remove();
    269289                                                $('#edit-'+id).before(r).remove();