mirror of
https://github.com/WordPress/WordPress.git
synced 2024-10-01 08:37:55 +02:00
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,
|
title: options.title,
|
||||||
content: 'browse',
|
content: 'browse',
|
||||||
contentUserSetting: false,
|
contentUserSetting: false,
|
||||||
filterable: 'mime-types'
|
filterable: 'all'
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
|
2
wp-includes/js/media-grid.min.js
vendored
2
wp-includes/js/media-grid.min.js
vendored
File diff suppressed because one or more lines are too long
@ -5619,54 +5619,28 @@
|
|||||||
priority: 10
|
priority: 10
|
||||||
};
|
};
|
||||||
|
|
||||||
filters.uploaded = {
|
if ( media.view.settings.post.id ) {
|
||||||
text: l10n.uploadedToThisPost,
|
filters.uploaded = {
|
||||||
props: {
|
text: l10n.uploadedToThisPost,
|
||||||
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,
|
|
||||||
props: {
|
props: {
|
||||||
type: key,
|
type: null,
|
||||||
uploadedTo: null,
|
uploadedTo: media.view.settings.post.id,
|
||||||
orderby: 'date',
|
orderby: 'menuOrder',
|
||||||
order: 'DESC'
|
order: 'ASC'
|
||||||
}
|
},
|
||||||
|
priority: 20
|
||||||
};
|
};
|
||||||
});
|
}
|
||||||
filters.all = {
|
|
||||||
text: l10n.allMediaTypes,
|
filters.unattached = {
|
||||||
|
text: l10n.unattached,
|
||||||
props: {
|
props: {
|
||||||
type: null,
|
uploadedTo: 0,
|
||||||
uploadedTo: null,
|
type: null,
|
||||||
orderby: 'date',
|
orderby: 'menuOrder',
|
||||||
order: 'DESC'
|
order: 'ASC'
|
||||||
},
|
},
|
||||||
priority: 10
|
priority: 50
|
||||||
};
|
};
|
||||||
|
|
||||||
this.filters = filters;
|
this.filters = filters;
|
||||||
@ -5763,8 +5737,6 @@
|
|||||||
FiltersConstructor = media.view.AttachmentFilters.Uploaded;
|
FiltersConstructor = media.view.AttachmentFilters.Uploaded;
|
||||||
} else if ( 'all' === filters ) {
|
} else if ( 'all' === filters ) {
|
||||||
FiltersConstructor = media.view.AttachmentFilters.All;
|
FiltersConstructor = media.view.AttachmentFilters.All;
|
||||||
} else if ( 'mime-types' === filters ) {
|
|
||||||
FiltersConstructor = media.view.AttachmentFilters.mimeTypes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( FiltersConstructor ) {
|
if ( FiltersConstructor ) {
|
||||||
|
2
wp-includes/js/media-views.min.js
vendored
2
wp-includes/js/media-views.min.js
vendored
File diff suppressed because one or more lines are too long
@ -2923,6 +2923,7 @@ function wp_enqueue_media( $args = array() ) {
|
|||||||
'allDates' => __( 'All dates' ),
|
'allDates' => __( 'All dates' ),
|
||||||
'noItemsFound' => __( 'No items found.' ),
|
'noItemsFound' => __( 'No items found.' ),
|
||||||
'insertIntoPost' => $hier ? __( 'Insert into page' ) : __( 'Insert into post' ),
|
'insertIntoPost' => $hier ? __( 'Insert into page' ) : __( 'Insert into post' ),
|
||||||
|
'unattached' => __( 'Unattached' ),
|
||||||
'uploadedToThisPost' => $hier ? __( 'Uploaded to this page' ) : __( 'Uploaded to this post' ),
|
'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." ),
|
'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." ),
|
'warnBulkDelete' => __( "You are about to permanently delete these items.\n 'Cancel' to stop, 'OK' to delete." ),
|
||||||
|
Loading…
Reference in New Issue
Block a user