Ticket #28842: 28842.diff
| File 28842.diff, 5.1 KB (added by , 12 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 46919e7..06e3214 100644
a b 672 672 media.view.BulkDeleteButton = media.view.Button.extend({ 673 673 initialize: function() { 674 674 media.view.Button.prototype.initialize.apply( this, arguments ); 675 this.$el.hide(); 675 676 676 this.listenTo( this.controller, 'bulk-edit:activate bulk-edit:deactivate', _.bind( this.visibility, this ) ); 677 this.listenTo( this.controller.state().get('selection'), 'add remove reset', _.bind( this.disabled, this ) ); 677 678 }, 678 679 679 680 click: function() { 680 681 media.view.Button.prototype.click.apply( this, arguments ); 682 681 683 while (this.controller.state().get('selection').length > 0) { 682 684 this.controller.state().get('selection').at(0).destroy(); 683 685 } 684 686 }, 685 687 688 /** 689 * Only enable the button if attachments have been selected. 690 */ 691 disabled: function() { 692 var attachmentsSelected = this.controller.state().get( 'selection' ).length; 693 this.$el.prop( 'disabled', ! attachmentsSelected ); 694 }, 695 696 /** 697 * Set the visibility and disabled attribute after the element has been 698 * rendered. 699 * 700 * @returns {this} Returns itself to allow chaining. 701 */ 702 render: function() { 703 media.view.Button.prototype.render.apply( this, arguments ); 704 705 this.disabled(); 706 this.visibility(); 707 708 return this; 709 }, 710 711 /** 712 * Toggle the visibility of the button based on the mode of the controller. 713 */ 686 714 visibility: function() { 687 var bulkEditActive = this.controller. activeModes.where( { id: 'bulk-edit' } ).length;715 var bulkEditActive = this.controller.isModeActive( 'bulk-edit' ); 688 716 if ( bulkEditActive ) { 689 717 this.$el.show(); 690 718 } else { -
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 eab3c87..10b827a 100644
a b 4162 4162 * @augments Backbone.View 4163 4163 */ 4164 4164 media.view.Button = media.View.extend({ 4165 tagName: ' a',4165 tagName: 'button', 4166 4166 className: 'media-button', 4167 attributes: { href: '#' },4168 4167 4169 4168 events: { 4170 4169 'click': 'click' … … 4226 4225 * @param {Object} event 4227 4226 */ 4228 4227 click: function( event ) { 4229 if ( '#' === this.attributes.href ) {4230 event.preventDefault();4231 }4232 4233 4228 if ( this.options.click && ! this.model.get('disabled') ) { 4234 4229 this.options.click.apply( this, arguments ); 4235 4230 } … … 5658 5653 }).render() ); 5659 5654 5660 5655 this.toolbar.set( 'bulkSelectionToggleButton', new media.view.BulkSelectionToggleButton({ 5661 text: 'Bulk Edit',5656 text: l10n.bulkSelect, 5662 5657 controller: this.controller, 5663 5658 priority: -70 5664 5659 }).render() ); 5665 5660 5666 5661 this.toolbar.set( 'BulkDeleteButton', new media.view.BulkDeleteButton({ 5667 text: 'Bulk Delete',5662 text: l10n.deleteSelected, 5668 5663 controller: this.controller, 5669 5664 priority: -69 5670 5665 }).render() ); -
src/wp-includes/media.php
diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index a1e5b1f..9f5b222 100644
a b function wp_enqueue_media( $args = array() ) { 2891 2891 'uploadImagesTitle' => __( 'Upload Images' ), 2892 2892 2893 2893 // Library 2894 'mediaLibraryTitle' => __( 'Media Library' ), 2895 'insertMediaTitle' => __( 'Insert Media' ), 2896 'createNewGallery' => __( 'Create a new gallery' ), 2897 'createNewPlaylist' => __( 'Create a new playlist' ), 2898 'createNewVideoPlaylist' => __( 'Create a new video playlist' ), 2899 'returnToLibrary' => __( '← Return to library' ), 2900 'allMediaItems' => __( 'All media items' ), 2901 'allMediaTypes' => __( 'All media types' ), 2902 'noItemsFound' => __( 'No items found.' ), 2903 'insertIntoPost' => $hier ? __( 'Insert into page' ) : __( 'Insert into post' ), 2904 'uploadedToThisPost' => $hier ? __( 'Uploaded to this page' ) : __( 'Uploaded to this post' ), 2905 'warnDelete' => __( "You are about to permanently delete this item.\n 'Cancel' to stop, 'OK' to delete." ), 2894 'mediaLibraryTitle' => __( 'Media Library' ), 2895 'insertMediaTitle' => __( 'Insert Media' ), 2896 'createNewGallery' => __( 'Create a new gallery' ), 2897 'createNewPlaylist' => __( 'Create a new playlist' ), 2898 'createNewVideoPlaylist' => __( 'Create a new video playlist' ), 2899 'returnToLibrary' => __( '← Return to library' ), 2900 'allMediaItems' => __( 'All media items' ), 2901 'allMediaTypes' => __( 'All media types' ), 2902 'noItemsFound' => __( 'No items found.' ), 2903 'insertIntoPost' => $hier ? __( 'Insert into page' ) : __( 'Insert into post' ), 2904 'uploadedToThisPost' => $hier ? __( 'Uploaded to this page' ) : __( 'Uploaded to this post' ), 2905 'warnDelete' => __( "You are about to permanently delete this item.\n 'Cancel' to stop, 'OK' to delete." ), 2906 'warnDeleteMultiple' => __( "You are about to permanently delete thes items.\n 'Cancel' to stop, 'OK' to delete." ), 2907 'bulkSelect' => __( 'Bulk Select' ), 2908 'deleteSelected' => __( 'Delete Selected' ), 2909 2906 2910 2907 2911 // From URL 2908 2912 'insertFromUrlTitle' => __( 'Insert from URL' ),