WordPress/wp-includes/js/media/views/attachment-filters/all.js
Scott Taylor b191013198 Media JS files:
* In media manifests, ditch IIFEs and global injection, these get dynamically scoped via Browserify
* Remove the `debug` option from `browserify:media`
* Add `jshint:media` to `jshint:corejs`
* Add a trailing newline to all new module files

Props iseulde.
See #28510.

Built from https://develop.svn.wordpress.org/trunk@31385


git-svn-id: http://core.svn.wordpress.org/trunk@31366 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-09 16:01:29 +00:00

90 lines
1.6 KiB
JavaScript

/**
* wp.media.view.AttachmentFilters.All
*
* @class
* @augments wp.media.view.AttachmentFilters
* @augments wp.media.View
* @augments wp.Backbone.View
* @augments Backbone.View
*/
var AttachmentFilters = require( '../attachment-filters.js' ),
l10n = wp.media.view.l10n,
All;
All = AttachmentFilters.extend({
createFilters: function() {
var filters = {};
_.each( wp.media.view.settings.mimeTypes || {}, function( text, key ) {
filters[ key ] = {
text: text,
props: {
status: null,
type: key,
uploadedTo: null,
orderby: 'date',
order: 'DESC'
}
};
});
filters.all = {
text: l10n.allMediaItems,
props: {
status: null,
type: null,
uploadedTo: null,
orderby: 'date',
order: 'DESC'
},
priority: 10
};
if ( wp.media.view.settings.post.id ) {
filters.uploaded = {
text: l10n.uploadedToThisPost,
props: {
status: null,
type: null,
uploadedTo: wp.media.view.settings.post.id,
orderby: 'menuOrder',
order: 'ASC'
},
priority: 20
};
}
filters.unattached = {
text: l10n.unattached,
props: {
status: null,
uploadedTo: 0,
type: null,
orderby: 'menuOrder',
order: 'ASC'
},
priority: 50
};
if ( wp.media.view.settings.mediaTrash &&
this.controller.isModeActive( 'grid' ) ) {
filters.trash = {
text: l10n.trash,
props: {
uploadedTo: null,
status: 'trash',
type: null,
orderby: 'date',
order: 'DESC'
},
priority: 50
};
}
this.filters = filters;
}
});
module.exports = All;