In `media.view.AttachmentFilters.All`, make `uploaded` conditional upon `media.view.settings.post.id` and include a new filter: `unattached`.

Drop the `mime-types` filter and related class (which was added for Media Grid) and use `all` instead. 

Props ocean90, wonderboymusic.
Fixes #29065.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29204 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-08-07 04:44:17 +00:00
parent 641da503ac
commit 8ed123c97f
5 changed files with 22 additions and 49 deletions

View File

@ -131,7 +131,7 @@
title: options.title,
content: 'browse',
contentUserSetting: false,
filterable: 'mime-types'
filterable: 'all'
})
]);
},

File diff suppressed because one or more lines are too long

View File

@ -5619,54 +5619,28 @@
priority: 10
};
filters.uploaded = {
text: l10n.uploadedToThisPost,
props: {
type: null,
uploadedTo: media.view.settings.post.id,
orderby: 'menuOrder',
order: 'ASC'
},
priority: 20
};
this.filters = filters;
}
});
/**
* wp.media.view.AttachmentFilters.FileTypes
*
* @constructor
* @augments wp.media.view.AttachmentFilters
* @augments wp.media.View
* @augments wp.Backbone.View
* @augments Backbone.View
*/
media.view.AttachmentFilters.mimeTypes = media.view.AttachmentFilters.extend({
createFilters: function() {
var filters = {};
_.each( media.view.settings.mimeTypes || {}, function( text, key ) {
filters[ key ] = {
text: text,
if ( media.view.settings.post.id ) {
filters.uploaded = {
text: l10n.uploadedToThisPost,
props: {
type: key,
uploadedTo: null,
orderby: 'date',
order: 'DESC'
}
type: null,
uploadedTo: media.view.settings.post.id,
orderby: 'menuOrder',
order: 'ASC'
},
priority: 20
};
});
filters.all = {
text: l10n.allMediaTypes,
}
filters.unattached = {
text: l10n.unattached,
props: {
type: null,
uploadedTo: null,
orderby: 'date',
order: 'DESC'
uploadedTo: 0,
type: null,
orderby: 'menuOrder',
order: 'ASC'
},
priority: 10
priority: 50
};
this.filters = filters;
@ -5763,8 +5737,6 @@
FiltersConstructor = media.view.AttachmentFilters.Uploaded;
} else if ( 'all' === filters ) {
FiltersConstructor = media.view.AttachmentFilters.All;
} else if ( 'mime-types' === filters ) {
FiltersConstructor = media.view.AttachmentFilters.mimeTypes;
}
if ( FiltersConstructor ) {

File diff suppressed because one or more lines are too long

View File

@ -2923,6 +2923,7 @@ function wp_enqueue_media( $args = array() ) {
'allDates' => __( 'All dates' ),
'noItemsFound' => __( 'No items found.' ),
'insertIntoPost' => $hier ? __( 'Insert into page' ) : __( 'Insert into post' ),
'unattached' => __( 'Unattached' ),
'uploadedToThisPost' => $hier ? __( 'Uploaded to this page' ) : __( 'Uploaded to this post' ),
'warnDelete' => __( "You are about to permanently delete this item.\n 'Cancel' to stop, 'OK' to delete." ),
'warnBulkDelete' => __( "You are about to permanently delete these items.\n 'Cancel' to stop, 'OK' to delete." ),