Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#28895 closed defect (bug) (fixed)

Media Grid: Add a date filter

Reported by: ocean90's profile ocean90 Owned by: ocean90's profile ocean90
Milestone: 4.0 Priority: low
Severity: major Version: 4.0
Component: Media Keywords: has-patch
Focuses: javascript Cc:

Description

Related: ticket:24716:23

The media list view has a date filter, we should try to add one to the grid view too. But it seems like there is no API to support multiple wp.media.view.AttachmentFilters in one frame yet.

Related code is trunk/src/wp-includes/js/media-views.js@29166#L5397 and trunk/src/wp-includes/js/media-views.js@29166#L5673. Code for the date dropdown from the list table: trunk/src/wp-admin/includes/class-wp-list-table.php@29166#L442.

If someone can came up with a patch for 4.0, that would be cool.

Attachments (3)

28895.diff (4.4 KB) - added by ericlewis 9 years ago.
28895.2.diff (4.7 KB) - added by ericlewis 9 years ago.
28895.3.diff (4.7 KB) - added by ericlewis 9 years ago.

Download all attachments as: .zip

Change History (13)

#1 @ericlewis
9 years ago

it seems like there is no API to support multiple wp.media.view.AttachmentFilters in one frame yet

A new AttachmentFilter view will be added to the AttachmentBrowser's Toolbar, similar to how they are here. So what needs doing is create a new filter view for Date filtering a la media.view.AttachmentFilters.mimeTypes and then conditionally add it to the toolbar, probably inside the conditional check if ( this.controller.activeModes.where( { id: 'grid' } ).length ) { }

This ticket was mentioned in IRC in #wordpress-dev by sathishn1. View the logs.


9 years ago

@ericlewis
9 years ago

#3 @ericlewis
9 years ago

  • Keywords has-patch added; needs-patch removed

In 28895.diff, introduce a date filter.

#4 @michalzuber
9 years ago

Works for me.

#5 @ocean90
9 years ago

  • Keywords needs-refresh added

@ericlewis
9 years ago

#6 @ericlewis
9 years ago

  • Keywords needs-refresh removed

attachment:28895.2.diff is so fresh and so clean.

#7 follow-up: @ocean90
9 years ago

We now have two <select>'s with the same ID attribute, "media-attachment-filters".

This ticket was mentioned in IRC in #wordpress-dev by ocean90. View the logs.


9 years ago

@ericlewis
9 years ago

#9 in reply to: ↑ 7 @ericlewis
9 years ago

Replying to ocean90:

We now have two <select>'s with the same ID attribute, "media-attachment-filters".

Fine catch! I added an id for wp.media.view.DateFilteras .media-attachment-date-filters in attachment:28895.3.diff

#10 @ocean90
9 years ago

  • Owner set to ocean90
  • Resolution set to fixed
  • Status changed from new to closed

In 29271:

Media Grid: Add a date filter.

props ericlewis.
fixes #28895.

Note: See TracTickets for help on using tickets.