Make WordPress Core

Changeset 22710


Ignore:
Timestamp:
11/20/2012 11:57:08 AM (12 years ago)
Author:
koopersmith
Message:

Media: Refresh the attachment display settings when the active attachment finishes uploading. fixes #22452, see #21390.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/media-views.js

    r22708 r22710  
    15321532                    controller:   this,
    15331533                    model:        display[ single.cid ],
    1534                     sizes:        single.get('sizes'),
     1534                    attachment:   single,
    15351535                    priority:     160,
    1536                     type:         single.get('type'),
    15371536                    userSettings: state.get('displayUserSettings')
    15381537                }).render()
     
    30333032
    30343033        initialize: function() {
     3034            var attachment = this.options.attachment;
     3035
    30353036            _.defaults( this.options, {
    30363037                userSettings: false
    30373038            });
     3039
    30383040            media.view.Settings.prototype.initialize.apply( this, arguments );
    30393041            this.model.on( 'change:link', this.updateCustomLink, this );
     3042
     3043            if ( attachment )
     3044                attachment.on( 'change:uploading', this.render, this );
     3045        },
     3046
     3047        dispose: function() {
     3048            var attachment = this.options.attachment;
     3049            if ( attachment )
     3050                attachment.off( null, null, this );
     3051
     3052            media.view.Settings.prototype.dispose.apply( this, arguments );
    30403053        },
    30413054
    30423055        render: function() {
     3056            var attachment = this.options.attachment;
     3057            if ( attachment ) {
     3058                _.extend( this.options, {
     3059                    sizes: attachment.get('sizes'),
     3060                    type:  attachment.get('type')
     3061                });
     3062            }
     3063
    30433064            media.view.Settings.prototype.render.call( this );
    30443065            this.updateCustomLink();
Note: See TracChangeset for help on using the changeset viewer.