2015-02-22 08:25:27 +01:00
|
|
|
/*globals wp */
|
|
|
|
|
2015-02-09 01:43:50 +01:00
|
|
|
/**
|
|
|
|
* wp.media.view.AttachmentFilters.All
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @augments wp.media.view.AttachmentFilters
|
|
|
|
* @augments wp.media.View
|
|
|
|
* @augments wp.Backbone.View
|
|
|
|
* @augments Backbone.View
|
|
|
|
*/
|
2015-03-31 04:03:29 +02:00
|
|
|
var l10n = wp.media.view.l10n,
|
2015-02-09 01:43:50 +01:00
|
|
|
All;
|
|
|
|
|
2015-03-31 04:03:29 +02:00
|
|
|
All = wp.media.view.AttachmentFilters.extend({
|
2015-02-09 01:43:50 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-02-09 17:01:29 +01:00
|
|
|
module.exports = All;
|