mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-10 14:48:07 +02:00
See #28510, #30193. Built from https://develop.svn.wordpress.org/trunk@31490 git-svn-id: http://core.svn.wordpress.org/trunk@31471 1a063a9b-81f0-0310-95a4-ce76da25c4cd
44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
/**
|
|
* When MEDIA_TRASH is true, a button that handles bulk Delete Permanently logic
|
|
*
|
|
* @class
|
|
* @augments wp.media.view.DeleteSelectedButton
|
|
* @augments wp.media.view.Button
|
|
* @augments wp.media.View
|
|
* @augments wp.Backbone.View
|
|
* @augments Backbone.View
|
|
*/
|
|
var Button = require( '../button.js' ),
|
|
DeleteSelected = require( './delete-selected.js' ),
|
|
DeleteSelectedPermanently;
|
|
|
|
DeleteSelectedPermanently = DeleteSelected.extend({
|
|
initialize: function() {
|
|
DeleteSelected.prototype.initialize.apply( this, arguments );
|
|
this.listenTo( this.controller, 'select:activate', this.selectActivate );
|
|
this.listenTo( this.controller, 'select:deactivate', this.selectDeactivate );
|
|
},
|
|
|
|
filterChange: function( model ) {
|
|
this.canShow = ( 'trash' === model.get( 'status' ) );
|
|
},
|
|
|
|
selectActivate: function() {
|
|
this.toggleDisabled();
|
|
this.$el.toggleClass( 'hidden', ! this.canShow );
|
|
},
|
|
|
|
selectDeactivate: function() {
|
|
this.toggleDisabled();
|
|
this.$el.addClass( 'hidden' );
|
|
},
|
|
|
|
render: function() {
|
|
Button.prototype.render.apply( this, arguments );
|
|
this.selectActivate();
|
|
return this;
|
|
}
|
|
});
|
|
|
|
module.exports = DeleteSelectedPermanently;
|