Make WordPress Core


Ignore:
Timestamp:
11/01/2014 12:14:45 AM (12 years ago)
Author:
wonderboymusic
Message:

Add a single responsibility function for outputting Revisions JS templates: wp_print_revision_templates().

Use it in wp-admin/revision.php.

Props ericlewis.
Fixes #30220.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/revision.php

    r28500 r30129  
    130130        <?php echo $return_to_post; ?>
    131131</div>
     132<?php
     133wp_print_revision_templates();
    132134
    133 <script id="tmpl-revisions-frame" type="text/html">
    134         <div class="revisions-control-frame"></div>
    135         <div class="revisions-diff-frame"></div>
    136 </script>
    137 
    138 <script id="tmpl-revisions-buttons" type="text/html">
    139         <div class="revisions-previous">
    140                 <input class="button" type="button" value="<?php echo esc_attr_x( 'Previous', 'Button label for a previous revision' ); ?>" />
    141         </div>
    142 
    143         <div class="revisions-next">
    144                 <input class="button" type="button" value="<?php echo esc_attr_x( 'Next', 'Button label for a next revision' ); ?>" />
    145         </div>
    146 </script>
    147 
    148 <script id="tmpl-revisions-checkbox" type="text/html">
    149         <div class="revision-toggle-compare-mode">
    150                 <label>
    151                         <input type="checkbox" class="compare-two-revisions"
    152                         <#
    153                         if ( 'undefined' !== typeof data && data.model.attributes.compareTwoMode ) {
    154                                 #> checked="checked"<#
    155                         }
    156                         #>
    157                         />
    158                         <?php esc_attr_e( 'Compare any two revisions' ); ?>
    159                 </label>
    160         </div>
    161 </script>
    162 
    163 <script id="tmpl-revisions-meta" type="text/html">
    164         <# if ( ! _.isUndefined( data.attributes ) ) { #>
    165                 <div class="diff-title">
    166                         <# if ( 'from' === data.type ) { #>
    167                                 <strong><?php _ex( 'From:', 'Followed by post revision info' ); ?></strong>
    168                         <# } else if ( 'to' === data.type ) { #>
    169                                 <strong><?php _ex( 'To:', 'Followed by post revision info' ); ?></strong>
    170                         <# } #>
    171                         <div class="author-card<# if ( data.attributes.autosave ) { #> autosave<# } #>">
    172                                 {{{ data.attributes.author.avatar }}}
    173                                 <div class="author-info">
    174                                 <# if ( data.attributes.autosave ) { #>
    175                                         <span class="byline"><?php printf( __( 'Autosave by %s' ),
    176                                                 '<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span>
    177                                 <# } else if ( data.attributes.current ) { #>
    178                                         <span class="byline"><?php printf( __( 'Current Revision by %s' ),
    179                                                 '<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span>
    180                                 <# } else { #>
    181                                         <span class="byline"><?php printf( __( 'Revision by %s' ),
    182                                                 '<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span>
    183                                 <# } #>
    184                                         <span class="time-ago">{{ data.attributes.timeAgo }}</span>
    185                                         <span class="date">({{ data.attributes.dateShort }})</span>
    186                                 </div>
    187                         <# if ( 'to' === data.type && data.attributes.restoreUrl ) { #>
    188                                 <input  <?php if ( wp_check_post_lock( $post->ID ) ) { ?>
    189                                         disabled="disabled"
    190                                 <?php } else { ?>
    191                                         <# if ( data.attributes.current ) { #>
    192                                                 disabled="disabled"
    193                                         <# } #>
    194                                 <?php } ?>
    195                                 <# if ( data.attributes.autosave ) { #>
    196                                         type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Autosave' ); ?>" />
    197                                 <# } else { #>
    198                                         type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Revision' ); ?>" />
    199                                 <# } #>
    200                         <# } #>
    201                 </div>
    202         <# if ( 'tooltip' === data.type ) { #>
    203                 <div class="revisions-tooltip-arrow"><span></span></div>
    204         <# } #>
    205 <# } #>
    206 </script>
    207 
    208 <script id="tmpl-revisions-diff" type="text/html">
    209         <div class="loading-indicator"><span class="spinner"></span></div>
    210         <div class="diff-error"><?php _e( 'Sorry, something went wrong. The requested comparison could not be loaded.' ); ?></div>
    211         <div class="diff">
    212         <# _.each( data.fields, function( field ) { #>
    213                 <h3>{{ field.name }}</h3>
    214                 {{{ field.diff }}}
    215         <# }); #>
    216         </div>
    217 </script>
    218 
    219 
    220 <?php
    221135require_once( ABSPATH . 'wp-admin/admin-footer.php' );
Note: See TracChangeset for help on using the changeset viewer.