Changeset 24814
- Timestamp:
- 07/28/2013 08:15:28 PM (11 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/js/revisions.js
r24790 r24814 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 … … 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 }) ); … … 660 660 }); 661 661 662 // The meta view 662 // The metabox view 663 revisions.view.Metabox = wp.Backbone.View.extend({ 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) 663 681 revisions.view.Meta = wp.Backbone.View.extend({ 664 className: 'revisions-meta',665 682 template: wp.template('revisions-meta'), 666 683 … … 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 … … 680 699 document.location = this.model.get('to').attributes.restoreUrl; 681 700 } 701 }); 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' 682 713 }); 683 714 … … 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 ) { … … 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 -
trunk/wp-admin/revision.php
r24790 r24814 129 129 <input class="button" type="button" value="<?php echo esc_attr_x( 'Next', 'Button label for a next revision' ); ?>" /> 130 130 </div> 131 </script>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 131 </script> 157 132 … … 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 <# } #> 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' ); ?>" /> 179 <# } else { #> 180 type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Revision' ); ?>" /> 181 <# } #> 182 <# } #> 196 183 </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> 212 <# } else { #> 213 <span class="byline"><?php printf( __( 'Revision by %s' ), 214 '<span class="author-name">{{ data.to.attributes.author.name }}</span>' ); ?></span> 215 <# } #> 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 <input 222 <# if ( data.to.attributes.current ) { #> 223 disabled="disabled" 224 <# } #> 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 </div> 232 </div> 184 <# if ( 'tooltip' === data.type ) { #> 185 <div class="revisions-tooltip-arrow"><span></span></div> 186 <# } #> 187 <# } #> 233 188 </script> 234 189
Note: See TracChangeset
for help on using the changeset viewer.