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:
Scott Taylor 2014-10-02 04:32:16 +00:00
parent 202ede7696
commit d8c913b3f9
4 changed files with 51 additions and 31 deletions

View File

@ -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));

File diff suppressed because one or more lines are too long

View File

@ -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 ) {

File diff suppressed because one or more lines are too long