Revisions: Better error handling.

* Shows an error message if the current diff can't be loaded.
* For bulk pre-loading, catches errors, and cuts subsequent requests in half, until eventually giving up.
* Some CSS fixes related to this, and the loading spinner.
* `wp.revisions.loadAll()` now returns a promise representing whether or not all revisions could be loaded.

Fixes #24758.

git-svn-id: https://develop.svn.wordpress.org/trunk@24732 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith
2013-07-18 16:35:19 +00:00
parent 93943d6cb9
commit 3dd36021d8
3 changed files with 63 additions and 17 deletions

View File

@@ -3554,16 +3554,24 @@ body.revision-php {
height: 140px;
}
.revisions .loading-indicator {
.revisions .diff-error {
position: absolute;
text-align: center;
vertical-align: middle;
opacity: 0;
margin: 0 auto;
width: 100%;
height: 32px;
display: none;
}
.revisions.diff-error .diff-error {
display: block;
}
.revisions .loading-indicator {
position: absolute;
vertical-align: middle;
opacity: 0;
width: 100%;
top: 3em;
background: #fff url(../images/wpspin_light-2x.gif) no-repeat center top;
-webkit-transition: opacity 0.5s;
-moz-transition: opacity 0.5s;
-ms-transition: opacity 0.5s;
@@ -3571,6 +3579,12 @@ body.revision-php {
transition: opacity 0.5s;
}
.revisions .loading-indicator span.spinner {
display: block;
margin: 0 auto;
float: none;
}
.revisions.loading .loading-indicator {
opacity: 1;
}
@@ -3587,6 +3601,10 @@ body.revision-php {
opacity: 0.5;
}
.revisions.diff-error .diff {
visibility: hidden;
}
.revisions-meta {
margin-top: 15px;
}