Ticket #23935: 23935.screen-options.patch
File 23935.screen-options.patch, 4.3 KB (added by , 11 years ago) |
---|
-
wp-admin/js/revisions.js
252 252 253 253 this.reloadToLoadRevisions( this.revisions ); 254 254 255 this.screenOptions = new revisions.view.ScreenOptions(); 256 255 257 this.revisionsInteractions = new revisions.view.Interact({ 256 258 model: this.revisions 257 259 }); … … 573 575 } 574 576 }); 575 577 578 revisions.view.ScreenOptions = Backbone.View.extend({ 579 el: $( '#screen-options-wrap' ), 580 581 events: { 582 'click #compare-two-revisions': 'compareTwo' 583 }, 584 585 // turn on/off the compare two mode 586 compareTwo: function() { 587 console.log( 'jo' ); 588 if ( $( '#compare-two-revisions' ).is( ':checked' ) ) { // compare 2 mode 589 Diff.singleRevision = false ; 590 591 if ( 1 === Diff.rightDiff ) 592 Diff.rightDiff = 2; 593 594 Diff.revisionView.draggingLeft = false; 595 596 revisions.model.settings.revision_id = ''; // reset passed revision id so switching back to one handle mode doesn't re-select revision 597 Diff.reloadLeftRight(); 598 Diff.revisionView.model = Diff.rightHandleRevisions; 599 600 } else { // compare one mode 601 Diff.singleRevision = true; 602 Diff.revisionView.draggingLeft = false; 603 Diff.reloadModelSingle(); 604 } 605 Diff.revisionsInteractions.render(); 606 Diff.tickmarkView.render(); 607 } 608 }); 609 610 576 611 /** 577 612 * wp.revisions.view.Diff 578 613 * … … 583 618 template: wp.template( 'revisions-diff' ), 584 619 draggingLeft: false, 585 620 586 // the compare two button is in this view, add the interaction here587 621 events: { 588 'click #compare-two-revisions': 'compareTwo', 589 'click #restore-revision': 'restore' 622 'click #restore-revision': 'restore' 590 623 }, 591 624 592 625 // render the revisions … … 646 679 $( '#compare-two-revisions' ).prop( 'checked', ! Diff.singleRevision ); 647 680 }, 648 681 649 // turn on/off the compare two mode650 compareTwo: function() {651 if ( $( '#compare-two-revisions' ).is( ':checked' ) ) { // compare 2 mode652 Diff.singleRevision = false ;653 654 if ( 1 === Diff.rightDiff )655 Diff.rightDiff = 2;656 657 Diff.revisionView.draggingLeft = false;658 659 revisions.model.settings.revision_id = ''; // reset passed revision id so switching back to one handle mode doesn't re-select revision660 Diff.reloadLeftRight();661 Diff.revisionView.model = Diff.rightHandleRevisions;662 663 } else { // compare one mode664 Diff.singleRevision = true;665 Diff.revisionView.draggingLeft = false;666 Diff.reloadModelSingle();667 }668 Diff.revisionsInteractions.render();669 Diff.tickmarkView.render();670 },671 672 682 restore: function() { 673 683 document.location = $( '#restore-revision' ).data( 'restoreLink' ); 674 684 } -
wp-admin/css/wp-admin.css
3561 3561 text-decoration: none; 3562 3562 } 3563 3563 3564 #revision-diff-container {3565 position: relative;3566 }3567 3568 #toggle-revision-compare-mode {3569 position: absolute;3570 top: 0;3571 right: 0;3572 padding-top: 15px;3573 }3574 3575 3564 #loading-status { 3576 3565 position: absolute; 3577 3566 top: 0; -
wp-admin/revision.php
92 92 $strings['settings'] = $settings; 93 93 wp_localize_script( 'revisions', 'wpRevisionsL10n', $strings ); 94 94 95 function _show_compare_mode( $screen_settings, $screen ) { 96 if ( 'revision' != $screen->id ) 97 return; 98 99 $setting = '<label>'; 100 $setting .= '<input type="checkbox" id="compare-two-revisions" />'; 101 $setting .= esc_attr__( 'Compare two revisions' ); 102 $setting .= '</label>'; 103 104 return $setting; 105 } 106 add_filter( 'screen_settings', '_show_compare_mode', 10, 2 ); 107 95 108 require_once( './admin-header.php' ); 96 97 109 ?> 98 110 99 111 <div class="wrap"> … … 116 128 </div> 117 129 118 130 <script id="tmpl-revisions-diff" type="text/html"> 119 <div id="toggle-revision-compare-mode">120 <label>121 <input type="checkbox" id="compare-two-revisions" />122 <?php esc_attr_e( 'Compare two revisions' ); ?>123 </label>124 </div>125 126 131 <div id="diff-header-from" class="diff-header"> 127 132 <div id="diff-title-from-current-version" class="diff-title"> 128 133 <?php printf( '<strong>%1$s</strong> %2$s.' , __( 'From:' ), __( 'the current version' ) ); ?>