Add options for select field. #2683
Open
+605
−478
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.
This PR is a followup of: #2676
I've had another go at this. Since i figured out how to get the application up and running locally, #rtfm. I'm pretty bad at writing tests so perhaps someone can help me with writing some better coverage. Is it sufficient to write a test that validates whether a data attribute is slapped onto the select input? Or do i also need to write tests that validate the working of my PR clientside(the stimulus controller) I have no experience testing stimuluscontrollers.
This should get us a nice start to get some more selectize functionality.
I've used the SelectController Stimulus Controller to handle this. We are using data attributes to get the message passed across.
This PR now adds:
Max items. Allows for selecting items up to max_items.
Multiple selecting multiple options.
Selected, allows for the selection of a specific element or multiple elements.
This also works with [[1, 2],[3,4],[5,6]]