mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-10 14:48:07 +02:00
See #28510. Built from https://develop.svn.wordpress.org/trunk@31491 git-svn-id: http://core.svn.wordpress.org/trunk@31472 1a063a9b-81f0-0310-95a4-ce76da25c4cd
43 lines
825 B
JavaScript
43 lines
825 B
JavaScript
/*globals wp, _ */
|
|
|
|
/**
|
|
* A filter dropdown for month/dates.
|
|
*
|
|
* @class
|
|
* @augments wp.media.view.AttachmentFilters
|
|
* @augments wp.media.View
|
|
* @augments wp.Backbone.View
|
|
* @augments Backbone.View
|
|
*/
|
|
var AttachmentFilters = require( '../attachment-filters.js' ),
|
|
l10n = wp.media.view.l10n,
|
|
DateFilter;
|
|
|
|
DateFilter = AttachmentFilters.extend({
|
|
id: 'media-attachment-date-filters',
|
|
|
|
createFilters: function() {
|
|
var filters = {};
|
|
_.each( wp.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;
|
|
}
|
|
});
|
|
|
|
module.exports = DateFilter;
|