Media Grid: after completing a Bulk action, switch from `select` to `edit` mode.

Fixes #28842.


git-svn-id: https://develop.svn.wordpress.org/trunk@29566 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-08-21 04:19:40 +00:00
parent 4a31c2f74a
commit 87366e71ca
2 changed files with 9 additions and 3 deletions

View File

@ -136,7 +136,7 @@
toolbar: 'select', toolbar: 'select',
contentUserSetting: false, contentUserSetting: false,
filterable: 'all', filterable: 'all',
autoSelect: false autoSelect: false
}) })
]); ]);
}, },
@ -583,12 +583,17 @@
initialize: function() { initialize: function() {
media.view.Button.prototype.initialize.apply( this, arguments ); media.view.Button.prototype.initialize.apply( this, arguments );
this.listenTo( this.controller, 'select:activate select:deactivate', this.toggleBulkEditHandler ); this.listenTo( this.controller, 'select:activate select:deactivate', this.toggleBulkEditHandler );
this.listenTo( this.controller, 'selection:action:done', this.back );
},
back: function () {
this.controller.deactivateMode( 'select' ).activateMode( 'edit' );
}, },
click: function() { click: function() {
media.view.Button.prototype.click.apply( this, arguments ); media.view.Button.prototype.click.apply( this, arguments );
if ( this.controller.isModeActive( 'select' ) ) { if ( this.controller.isModeActive( 'select' ) ) {
this.controller.deactivateMode( 'select' ).activateMode( 'edit' ); this.back();
} else { } else {
this.controller.deactivateMode( 'edit' ).activateMode( 'select' ); this.controller.deactivateMode( 'edit' ).activateMode( 'select' );
} }

View File

@ -5864,7 +5864,7 @@
controller: this.controller, controller: this.controller,
priority: -60, priority: -60,
click: function() { click: function() {
var model, changed = [], var model, changed = [], self = this,
selection = this.controller.state().get( 'selection' ), selection = this.controller.state().get( 'selection' ),
library = this.controller.state().get( 'library' ); library = this.controller.state().get( 'library' );
@ -5901,6 +5901,7 @@
if ( changed.length ) { if ( changed.length ) {
$.when.apply( null, changed ).then( function() { $.when.apply( null, changed ).then( function() {
library._requery( true ); library._requery( true );
self.controller.trigger( 'selection:action:done' );
} ); } );
} }
} }