Replace Chosen.js with TomSelect for member lookup#2564
Closed
mroderick wants to merge 3 commits intocodebar:masterfrom
Closed
Replace Chosen.js with TomSelect for member lookup#2564mroderick wants to merge 3 commits intocodebar:masterfrom
mroderick wants to merge 3 commits intocodebar:masterfrom
Conversation
- Add search action to Admin::MembersController - Search by name or email with ILIKE query - Return JSON with id, name, surname, email, full_name - Limit results to 50 - Require minimum 3 characters for search - Remove @members = Member.all from index (loaded dynamically)
- Add TomSelect to admin members index page (loaded from CDN) - Search triggers after 3+ characters with 300ms debounce - Display member name and email in dropdown options - Update 'View Profile' link on member selection - Initialize TomSelect before Chosen to avoid conflicts - Exclude member_lookup_id from Chosen initialization
Collaborator
Author
|
Closing in favor of #2562 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Chosen.js is unmaintained (last release 2014) and doesn't support remote data sources. Loading 28,000 members into a dropdown is impractical and causes performance issues.
TomSelect is actively maintained and supports remote search out of the box.
What Changed
/admin/members/searchendpoint for remote member lookup (searches by name/email, min 3 chars, max 50 results)How to Verify
bundle exec rails serverbundle exec rails cthenMember.first.add_role(:admin)jane- returns members with Jane in their name@example.com- returns members with example.com emailsSuggested Searches (based on dev database)
Try searching for common patterns:
jane,john,mary@example.comrobefor RobertsonAll tests passing (6 controller + 2 feature).