refactor(admin): replace Chosen with datalist for sponsor chapter filter - #2819
Closed
mroderick wants to merge 2 commits into
Closed
refactor(admin): replace Chosen with datalist for sponsor chapter filter#2819mroderick wants to merge 2 commits into
mroderick wants to merge 2 commits into
Conversation
Replaces the Chosen-enhanced collection_select with a native text input backed by a <datalist> of chapter names. The SponsorsSearch query now accepts chapter names (case-insensitive) as well as IDs for backward compatibility. No JavaScript required. Works with 54 chapters (well under Chromium's 512-option datalist limit). Global Chosen init still applies to other pages; this just removes the explicit chosen-select class from this one.
- Replace simple_form_for with form_for + Bootstrap form-control classes - Add visible labels for chapter and name filter inputs - Add page title and h1 heading - Add breadcrumb with link back to admin root - Style placeholder text at 70% opacity - Remove duplicate pagination render
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.
What
Replaces the Chosen-enhanced
collection_selecton/admin/sponsorswith a native text input backed by a<datalist>of chapter names.Why
Chosen 1.8.7 is abandoned (last release 2018). This is the first step in migrating admin selects away from it. The sponsors index chapter filter is the smallest and simplest case — 54 chapters, well within Chromium's 512-option datalist limit.
Changes
app/views/admin/sponsors/index.html.haml—collection_select→f.input :chapter, as: :stringwithlist: 'chapter-options'and a<datalist>app/queries/sponsors_search.rb—by_chapternow accepts chapter names (case-insensitive lookup) as well as IDs for backward compatibilityNo JavaScript
Zero JS required. Works with native browser autocomplete.
Testing
bundle exec rspec spec/queries/sponsors_search_spec.rb— 10 examples, 0 failuresbundle exec rspec spec/features/admin/filtering_sponsors_list_spec.rb— 3 scenarios, 0 failures