<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[29484] trunk/src/wp-includes: Media Grid: add Bulk Selection mode for deleting attachments.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/29484">29484</a></dd>
<dt>Author</dt> <dd>wonderboymusic</dd>
<dt>Date</dt> <dd>2014-08-13 22:44:48 +0000 (Wed, 13 Aug 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Media Grid: add Bulk Selection mode for deleting attachments.

* Toolbar is sticky when `select` mode is active
* Selection is toggled when clicking an attachment preview
* Unselected attachments fade out, selected fade in.

See <a href="http://core.trac.wordpress.org/ticket/28842">#28842</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludescssmediaviewscss">trunk/src/wp-includes/css/media-views.css</a></li>
<li><a href="#trunksrcwpincludesjsmediagridjs">trunk/src/wp-includes/js/media-grid.js</a></li>
<li><a href="#trunksrcwpincludesjsmediaviewsjs">trunk/src/wp-includes/js/media-views.js</a></li>
<li><a href="#trunksrcwpincludesmediaphp">trunk/src/wp-includes/media.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludescssmediaviewscss"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/css/media-views.css (29483 => 29484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/css/media-views.css        2014-08-13 19:25:23 UTC (rev 29483)
+++ trunk/src/wp-includes/css/media-views.css   2014-08-13 22:44:48 UTC (rev 29484)
</span><span class="lines">@@ -729,8 +729,19 @@
</span><span class="cx">  -webkit-box-sizing: border-box;
</span><span class="cx">  -moz-box-sizing: border-box;
</span><span class="cx">  box-sizing: border-box;
</span><ins>+       opacity: 1;
+       -webkit-transition: opacity 250ms;
+       transition: opacity 250ms;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.media-frame.mode-select .attachment {
+       opacity: 0.65;
+}
+
+.media-frame.mode-select .attachment.selected {
+       opacity: 1;
+}
+
</ins><span class="cx"> .attachment:focus {
</span><span class="cx">  -webkit-box-shadow:
</span><span class="cx">          inset 0 0 0 5px #fff,
</span><span class="lines">@@ -741,6 +752,15 @@
</span><span class="cx">  outline: none;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.media-frame.mode-grid .attachment:focus {
+       -webkit-box-shadow:
+               inset 0 0 0 6px #f1f1f1,
+               inset 0 0 1px 7px #5b9dd9;
+       box-shadow:
+               inset 0 0 0 6px #f1f1f1,
+               inset 0 0 1px 7px #5b9dd9;
+}
+
</ins><span class="cx"> .selected.attachment {
</span><span class="cx">  -webkit-box-shadow:
</span><span class="cx">          inset 0 0 0 5px #fff,
</span><span class="lines">@@ -750,6 +770,15 @@
</span><span class="cx">          inset 0 0 0 7px #ccc;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.media-frame.mode-grid .selected.attachment {
+       -webkit-box-shadow:
+               inset 0 0 0 6px #f1f1f1,
+               inset 0 0 0 7px #ccc;
+       box-shadow:
+               inset 0 0 0 6px #f1f1f1,
+               inset 0 0 0 7px #ccc;
+}
+
</ins><span class="cx"> .attachment-preview {
</span><span class="cx">  position: relative;
</span><span class="cx">  -webkit-box-shadow:
</span><span class="lines">@@ -922,8 +951,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .selected.attachment:focus,
</span><del>-.attachment.details,
-.media-frame.mode-grid .selected.attachment {
</del><ins>+.attachment.details {
</ins><span class="cx">   -webkit-box-shadow:
</span><span class="cx">          inset 0 0 0 3px #fff,
</span><span class="cx">          inset 0 0 0 7px #1e8cbe;
</span><span class="lines">@@ -932,6 +960,15 @@
</span><span class="cx">          inset 0 0 0 7px #1e8cbe;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.media-frame.mode-grid .selected.attachment:focus {
+       -webkit-box-shadow:
+               inset 0 0 0 3px #f1f1f1,
+               inset 0 0 0 7px #1e8cbe;
+       box-shadow:
+               inset 0 0 0 3px #f1f1f1,
+               inset 0 0 0 7px #1e8cbe;
+}
+
</ins><span class="cx"> .attachment.details .check,
</span><span class="cx"> .attachment.selected .check:focus,
</span><span class="cx"> .media-frame.mode-grid .attachment.selected .check {
</span><span class="lines">@@ -944,14 +981,6 @@
</span><span class="cx">          0 0 0 2px #1e8cbe;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.media-frame.mode-grid .attachment .check {
-       display: block;
-}
-
-.media-frame.mode-grid .attachment .check div {
-       background-position: 21px 0;
-}
-
</del><span class="cx"> .attachment.details .check div,
</span><span class="cx"> .media-frame.mode-grid .attachment.selected .check div {
</span><span class="cx">  background-position: -21px 0;
</span><span class="lines">@@ -997,7 +1026,7 @@
</span><span class="cx"> .attachments-browser .media-toolbar-primary > .media-button-group,
</span><span class="cx"> .attachments-browser .media-toolbar-secondary > .media-button,
</span><span class="cx"> .attachments-browser .media-toolbar-secondary > .media-button-group {
</span><del>-       margin-top: 10px;
</del><ins>+        margin: 11px 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .attachments-browser .attachments,
</span><span class="lines">@@ -2453,7 +2482,6 @@
</span><span class="cx"> 
</span><span class="cx"> /* Regions we don't use at all */
</span><span class="cx"> .media-frame.mode-grid .media-frame-title,
</span><del>-.media-frame.mode-grid .media-frame-toolbar,
</del><span class="cx"> .media-frame.mode-grid .media-frame-router,
</span><span class="cx"> .media-frame.mode-grid .media-frame-menu {
</span><span class="cx">  display: none;
</span><span class="lines">@@ -2488,6 +2516,10 @@
</span><span class="cx">  padding: 2px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.media-frame.mode-select .attachments {
+       padding: 2px;
+}
+
</ins><span class="cx"> /**
</span><span class="cx">  * Copied styles from the Add theme toolbar.
</span><span class="cx">  *
</span><span class="lines">@@ -2511,6 +2543,14 @@
</span><span class="cx">  border: none;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.media-frame.mode-select .attachments-browser .media-toolbar.fixed {
+       position: fixed;
+       top: 28px;
+       left: 182px;
+       right: 20px;
+       width: auto;
+}
+
</ins><span class="cx"> .media-frame.mode-grid input[type="search"] {
</span><span class="cx">  margin: 1px;
</span><span class="cx">  padding: 3px 5px;
</span><span class="lines">@@ -2539,6 +2579,10 @@
</span><span class="cx">  margin-top: 15px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.attachments-browser .media-toolbar-secondary > .select-mode-toggle-button {
+       margin-right: 10px;
+}
+
</ins><span class="cx"> .media-frame.mode-grid .attachments-browser {
</span><span class="cx">  padding: 0;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunksrcwpincludesjsmediagridjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/media-grid.js (29483 => 29484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/media-grid.js   2014-08-13 19:25:23 UTC (rev 29483)
+++ trunk/src/wp-includes/js/media-grid.js      2014-08-13 22:44:48 UTC (rev 29484)
</span><span class="lines">@@ -62,10 +62,13 @@
</span><span class="cx">                          multiple:  'add',
</span><span class="cx">                          state:     'library',
</span><span class="cx">                          uploader:  true,
</span><del>-                               mode:      [ 'grid' ]
</del><ins>+                                mode:      [ 'grid', 'edit' ]
</ins><span class="cx">                   });
</span><span class="cx"> 
</span><del>-                       $(document).on( 'click', '.add-new-h2', _.bind( this.addNewClickHandler, this ) );
</del><ins>+                        this.$window = $( window );
+                       this.$adminBar = $( '#wpadminbar' );
+                       this.$window.on( 'scroll', _.debounce( _.bind( this.fixPosition, this ), 15 ) );
+                       $( document ).on( 'click', '.add-new-h2', _.bind( this.addNewClickHandler, this ) );
</ins><span class="cx"> 
</span><span class="cx">                  // Ensure core and media grid view UI is enabled.
</span><span class="cx">                  this.$el.addClass('wp-core-ui');
</span><span class="lines">@@ -96,6 +99,8 @@
</span><span class="cx">                  // Call 'initialize' directly on the parent class.
</span><span class="cx">                  media.view.MediaFrame.prototype.initialize.apply( this, arguments );
</span><span class="cx"> 
</span><ins>+                       this.on( 'all', function () { console.log( arguments ); } );
+
</ins><span class="cx">                   // Append the frame view directly the supplied container.
</span><span class="cx">                  this.$el.appendTo( this.options.container );
</span><span class="cx"> 
</span><span class="lines">@@ -130,6 +135,7 @@
</span><span class="cx">                                  multiple:           options.multiple,
</span><span class="cx">                                  title:              options.title,
</span><span class="cx">                                  content:            'browse',
</span><ins>+                                       toolbar:            'select',
</ins><span class="cx">                                   contentUserSetting: false,
</span><span class="cx">                                  filterable:         'all'
</span><span class="cx">                          })
</span><span class="lines">@@ -146,6 +152,21 @@
</span><span class="cx">                  this.on( 'edit:attachment', this.openEditAttachmentModal, this );
</span><span class="cx">          },
</span><span class="cx"> 
</span><ins>+               fixPosition: function() {
+                       var $browser;
+                       if ( ! this.isModeActive( 'select' ) ) {
+                               return;
+                       }
+
+                       $browser = this.$('.attachments-browser');
+
+                       if ( $browser.offset().top < this.$window.scrollTop() + this.$adminBar.height() ) {
+                               $browser.find('.media-toolbar').addClass( 'fixed' );
+                       } else {
+                               $browser.find('.media-toolbar').removeClass( 'fixed' );
+                       }
+               },
+
</ins><span class="cx">           /**
</span><span class="cx">           * Click handler for the `Add New` button.
</span><span class="cx">           */
</span><span class="lines">@@ -542,130 +563,64 @@
</span><span class="cx">          }
</span><span class="cx">  });
</span><span class="cx"> 
</span><del>-       /**
-        * Controller for bulk selection.
-        */
-       media.view.BulkSelection = media.View.extend({
-               className: 'bulk-select',
-
</del><ins>+        media.view.SelectModeToggleButton = media.view.Button.extend({
</ins><span class="cx">           initialize: function() {
</span><del>-                       this.model = new Backbone.Model({
-                               currentAction: ''
</del><ins>+                        media.view.Button.prototype.initialize.apply( this, arguments );
+                       this.listenTo( this.controller, 'select:activate select:deactivate', this.toggleBulkEditHandler );
+               },
</ins><span class="cx"> 
</span><del>-                       });
</del><ins>+                click: function() {
+                       media.view.Button.prototype.click.apply( this, arguments );
+                       if ( this.controller.isModeActive( 'select' ) ) {
+                               this.controller.deactivateMode( 'select' ).activateMode( 'edit' );
+                       } else {
+                               this.controller.deactivateMode( 'edit' ).activateMode( 'select' );
+                       }
+               },
</ins><span class="cx"> 
</span><del>-                       this.views.add( new media.view.Label({
-                               value: l10n.bulkActionsLabel,
-                               attributes: {
-                                       'for': 'bulk-select-dropdown'
-                               }
-                       }) );
</del><ins>+                render: function() {
+                       media.view.Button.prototype.render.apply( this, arguments );
+                       this.$el.addClass( 'select-mode-toggle-button' );
+                       return this;
+               },
</ins><span class="cx"> 
</span><del>-                       this.views.add(
-                               new media.view.BulkSelectionActionDropdown({
-                                       controller: this
-                               })
-                       );
</del><ins>+                toggleBulkEditHandler: function() {
+                       var toolbar = this.controller.content.get().toolbar, children;
</ins><span class="cx"> 
</span><del>-                       this.views.add(
-                               new media.view.BulkSelectionActionButton({
-                                       disabled:   true,
-                                       text:       l10n.apply,
-                                       controller: this
-                               })
-                       );
</del><ins>+                        children = toolbar.$( '.media-toolbar-secondary > *, .media-toolbar-primary > *');
+
+                       if ( this.controller.isModeActive( 'select' ) ) {
+                               this.model.set( 'text', l10n.cancelSelection );
+                               children.not( '.delete-selected-button' ).hide();
+                               toolbar.$( '.select-mode-toggle-button' ).show();
+                               toolbar.$( '.delete-selected-button' ).removeClass( 'hidden' );
+                       } else {
+                               this.model.set( 'text', l10n.bulkSelect );
+                               toolbar.$( '.delete-selected-button' ).addClass( 'hidden' );
+                               children.not( '.spinner, .delete-selected-button' ).show();
+                               this.controller.state().get( 'selection' ).reset();
+                       }
</ins><span class="cx">           }
</span><span class="cx">  });
</span><span class="cx"> 
</span><del>-       /**
-        * Bulk Selection dropdown view.
-        *
-        * @constructor
-        * @augments wp.media.View
-        * @augments wp.Backbone.View
-        * @augments Backbone.View
-        */
-       media.view.BulkSelectionActionDropdown = media.View.extend({
-               tagName: 'select',
-               id:      'bulk-select-dropdown',
-
</del><ins>+        media.view.DeleteSelectedButton = media.view.Button.extend({
</ins><span class="cx">           initialize: function() {
</span><span class="cx">                  media.view.Button.prototype.initialize.apply( this, arguments );
</span><del>-                       this.listenTo( this.controller.controller.state().get( 'selection' ), 'add remove reset', _.bind( this.enabled, this ) );
-                       this.$el.append( $('<option></option>').val( '' ).html( l10n.bulkActions ) )
-                               .append( $('<option></option>').val( 'delete' ).html( l10n.deletePermanently ) );
-                       this.$el.prop( 'disabled', true );
-                       this.$el.on( 'change', _.bind( this.changeHandler, this ) );
</del><ins>+                        this.listenTo( this.controller, 'selection:toggle', this.toggleDisabled );
</ins><span class="cx">           },
</span><span class="cx"> 
</span><del>-               /**
-                * Change handler for the dropdown.
-                *
-                * Sets the bulk selection controller's currentAction.
-                */
-               changeHandler: function() {
-                       this.controller.model.set( { 'currentAction': this.$el.val() } );
</del><ins>+                toggleDisabled: function() {
+                       this.$el.attr( 'disabled', ! this.controller.state().get( 'selection' ).length );
</ins><span class="cx">           },
</span><span class="cx"> 
</span><del>-               /**
-                * Enable or disable the dropdown if attachments have been selected.
-                */
-               enabled: function() {
-                       var disabled = ! this.controller.controller.state().get('selection').length;
-                       this.$el.prop( 'disabled', disabled );
</del><ins>+                render: function() {
+                       media.view.Button.prototype.render.apply( this, arguments );
+                       this.$el.addClass( 'delete-selected-button hidden' );
+                       return this;
</ins><span class="cx">           }
</span><span class="cx">  });
</span><span class="cx"> 
</span><span class="cx">  /**
</span><del>-        * Bulk Selection dropdown view.
-        *
-        * @constructor
-        *
-        * @augments wp.media.view.Button
-        * @augments wp.media.View
-        * @augments wp.Backbone.View
-        * @augments Backbone.View
-        */
-       media.view.BulkSelectionActionButton = media.view.Button.extend({
-               tagName: 'button',
-
-               initialize: function() {
-                       media.view.Button.prototype.initialize.apply( this, arguments );
-
-                       this.listenTo( this.controller.model, 'change', this.enabled, this );
-                       this.listenTo( this.controller.controller.state().get( 'selection' ), 'add remove reset', _.bind( this.enabled, this ) );
-               },
-               /**
-                * Button click handler.
-                */
-               click: function() {
-                       var selection = this.controller.controller.state().get('selection');
-                       media.view.Button.prototype.click.apply( this, arguments );
-
-                       if ( 'delete' === this.controller.model.get( 'currentAction' ) ) {
-                               // Currently assumes delete is the only action
-                               if ( confirm( l10n.warnBulkDelete ) ) {
-                                       while ( selection.length > 0 ) {
-                                               selection.at(0).destroy();
-                                       }
-                               }
-                       }
-
-                       this.enabled();
-               },
-               /**
-                * Enable or disable the button depending if a bulk action is selected
-                * in the bulk select dropdown, and if attachments have been selected.
-                */
-               enabled: function() {
-                       var currentAction = this.controller.model.get( 'currentAction' ),
-                               selection = this.controller.controller.state().get('selection'),
-                               disabled = ! currentAction || ! selection.length;
-                       this.$el.prop( 'disabled', disabled );
-               }
-       });
-
-       /**
</del><span class="cx">    * A filter dropdown for month/dates.
</span><span class="cx">   */
</span><span class="cx">  media.view.DateFilter = media.view.AttachmentFilters.extend({
</span></span></pre></div>
<a id="trunksrcwpincludesjsmediaviewsjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/media-views.js (29483 => 29484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/media-views.js  2014-08-13 19:25:23 UTC (rev 29483)
+++ trunk/src/wp-includes/js/media-views.js     2014-08-13 22:44:48 UTC (rev 29484)
</span><span class="lines">@@ -1792,7 +1792,7 @@
</span><span class="cx">          deactivateMode: function( mode ) {
</span><span class="cx">                  // Bail if the mode isn't active.
</span><span class="cx">                  if ( ! this.isModeActive( mode ) ) {
</span><del>-                               return;
</del><ins>+                                return this;
</ins><span class="cx">                   }
</span><span class="cx">                  this.activeModes.remove( this.activeModes.where( { id: mode } ) );
</span><span class="cx">                  this.$el.removeClass( 'mode-' + mode );
</span><span class="lines">@@ -4821,12 +4821,18 @@
</span><span class="cx"> 
</span><span class="cx">                  // In the grid view, bubble up an edit:attachment event to the controller.
</span><span class="cx">                  if ( this.controller.isModeActive( 'grid' ) ) {
</span><del>-                               // Pass the current target to restore focus when closing
-                               this.controller.trigger( 'edit:attachment', this.model, event.currentTarget );
</del><ins>+                                if ( this.controller.isModeActive( 'edit' ) ) {
+                                       // Pass the current target to restore focus when closing
+                                       this.controller.trigger( 'edit:attachment', this.model, event.currentTarget );
</ins><span class="cx"> 
</span><del>-                               // Don't scroll the view and don't attempt to submit anything.
-                               event.stopPropagation();
-                               return;
</del><ins>+                                        // Don't scroll the view and don't attempt to submit anything.
+                                       event.stopPropagation();
+                                       return;
+                               }
+
+                               if ( this.controller.isModeActive( 'select' ) ) {
+                                       method = 'toggle';
+                               }
</ins><span class="cx">                   }
</span><span class="cx"> 
</span><span class="cx">                  if ( event.shiftKey ) {
</span><span class="lines">@@ -4839,6 +4845,8 @@
</span><span class="cx">                          method: method
</span><span class="cx">                  });
</span><span class="cx"> 
</span><ins>+                       this.controller.trigger( 'selection:toggle' );
+
</ins><span class="cx">                   // Don't scroll the view and don't attempt to submit anything.
</span><span class="cx">                  event.stopPropagation();
</span><span class="cx">          },
</span><span class="lines">@@ -5784,12 +5792,6 @@
</span><span class="cx">                                  priority: -90
</span><span class="cx">                          }).render() );
</span><span class="cx"> 
</span><del>-                               // BulkSelection is a <div> with subviews, including screen reader text
-                               this.toolbar.set( 'bulkSelection', new media.view.BulkSelection({
-                                       controller: this.controller,
-                                       priority: -70
-                               }).render() );
-
</del><span class="cx">                           // DateFilter is a <select>, screen reader text needs to be rendered before
</span><span class="cx">                          this.toolbar.set( 'dateFilterLabel', new media.view.Label({
</span><span class="cx">                                  value: l10n.filterByDate,
</span><span class="lines">@@ -5803,6 +5805,26 @@
</span><span class="cx">                                  model:      this.collection.props,
</span><span class="cx">                                  priority: -75
</span><span class="cx">                          }).render() );
</span><ins>+
+                               // BulkSelection is a <div> with subviews, including screen reader text
+                               this.toolbar.set( 'selectModeToggleButton', new media.view.SelectModeToggleButton({
+                                       text: l10n.bulkSelect,
+                                       controller: this.controller,
+                                       priority: -70
+                               }).render() );
+
+                               this.toolbar.set( 'deleteSelectedButton', new media.view.DeleteSelectedButton({
+                                       style: 'primary',
+                                       disabled: true,
+                                       text:  l10n.deleteSelected,
+                                       controller: this.controller,
+                                       priority: -60,
+                                       click: function() {
+                                               while ( this.controller.state().get( 'selection' ).length > 0 ) {
+                                                       this.controller.state().get( 'selection' ).at( 0 ).destroy();
+                                               }
+                                       }
+                               }).render() );
</ins><span class="cx">                   }
</span><span class="cx"> 
</span><span class="cx">                  this.toolbar.set( 'spinner', new media.view.Spinner({
</span></span></pre></div>
<a id="trunksrcwpincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/media.php (29483 => 29484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/media.php  2014-08-13 19:25:23 UTC (rev 29483)
+++ trunk/src/wp-includes/media.php     2014-08-13 22:44:48 UTC (rev 29484)
</span><span class="lines">@@ -2936,6 +2936,9 @@
</span><span class="cx">          'warnBulkDelete'         => __( "You are about to permanently delete these items.\n  'Cancel' to stop, 'OK' to delete." ),
</span><span class="cx">          'bulkActions'            => __( 'Bulk Actions' ),
</span><span class="cx">          'bulkActionsLabel'       => __( 'Select bulk action' ),
</span><ins>+               'bulkSelect'             => __( 'Bulk Select' ),
+               'cancelSelection'        => __( 'Cancel Selection' ),
+               'deleteSelected'         => __( 'Delete Selected' ),
</ins><span class="cx">           'deletePermanently'      => __( 'Delete Permanently' ),
</span><span class="cx">          'apply'                  => __( 'Apply' ),
</span><span class="cx">          'filterByDate'           => __( 'Filter by date' ),
</span></span></pre>
</div>
</div>

</body>
</html>