In the media modal, show the Link To: url.

Props nacin
fixes #22662


git-svn-id: http://core.svn.wordpress.org/trunk@22965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan Boren 2012-12-02 00:43:08 +00:00
parent b7b54c00e9
commit ebe9cd7395
1 changed files with 16 additions and 7 deletions

View File

@ -3411,7 +3411,7 @@
});
media.view.Settings.prototype.initialize.apply( this, arguments );
this.model.on( 'change:link', this.updateCustomLink, this );
this.model.on( 'change:link', this.updateLinkTo, this );
if ( attachment )
attachment.on( 'change:uploading', this.render, this );
@ -3435,22 +3435,31 @@
}
media.view.Settings.prototype.render.call( this );
this.updateCustomLink();
this.updateLinkTo();
return this;
},
updateCustomLink: function() {
var isCustom = 'custom' === this.model.get('link'),
$input = this.$('.link-to-custom');
updateLinkTo: function() {
var linkTo = this.model.get('link'),
$input = this.$('.link-to-custom'),
attachment = this.options.attachment;
if ( ! isCustom ) {
if ( 'none' === linkTo ) {
$input.hide();
return;
}
$input.show();
if ( ! this.model.get('linkUrl') )
if ( 'post' == linkTo ) {
$input.val( attachment.get('link') );
} else if ( 'file' == linkTo ) {
$input.val( attachment.get('url') );
} else if ( ! this.model.get('linkUrl') ) {
$input.val('http://');
}
$input.prop('readonly', 'custom' !== linkTo);
// If the input is visible, focus and select its contents.
if ( $input.is(':visible') )