mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Add the date
filter from media grid to the media modal.
Props janhenckens, wonderboymusic. Fixes #28990. Built from https://develop.svn.wordpress.org/trunk@29813 git-svn-id: http://core.svn.wordpress.org/trunk@29579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
202ede7696
commit
d8c913b3f9
@ -729,33 +729,4 @@
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* A filter dropdown for month/dates.
|
||||
*/
|
||||
media.view.DateFilter = media.view.AttachmentFilters.extend({
|
||||
id: 'media-attachment-date-filters',
|
||||
|
||||
createFilters: function() {
|
||||
var filters = {};
|
||||
_.each( media.view.settings.months || {}, function( value, index ) {
|
||||
filters[ index ] = {
|
||||
text: value.text,
|
||||
props: {
|
||||
year: value.year,
|
||||
monthnum: value.month
|
||||
}
|
||||
};
|
||||
});
|
||||
filters.all = {
|
||||
text: l10n.allDates,
|
||||
props: {
|
||||
monthnum: false,
|
||||
year: false
|
||||
},
|
||||
priority: 10
|
||||
};
|
||||
this.filters = filters;
|
||||
}
|
||||
});
|
||||
|
||||
}(jQuery, _, Backbone, wp));
|
||||
|
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
@ -5749,6 +5749,41 @@
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* A filter dropdown for month/dates.
|
||||
*
|
||||
* @constructor
|
||||
* @augments wp.media.view.AttachmentFilters
|
||||
* @augments wp.media.View
|
||||
* @augments wp.Backbone.View
|
||||
* @augments Backbone.View
|
||||
*/
|
||||
media.view.DateFilter = media.view.AttachmentFilters.extend({
|
||||
id: 'media-attachment-date-filters',
|
||||
|
||||
createFilters: function() {
|
||||
var filters = {};
|
||||
_.each( media.view.settings.months || {}, function( value, index ) {
|
||||
filters[ index ] = {
|
||||
text: value.text,
|
||||
props: {
|
||||
year: value.year,
|
||||
monthnum: value.month
|
||||
}
|
||||
};
|
||||
});
|
||||
filters.all = {
|
||||
text: l10n.allDates,
|
||||
props: {
|
||||
monthnum: false,
|
||||
year: false
|
||||
},
|
||||
priority: 10
|
||||
};
|
||||
this.filters = filters;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* wp.media.view.AttachmentFilters.Uploaded
|
||||
*
|
||||
@ -6110,6 +6145,20 @@
|
||||
}).render() );
|
||||
}
|
||||
|
||||
} else {
|
||||
// DateFilter is a <select>, screen reader text needs to be rendered before
|
||||
this.toolbar.set( 'dateFilterLabel', new media.view.Label({
|
||||
value: l10n.filterByDate,
|
||||
attributes: {
|
||||
'for': 'media-attachment-date-filters'
|
||||
},
|
||||
priority: -75
|
||||
}).render() );
|
||||
this.toolbar.set( 'dateFilter', new media.view.DateFilter({
|
||||
controller: this.controller,
|
||||
model: this.collection.props,
|
||||
priority: -75
|
||||
}).render() );
|
||||
}
|
||||
|
||||
if ( this.options.search ) {
|
||||
|
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
Loading…
Reference in New Issue
Block a user