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:
parent
641da503ac
commit
8ed123c97f
|
@ -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
|
@ -5619,6 +5619,7 @@
|
|||
priority: 10
|
||||
};
|
||||
|
||||
if ( media.view.settings.post.id ) {
|
||||
filters.uploaded = {
|
||||
text: l10n.uploadedToThisPost,
|
||||
props: {
|
||||
|
@ -5629,44 +5630,17 @@
|
|||
},
|
||||
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,
|
||||
props: {
|
||||
type: key,
|
||||
uploadedTo: null,
|
||||
orderby: 'date',
|
||||
order: 'DESC'
|
||||
}
|
||||
};
|
||||
});
|
||||
filters.all = {
|
||||
text: l10n.allMediaTypes,
|
||||
filters.unattached = {
|
||||
text: l10n.unattached,
|
||||
props: {
|
||||
uploadedTo: 0,
|
||||
type: null,
|
||||
uploadedTo: null,
|
||||
orderby: 'date',
|
||||
order: 'DESC'
|
||||
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
|
@ -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." ),
|
||||
|
|
Loading…
Reference in New Issue