Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#27451 closed enhancement (fixed)

Widget Customizer: Remove jQuery.liveFilter dependency

Reported by: ocean90's profile ocean90 Owned by: ocean90's profile ocean90
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.9
Component: Customize Keywords: has-patch
Focuses: Cc:

Description

The search should do a better job. First pass attached.

  • Moves search to collection
  • Searches in description field too

Attachments (2)

27451.patch (7.9 KB) - added by ocean90 11 years ago.
27451.2.patch (4.3 KB) - added by westonruter 11 years ago.
Update a search_matched property on the WidgetModel instead of filtering out widgets from availableWidgets; otherwise, the incremented multi_number gets lost, and only one instance of a multi-widget can be added. This also fixes a bug with a widget area losing its sortability after adding a widget via a search. Also, don't equate an empty array with an error when the instance is passed to the update_widget Ajax request. https://github.com/x-team/wordpress-develop/pull/9/files

Download all attachments as: .zip

Change History (7)

@ocean90
11 years ago

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


11 years ago

#2 @westonruter
11 years ago

@ocean90: I love how the filter now matches against both the widget name and description, and how the order of the terms is irrelevant. Great idea on combining multiple lookahead patterns.

I found two issues:

  1. The replacement of spaces was not done globally (needs / /g instead of ' '), so only the order of the first two words was not significant
  2. The search term wasn't escaped for RegExp meta characters, so JavaScript errors could be thrown.

Here're my revisions on your patch: https://github.com/x-team/wordpress-develop/commit/95c146a718b72f13419776e6dc41daa09327cbba

Our patches combined: https://github.com/x-team/wordpress-develop/pull/3/files

#3 @ocean90
11 years ago

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

In 27650:

Widget Customizer: Improve widget search.

  • Removes jQuery.liveFilter dependency
  • Filters widget collection directly
  • Widget's name, ID and description will be searched

fixes #27451.

#4 @westonruter
11 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Filtering the widget collection turns out to cause some issues with adding multiple widgets of a certain instance, and also for sorting widgets in a widget area. Patch incoming...

@westonruter
11 years ago

Update a search_matched property on the WidgetModel instead of filtering out widgets from availableWidgets; otherwise, the incremented multi_number gets lost, and only one instance of a multi-widget can be added. This also fixes a bug with a widget area losing its sortability after adding a widget via a search. Also, don't equate an empty array with an error when the instance is passed to the update_widget Ajax request. https://github.com/x-team/wordpress-develop/pull/9/files

#5 @ocean90
11 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 28044:

Widget Customizer: Fix widget filtering.

props westonruter.
fixes #27451.

Note: See TracTickets for help on using tickets.