Make WordPress Core

Changeset 23904


Ignore:
Timestamp:
04/04/2013 04:03:21 PM (14 years ago)
Author:
markjaquith
Message:

A little more revisions js/php cleanup. see #23901. props kovshenin, ocean90.

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/ajax-actions.php

    r23898 r23904  
    21872187
    21882188                $revision_from_date_author = '';
     2189                $is_current_revision = false;
    21892190                $count++;
    21902191                // return blank data for diffs to the left of the left handle (for right handel model)
    … …  
    22362237                        $revision_from_date_author = sprintf( $autosavef, $revision_from_date_author );
    22372238
    2238                 if ( $revision->post_modified === $post->post_modified )
     2239                if ( $revision->post_modified === $post->post_modified ) {
    22392240                        $revision_date_author = sprintf( $currentf, $revision_date_author );
    2240                 elseif ( wp_is_post_autosave( $revision ) )
     2241                        $is_current_revision = true;
     2242                } elseif ( wp_is_post_autosave( $revision ) ) {
    22412243                        $revision_date_author = sprintf( $autosavef, $revision_date_author );
     2244                }
    22422245
    22432246                /* translators: revision date short format, see http://php.net/date */
    … …  
    22762279                                'restoreLink'          => urldecode( $restore_link ),
    22772280                                'revision_toload'      => true,
    2278                                 'previous_revision_id' => $previous_revision_id
     2281                                'previous_revision_id' => $previous_revision_id,
     2282                                'is_current_revision'  => $is_current_revision,
    22792283                        );
    22802284                }
  • trunk/wp-admin/js/revisions.js

    r23901 r23904  
    634634
    635635                        // hide the restore button when on the last sport/current post data
    636                         if ( Diff.rightDiff === Diff.revisions.length ){
    637                                 $( '#restore-revision' ).hide();
    638                         } else {
    639                                 $( '#restore-revision' ).show();
    640                         }
     636                        $( '#restore-revision' ).toggle( ! Diff.revisions.at( Diff.rightDiff - 1 ).get( 'is_current_revision' ) );
    641637
    642638                        return this;
    … …  
    704700                        lines_deleted: 0,
    705701                        scope_of_changes: 'none',
    706                         previous_revision_id: 0
     702                        previous_revision_id: 0,
     703                        is_current_revision: false
    707704                },
    708705
Note: See TracChangeset for help on using the changeset viewer.