Skip to content

refactor(admin): replace Chosen with datalist for sponsor chapter filter - #2819

Closed
mroderick wants to merge 2 commits into
masterfrom
feature/replace-chosen-sponsors-filter
Closed

refactor(admin): replace Chosen with datalist for sponsor chapter filter#2819
mroderick wants to merge 2 commits into
masterfrom
feature/replace-chosen-sponsors-filter

Conversation

@mroderick

Copy link
Copy Markdown
Collaborator

What

Replaces the Chosen-enhanced collection_select on /admin/sponsors with 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.hamlcollection_selectf.input :chapter, as: :string with list: 'chapter-options' and a <datalist>
  • app/queries/sponsors_search.rbby_chapter now accepts chapter names (case-insensitive lookup) as well as IDs for backward compatibility
  • Tests added for chapter name filtering and case insensitivity

No JavaScript

Zero JS required. Works with native browser autocomplete.

Testing

  • bundle exec rspec spec/queries/sponsors_search_spec.rb — 10 examples, 0 failures
  • bundle exec rspec spec/features/admin/filtering_sponsors_list_spec.rb — 3 scenarios, 0 failures

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
@mroderick mroderick closed this Aug 30, 2026
@mroderick
mroderick deleted the feature/replace-chosen-sponsors-filter branch August 30, 2026 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant