Ticket #24716: 24716.35.diff
File 24716.35.diff, 2.7 KB (added by , 10 years ago) |
---|
-
src/wp-includes/js/media-grid.js
diff --git a/src/wp-includes/js/media-grid.js b/src/wp-includes/js/media-grid.js index 0ebbc67..982f906 100644
a b 125 125 modal: false, 126 126 selection: [], 127 127 library: {}, 128 multiple: false,128 multiple: 'add', 129 129 state: 'library', 130 130 uploader: true, 131 131 mode: [ 'grid', 'edit' ] … … 514 514 } 515 515 }); 516 516 517 518 media.view.BulkSelectionControl = media.View.extend({ 519 initialize: function() { 520 media.View.prototype.initialize.apply( this, arguments ); 521 this.views.add( new media.view.BulkSelectionButton({ 522 text: 'Bulk Edit', 523 controller: this.options.controller 524 }) ); 525 this.$el.css( 'display', 'inline' ); 526 this.listenTo( this.options.controller, 'bulk-edit:activate', this.bulkEditActivate ); 527 this.listenTo( this.options.controller, 'bulk-edit:deactivate', this.bulkEditDeactivate ); 528 }, 529 530 bulkEditActivate: function() { 531 532 }, 533 534 bulkEditDeactivate: function() { 535 536 } 537 }); 538 539 540 media.view.BulkSelectionButton = media.view.Button.extend({ 541 initialize: function() { 542 this.$el.html( 'Bulk Edit' ); 543 media.view.Button.prototype.initialize.apply( this, arguments ); 544 }, 545 546 click: function() { 547 media.view.Button.prototype.click.apply( this, arguments ); 548 var activeModes = this.controller.options.mode; 549 if ( _.contains( activeModes, 'edit' ) ) { 550 activeModes = _.without( activeModes, 'edit' ); 551 activeModes.push( 'bulk-edit' ); 552 this.$el.addClass( 'button-primary'); 553 } else { 554 activeModes = _.without( activeModes, 'bulk-edit' ); 555 activeModes.push( 'edit' ); 556 this.$el.removeClass( 'button-primary'); 557 this.controller.state().get('selection').reset(); 558 } 559 this.controller.options.mode = activeModes; 560 } 561 }); 562 517 563 }(jQuery, _, Backbone, wp)); 564 No newline at end of file -
src/wp-includes/js/media-views.js
diff --git a/src/wp-includes/js/media-views.js b/src/wp-includes/js/media-views.js index 6bf147c..5652c8d 100644
a b 4673 4673 } 4674 4674 4675 4675 // In the grid view, bubble up an edit:attachment event to the controller. 4676 if ( _.contains( this.controller.options.mode, ' grid' ) ) {4676 if ( _.contains( this.controller.options.mode, 'edit' ) ) { 4677 4677 this.controller.trigger( 'edit:attachment', this.model ); 4678 4678 return; 4679 4679 } … … 5578 5578 priority: -90 5579 5579 }).render() ); 5580 5580 5581 this.toolbar.set( 'bulkSelectionControls', new media.view.BulkSelectionControl({ 5582 controller: this.controller, 5583 priority: -70 5584 }).render() ); 5585 5581 5586 this.toolbar.set( 'gridFieldOptions', new media.view.GridFieldOptions({ 5582 5587 controller: this.controller, 5583 5588 priority: -50