Make WordPress Core

Ticket #22748: 22748.2.diff

File 22748.2.diff, 2.3 KB (added by koopersmith, 12 years ago)
  • wp-includes/js/media-views.js

     
    31113111                                refreshSensitivity: 200,
    31123112                                refreshThreshold:   3,
    31133113                                AttachmentView:     media.view.Attachment,
    3114                                 sortable:           false
     3114                                sortable:           false,
     3115                                resize:             true
    31153116                        });
    31163117
    31173118                        this._viewsByCid = {};
     
    31403141                        _.bindAll( this, 'css' );
    31413142                        this.model.on( 'change:edge change:gutter', this.css, this );
    31423143                        this._resizeCss = _.debounce( _.bind( this.css, this ), this.refreshSensitivity );
    3143                         $(window).on( 'resize.attachments', this._resizeCss );
     3144                        if ( this.options.resize )
     3145                                $(window).on( 'resize.attachments', this._resizeCss );
    31443146                        this.css();
    31453147                },
    31463148
     
    31703172                        if ( ! this.$el.is(':visible') )
    31713173                                return edge;
    31723174
    3173 
    31743175                        gutter  = this.model.get('gutter') * 2;
    31753176                        width   = this.$el.width() - gutter;
    31763177                        columns = Math.ceil( width / ( edge + gutter ) );
     
    36673668                                clearable: true
    36683669                        });
    36693670
    3670                         this.attachments = new media.view.Attachments({
     3671                        this.attachments = new media.view.Attachments.Selection({
    36713672                                controller: this.controller,
    36723673                                collection: this.collection,
    36733674                                selection:  this.collection,
    3674                                 sortable:   true,
    36753675                                model:      new Backbone.Model({
    36763676                                        edge:   40,
    36773677                                        gutter: 5
    3678                                 }),
    3679 
    3680                                 // The single `Attachment` view to be used in the `Attachments` view.
    3681                                 AttachmentView: media.view.Attachment.Selection
     3678                                })
    36823679                        });
    36833680
    36843681                        this.views.set( '.selection-view', this.attachments );
     
    37323729                }
    37333730        });
    37343731
     3732        /**
     3733         * wp.media.view.Attachments.Selection
     3734         */
     3735        media.view.Attachments.Selection = media.view.Attachments.extend({
     3736                events: {},
     3737                initialize: function() {
     3738                        _.defaults( this.options, {
     3739                                sortable:   true,
     3740                                resize:     false,
     3741
     3742                                // The single `Attachment` view to be used in the `Attachments` view.
     3743                                AttachmentView: media.view.Attachment.Selection
     3744                        });
     3745                        return media.view.Attachments.prototype.initialize.apply( this, arguments );
     3746                }
     3747        });
     3748
     3749        /**
     3750         * wp.media.view.Attachments.EditSelection
     3751         */
    37353752        media.view.Attachment.EditSelection = media.view.Attachment.Selection.extend({
    37363753                buttons: {
    37373754                        close: true