Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variant Autocomplete: Allow passing select2 options #5861

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Sep 25, 2024

Summary

This change allows users of the variant autocomplete to customize the behavior of select2, rather that just discarding all the keys that are not searchParameters.

We're using this for a custom controller in which we want to be able to filter by variant, and be able to clear the selection.

So in that controller, we can do:

const inputElement = document.getElementById('variantInput')
inputElement.variantAutocomplete({ allowClear: true })

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

@mamhoff mamhoff requested a review from a team as a code owner September 25, 2024 13:04
@github-actions github-actions bot added the changelog:solidus_backend Changes to the solidus_backend gem label Sep 25, 2024
@mamhoff mamhoff force-pushed the allow-other-variant-autocomplete-options branch 2 times, most recently from 4df93cb to c32c98e Compare September 25, 2024 15:09
This change allows users of the variant autocomplete to customize the
behavior of select2, rather that just discarding all the keys that are
not `searchParameters`.

We're using this for a custom controller in which we want to be able to
filter by variant, and be able to clear the selection.

So in that controller, we can do:

```js
const inputElement = document.getElementById('variantInput')
inputElement.variantAutocomplete({ allowClear: true })
```
@mamhoff mamhoff force-pushed the allow-other-variant-autocomplete-options branch from c32c98e to dce4abb Compare September 25, 2024 15:12
Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

Copy link

codecov bot commented Sep 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.95%. Comparing base (8182cb2) to head (dce4abb).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5861      +/-   ##
==========================================
+ Coverage   89.23%   91.95%   +2.72%     
==========================================
  Files         752      346     -406     
  Lines       17510     7658    -9852     
==========================================
- Hits        15625     7042    -8583     
+ Misses       1885      616    -1269     
Flag Coverage Δ
91.95% <ø> (+2.72%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_backend Changes to the solidus_backend gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants