Changeset 22022
- Timestamp:
- 09/26/2012 09:40:02 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/meta-boxes.php
r22019 r22022 1031 1031 1032 1032 if ( ! workflow ) { 1033 workflow = wp.media(); 1033 workflow = wp.media({ 1034 library: { 1035 type: 'image' 1036 } 1037 }); 1038 1034 1039 workflow.selection.on( 'add', function( model ) { 1035 1040 var sizes = model.get('sizes'), -
trunk/wp-includes/js/media-views.js
r21908 r22022 17 17 media.controller.Workflow = Backbone.Model.extend({ 18 18 defaults: { 19 multiple: false, 20 view: 'library' 19 multiple: false, 20 view: 'library', 21 library: {}, 22 selection: [] 21 23 }, 22 24 … … 25 27 26 28 // Initialize view storage. 27 this._views = {};28 this._pending = {};29 this._views = {}; 30 this._pendingViews = {}; 29 31 30 32 // Initialize modal container view. … … 32 34 33 35 // Add default views. 34 this.add( 'library', media.view.Workspace.Library, { collection: media.query() } ); 36 // 37 // Use the `library` property to initialize the corresponding view, 38 // then unset the property. 39 this.add( 'library', media.view.Workspace.Library, { 40 collection: media.query( this.get('library') ) 41 } ); 42 this.unset('library'); 43 44 // Add the gallery view. 35 45 this.add( 'gallery', media.view.Workspace.Gallery, { collection: this.selection } ); 36 46 }, … … 46 56 add: function( id, constructor, options ) { 47 57 this.remove( id ); 48 this._pending [ id ] = {58 this._pendingViews[ id ] = { 49 59 view: constructor, 50 60 options: options … … 64 74 65 75 id = id || this.get('view'); 66 pending = this._pending [ id ];76 pending = this._pendingViews[ id ]; 67 77 68 78 if ( ! this._views[ id ] && pending ) { 69 79 this._views[ id ] = new pending.view( _.extend({ controller: this }, pending.options || {} ) ); 70 delete this._pending [ id ];80 delete this._pendingViews[ id ]; 71 81 this.trigger( 'init init:' + id, this._views[ id ] ); 72 82 } … … 80 90 remove: function( id ) { 81 91 delete this._views[ id ]; 82 delete this._pending [ id ];92 delete this._pendingViews[ id ]; 83 93 this.trigger( 'remove remove:' + id ); 84 94 return this; … … 97 107 98 108 if ( ! view ) 99 return ;109 return this; 100 110 101 111 view.render(); … … 108 118 109 119 // Initialize workflow-specific models. 110 this.selection = new Attachments(); 120 // Use the `selection` property to initialize the Attachments 121 // collection, then unset the property. 122 this.selection = new Attachments( this.get('selection') ); 123 this.unset('selection'); 111 124 112 125 _.extend( this.selection, {
Note: See TracChangeset
for help on using the changeset viewer.