Media JS: Move the modal box's title from being stored in the modal view to being stored as an attribute on the workflow. Update modal titles for both the post media and featured image workflows. see #21390, #21776.

git-svn-id: http://core.svn.wordpress.org/trunk@22044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Daryl Koopersmith 2012-09-27 06:20:22 +00:00
parent 45c255a6a9
commit a9d3197c28
3 changed files with 5 additions and 8 deletions

View File

@ -1031,6 +1031,7 @@ function post_thumbnail_meta_box( $post ) {
if ( ! workflow ) {
workflow = wp.media({
title: title,
library: {
type: 'image'
}
@ -1058,7 +1059,6 @@ function post_thumbnail_meta_box( $post ) {
width: size.width
}).prependTo( $element );
});
workflow.modal.title( title );
}
workflow.modal.open();

View File

@ -103,6 +103,7 @@ var tb_position;
return workflow;
workflow = workflows[ id ] = wp.media( _.defaults( options || {}, {
title: wp.media.view.l10n.insertMedia,
multiple: true
} ) );

View File

@ -19,6 +19,7 @@
*/
media.controller.Workflow = Backbone.Model.extend({
defaults: {
title: '',
multiple: false,
view: 'library',
library: {},
@ -193,9 +194,9 @@
initialize: function() {
this.controller = this.options.controller;
this.controller.on( 'change:title', this.render, this );
_.defaults( this.options, {
title: '',
container: document.body
});
},
@ -208,7 +209,7 @@
// `this.$el.html()` from garbage collecting its events.
this.options.$content.detach();
this.$el.html( this.template( this.options ) );
this.$el.html( this.template( this.controller.toJSON() ) );
this.$('.media-modal-content').append( this.options.$content );
return this;
},
@ -242,11 +243,6 @@
// Set and render the content.
this.options.$content = ( $content instanceof Backbone.View ) ? $content.$el : $content;
return this.render();
},
title: function( title ) {
this.options.title = title;
return this.render();
}
});