Revisions: RTL tooltip fixes. Plus a fix for switching to compare-two mode while looking at the first revision.

Also, a meta box avatar RTL alignment fix. props DrewAPicture.

Fixes #24739.

git-svn-id: http://core.svn.wordpress.org/trunk@24698 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Mark Jaquith 2013-07-13 02:49:53 +00:00
parent 064ee94962
commit c48efb30d4
2 changed files with 32 additions and 6 deletions

View File

@ -1021,16 +1021,28 @@ th.sorted a span {
.revisions img {
float: right;
margin-right: 0;
margin-left: 5px;
margin: 5px 0 0 5px;
}
.revisions-tooltip {
margin-left: -185px;
margin-right: -73px;
margin-left: 0;
-webkit-transition: right 15ms;
-moz-transition: right 15ms;
-ms-transition: right 15ms;
-o-transition: right 15ms;
transition: right 15ms;
}
.revisions-tooltip-arrow {
margin-left: 150px;
right: 0;
margin-left: 0;
margin-right: 35px;
}
.revisions-tooltip-image {
float: right;
margin: 2px 0 0 5px;
}
/*------------------------------------------------------------------------------

View File

@ -331,6 +331,7 @@ window.wp = window.wp || {};
// Set up internal listeners
this.listenTo( this, 'change:from', this.changeRevisionHandler );
this.listenTo( this, 'change:to', this.changeRevisionHandler );
this.listenTo( this, 'change:compareTwoMode', this.changeMode );
this.listenTo( this, 'update:revisions', this.updatedRevisions );
this.listenTo( this.diffs, 'ensure:load', this.updateLoadingStatus );
this.listenTo( this, 'update:diff', this.updateLoadingStatus );
@ -353,6 +354,16 @@ window.wp = window.wp || {};
this.set( 'loading', ! this.diff() );
},
changeMode: function( model, value ) {
// If we were on the first revision before switching, we have to bump them over one
if ( value && 0 === this.revisions.indexOf( this.get('to') ) ) {
this.set({
from: this.revisions.at(0),
to: this.revisions.at(1)
});
}
},
updatedRevisions: function( from, to ) {
if ( this.get( 'compareTwoMode' ) ) {
// TODO: compare-two loading strategy
@ -620,7 +631,7 @@ window.wp = window.wp || {};
// 0.7 to convert the slider-relative percentage to a page-relative percentage
// 100 to convert to a percentage
offset = 15 + (0.7 * offset * 100 ); // Now in a percentage
this.$el.css( 'left', offset + '%' );
this.$el.css( isRtl ? 'right' : 'left', offset + '%' );
}
});
@ -835,7 +846,10 @@ window.wp = window.wp || {};
to: this.model.revisions.at( isRtl ? this.model.revisions.length - ui.values[0] - 1 : ui.values[1] ),
from: this.model.revisions.at( isRtl ? this.model.revisions.length - ui.values[1] - 1 : ui.values[0] )
};
movedRevision = ! isRtl && ui.value === ui.values[0] ? attributes.from : attributes.to;
if ( isRtl )
movedRevision = ui.value === ui.values[1] ? attributes.from : attributes.to;
else
movedRevision = ui.value === ui.values[0] ? attributes.from : attributes.to;
} else {
sliderPosition = this.getSliderPosition( ui );
attributes = {