Ticket #24804: 24804.17.diff
File 24804.17.diff, 8.6 KB (added by , 11 years ago) |
---|
-
wp-admin/js/revisions.js
window.wp = window.wp || {}; 156 156 this.listenTo( this.slider, 'change:hovering', this.setHovering ); 157 157 this.listenTo( this.slider, 'change:scrubbing', this.setScrubbing ); 158 158 159 this.set({ revision: this. frame.diff() });159 this.set({ revision: this.revisions.get( this.frame.get('to') ) }); 160 160 }, 161 161 162 162 … … window.wp = window.wp || {}; 571 571 model: slider 572 572 }) ); 573 573 574 // Add the Meta view575 this.views.add( new revisions.view.Meta ({574 // Add the Metabox view 575 this.views.add( new revisions.view.Metabox({ 576 576 model: this.model 577 577 }) ); 578 578 }, … … window.wp = window.wp || {}; 659 659 } 660 660 }); 661 661 662 // The meta view663 revisions.view.Meta = wp.Backbone.View.extend({662 // The metabox view 663 revisions.view.Metabox = wp.Backbone.View.extend({ 664 664 className: 'revisions-meta', 665 666 initialize: function() { 667 // Add the 'from' view 668 this.views.add( new revisions.view.MetaFrom({ 669 model: this.model, 670 className: 'diff-meta diff-meta-from' 671 }) ); 672 673 // Add the 'to' view 674 this.views.add( new revisions.view.MetaTo({ 675 model: this.model 676 }) ); 677 } 678 }); 679 680 // The revision meta view (to be extended) 681 revisions.view.Meta = wp.Backbone.View.extend({ 665 682 template: wp.template('revisions-meta'), 666 683 667 684 events: { … … window.wp = window.wp || {}; 673 690 }, 674 691 675 692 prepare: function() { 676 return this.model.toJSON(); 693 return _.extend( this.model.toJSON()[this.type] || {}, { 694 type: this.type 695 }); 677 696 }, 678 697 679 698 restoreRevision: function() { … … window.wp = window.wp || {}; 681 700 } 682 701 }); 683 702 703 // The revision meta 'from' view 704 revisions.view.MetaFrom = revisions.view.Meta.extend({ 705 className: 'diff-meta diff-meta-from', 706 type: 'from' 707 }); 708 709 // The revision meta 'to' view 710 revisions.view.MetaTo = revisions.view.Meta.extend({ 711 className: 'diff-meta diff-meta-to', 712 type: 'to' 713 }); 714 684 715 // The checkbox view. 685 716 revisions.view.Checkbox = wp.Backbone.View.extend({ 686 717 className: 'revisions-checkbox', … … window.wp = window.wp || {}; 714 745 // Encapsulates the tooltip. 715 746 revisions.view.Tooltip = wp.Backbone.View.extend({ 716 747 className: 'revisions-tooltip', 717 template: wp.template('revisions- tooltip'),748 template: wp.template('revisions-meta'), 718 749 719 750 initialize: function( options ) { 720 751 this.listenTo( this.model, 'change:offset', this.render ); … … window.wp = window.wp || {}; 723 754 }, 724 755 725 756 prepare: function() { 726 return this.model.get('revision').toJSON(); 757 return _.extend( { type: 'tooltip' }, { 758 attributes: this.model.get('revision').toJSON() 759 }); 727 760 }, 728 761 729 762 render: function() { -
wp-admin/revision.php
require_once( './admin-header.php' ); 130 130 </div> 131 131 </script> 132 132 133 <script id="tmpl-revisions-tooltip" type="text/html">134 <div class="author-card">135 <# if ( 'undefined' !== typeof data && 'undefined' !== typeof data.author ) { #>136 <div class="author-card<# if ( data.autosave ) { #> autosave<# } #>">137 {{{ data.author.avatar }}}138 <div class="author-info">139 <# if ( data.autosave ) { #>140 <span class="byline"><?php printf( __( 'Autosave by %s' ),141 '<span class="author-name">{{ data.author.name }}</span>' ); ?></span>142 <# } else if ( data.current ) { #>143 <span class="byline"><?php printf( __( 'Current Revision by %s' ),144 '<span class="author-name">{{ data.author.name }}</span>' ); ?></span>145 <# } else { #>146 <span class="byline"><?php printf( __( 'Revision by %s' ),147 '<span class="author-name">{{ data.author.name }}</span>' ); ?></span>148 <# } #>149 <span class="time-ago">{{ data.timeAgo }}</span>150 <span class="date">({{ data.dateShort }})</span>151 </div>152 </div>153 <# } #>154 </div>155 <div class="revisions-tooltip-arrow"><span></span></div>156 </script>157 158 133 <script id="tmpl-revisions-checkbox" type="text/html"> 159 134 <div class="revision-toggle-compare-mode"> 160 135 <label> … … require_once( './admin-header.php' ); 171 146 </script> 172 147 173 148 <script id="tmpl-revisions-meta" type="text/html"> 174 < div class="diff-meta diff-meta-from">149 <# if ( ! _.isUndefined( data.attributes ) ) { #> 175 150 <div class="diff-title"> 176 <strong><?php _ex( 'From:', 'Followed by post revision info' ); ?></strong> 177 <# if ( 'undefined' !== typeof data.from ) { #> 178 <div class="author-card<# if ( data.from.attributes.autosave ) { #> autosave<# } #>"> 179 {{{ data.from.attributes.author.avatar }}} 151 <# if ( 'from' === data.type ) { #> 152 <strong><?php _ex( 'From:', 'Followed by post revision info' ); ?></strong> 153 <# } else if ( 'to' === data.type ) { #> 154 <strong><?php _ex( 'To:', 'Followed by post revision info' ); ?></strong> 155 <# } #> 156 <div class="author-card<# if ( data.attributes.autosave ) { #> autosave<# } #>"> 157 {{{ data.attributes.author.avatar }}} 180 158 <div class="author-info"> 181 <# if ( data. from.attributes.autosave ) { #>159 <# if ( data.attributes.autosave ) { #> 182 160 <span class="byline"><?php printf( __( 'Autosave by %s' ), 183 '<span class="author-name">{{ data. from.attributes.author.name }}</span>' ); ?></span>184 <# } else if ( data. from.attributes.current ) { #>161 '<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span> 162 <# } else if ( data.attributes.current ) { #> 185 163 <span class="byline"><?php printf( __( 'Current Revision by %s' ), 186 '<span class="author-name">{{ data. from.attributes.author.name }}</span>' ); ?></span>164 '<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span> 187 165 <# } else { #> 188 166 <span class="byline"><?php printf( __( 'Revision by %s' ), 189 '<span class="author-name">{{ data. from.attributes.author.name }}</span>' ); ?></span>167 '<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span> 190 168 <# } #> 191 <span class="time-ago">{{ data. from.attributes.timeAgo }}</span>192 <span class="date">({{ data. from.attributes.dateShort }})</span>169 <span class="time-ago">{{ data.attributes.timeAgo }}</span> 170 <span class="date">({{ data.attributes.dateShort }})</span> 193 171 </div> 194 </div> 195 <# } #> 196 </div> 197 </div> 198 199 <div class="diff-meta diff-meta-to"> 200 <div class="diff-title"> 201 <strong><?php _ex( 'To:', 'Followed by post revision info' ); ?></strong> 202 <# if ( 'undefined' !== typeof data.to ) { #> 203 <div class="author-card<# if ( data.to.attributes.autosave ) { #> autosave<# } #>"> 204 {{{ data.to.attributes.author.avatar }}} 205 <div class="author-info"> 206 <# if ( data.to.attributes.autosave ) { #> 207 <span class="byline"><?php printf( __( 'Autosave by %s' ), 208 '<span class="author-name">{{ data.to.attributes.author.name }}</span>' ); ?></span> 209 <# } else if ( data.to.attributes.current ) { #> 210 <span class="byline"><?php printf( __( 'Current Revision by %s' ), 211 '<span class="author-name">{{ data.to.attributes.author.name }}</span>' ); ?></span> 172 <# if ( 'to' === data.type && data.attributes.restoreUrl ) { #> 173 <input 174 <# if ( data.attributes.current ) { #> 175 disabled="disabled" 176 <# } #> 177 <# if ( data.attributes.autosave ) { #> 178 type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Autosave' ); ?>" /> 212 179 <# } else { #> 213 <span class="byline"><?php printf( __( 'Revision by %s' ), 214 '<span class="author-name">{{ data.to.attributes.author.name }}</span>' ); ?></span> 180 type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Revision' ); ?>" /> 215 181 <# } #> 216 <span class="time-ago">{{ data.to.attributes.timeAgo }}</span>217 <span class="date">({{ data.to.attributes.dateShort }})</span>218 </div>219 <# } #>220 <# if ( data.to.attributes.restoreUrl ) { #>221 <input222 <# if ( data.to.attributes.current ) { #>223 disabled="disabled"224 182 <# } #> 225 <# if ( data.to.attributes.autosave ) { #>226 type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Autosave' ); ?>" />227 <# } else { #>228 type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Revision' ); ?>" />229 <# } #>230 <# } #>231 183 </div> 232 </div> 184 <# if ( 'tooltip' === data.type ) { #> 185 <div class="revisions-tooltip-arrow"><span></span></div> 186 <# } #> 187 <# } #> 233 188 </script> 234 189 235 190 <script id="tmpl-revisions-diff" type="text/html">