Make WordPress Core

Changeset 24020


Ignore:
Timestamp:
04/17/2013 08:12:25 PM (12 years ago)
Author:
ocean90
Message:

Revisions UI: Disable previous and next buttons when you're on the first, and last node. Put revision ticks above the slider range. props lessbloat for initial patch. see #23899.

Location:
trunk/wp-admin
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/css/colors-classic.css

    r24019 r24020  
    14921492
    14931493.revision-tick.completed-true {
    1494     background-color: #aaa;
     1494    background-color: #d1e5ee;
    14951495}
    14961496
  • trunk/wp-admin/css/colors-fresh.css

    r24019 r24020  
    13861386
    13871387.revision-tick.completed-true {
    1388     background-color: #aaa;
     1388    background-color: #d7d7d7;
    13891389}
    13901390
  • trunk/wp-admin/css/wp-admin.css

    r24006 r24020  
    36293629#diff-slider-ticks {
    36303630    position: absolute;
    3631     z-index: 1;
     3631    z-index: 2;
    36323632    margin-top: 20px;
    36333633}
  • trunk/wp-admin/js/revisions.js

    r24019 r24020  
    244244        },
    245245
     246        disabledButtonCheck: function( val ) {
     247            var maxVal = this.revisions.length - 1,
     248                next = $( '#next' ),
     249                prev = $( '#previous' );
     250
     251            // Disable "Next" button if you're on the last node
     252            if ( maxVal === val )
     253                next.prop( 'disabled', true );
     254            else
     255                next.prop( 'disabled', false );
     256
     257            // Disable "Previous" button if you're on the 0 node
     258            if ( 0 === val )
     259                prev.prop( 'disabled', true );
     260            else
     261                prev.prop( 'disabled', false );
     262        },
     263
    246264        completeApplicationSetup: function() {
    247265            this.revisionView = new revisions.view.Diff({
     
    294312                Diff.rightDiff = ( ui.value + 1 );
    295313                Diff.revisionView.render();
     314                Diff.disabledButtonCheck( ui.value );
    296315            } else {
    297316                if ( ui.values[0] === ui.values[1] ) // prevent compare to self
     
    417436            if ( slide )
    418437                $( '#diff-slider' ).trigger( 'slide' );
     438
     439            Diff.disabledButtonCheck( options.value );
    419440        },
    420441
Note: See TracChangeset for help on using the changeset viewer.