Ticket #22748: 22748.2.diff
File 22748.2.diff, 2.3 KB (added by , 12 years ago) |
---|
-
wp-includes/js/media-views.js
3111 3111 refreshSensitivity: 200, 3112 3112 refreshThreshold: 3, 3113 3113 AttachmentView: media.view.Attachment, 3114 sortable: false 3114 sortable: false, 3115 resize: true 3115 3116 }); 3116 3117 3117 3118 this._viewsByCid = {}; … … 3140 3141 _.bindAll( this, 'css' ); 3141 3142 this.model.on( 'change:edge change:gutter', this.css, this ); 3142 3143 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 ); 3144 3146 this.css(); 3145 3147 }, 3146 3148 … … 3170 3172 if ( ! this.$el.is(':visible') ) 3171 3173 return edge; 3172 3174 3173 3174 3175 gutter = this.model.get('gutter') * 2; 3175 3176 width = this.$el.width() - gutter; 3176 3177 columns = Math.ceil( width / ( edge + gutter ) ); … … 3667 3668 clearable: true 3668 3669 }); 3669 3670 3670 this.attachments = new media.view.Attachments ({3671 this.attachments = new media.view.Attachments.Selection({ 3671 3672 controller: this.controller, 3672 3673 collection: this.collection, 3673 3674 selection: this.collection, 3674 sortable: true,3675 3675 model: new Backbone.Model({ 3676 3676 edge: 40, 3677 3677 gutter: 5 3678 }), 3679 3680 // The single `Attachment` view to be used in the `Attachments` view. 3681 AttachmentView: media.view.Attachment.Selection 3678 }) 3682 3679 }); 3683 3680 3684 3681 this.views.set( '.selection-view', this.attachments ); … … 3732 3729 } 3733 3730 }); 3734 3731 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 */ 3735 3752 media.view.Attachment.EditSelection = media.view.Attachment.Selection.extend({ 3736 3753 buttons: { 3737 3754 close: true