In the modal state for Embed previews, only show the Title field when the preview fails.

Props johnbillion, wonderboymusic.
See #29476.


git-svn-id: https://develop.svn.wordpress.org/trunk@31632 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-03-05 21:02:42 +00:00
parent 2d120c988e
commit b44cf676b1
2 changed files with 22 additions and 4 deletions

View File

@ -4635,7 +4635,13 @@ EmbedLink = Settings.extend({
post_ID: wp.media.view.settings.post.id,
shortcode: embed.string()
}
} ).done( _.bind( this.renderoEmbed, this ) );
} )
.done( _.bind( this.renderoEmbed, this ) )
.fail( _.bind( this.renderFail, this ) );
},
renderFail: function () {
this.$( '.setting' ).hide().filter( '.title' ).show();
},
renderoEmbed: function( response ) {
@ -4643,6 +4649,9 @@ EmbedLink = Settings.extend({
attr = {},
opts = { silent: true };
this.$( '.setting' ).hide()
.filter( '.title' )[ html ? 'hide' : 'show' ]();
if ( response && response.attr ) {
attr = response.attr;
@ -4664,7 +4673,7 @@ EmbedLink = Settings.extend({
}
this.spinner.hide();
this.$('.embed-container').show().find('.embed-preview').html( html );
}
});

View File

@ -58,7 +58,13 @@ EmbedLink = Settings.extend({
post_ID: wp.media.view.settings.post.id,
shortcode: embed.string()
}
} ).done( _.bind( this.renderoEmbed, this ) );
} )
.done( _.bind( this.renderoEmbed, this ) )
.fail( _.bind( this.renderFail, this ) );
},
renderFail: function () {
this.$( '.setting' ).hide().filter( '.title' ).show();
},
renderoEmbed: function( response ) {
@ -66,6 +72,9 @@ EmbedLink = Settings.extend({
attr = {},
opts = { silent: true };
this.$( '.setting' ).hide()
.filter( '.title' )[ html ? 'hide' : 'show' ]();
if ( response && response.attr ) {
attr = response.attr;
@ -87,7 +96,7 @@ EmbedLink = Settings.extend({
}
this.spinner.hide();
this.$('.embed-container').show().find('.embed-preview').html( html );
}
});