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
Implemented disabled attribute for select_tag form helper #1054
Conversation
…n select tags with tests.
I strongly dislike the API. I think it should be like |
I thought about it too at the beginning but something put me off from implementing it that way. Sorry, I did this a few days ago and didn't push it until now. I'll review it again. |
Let's do this...but let's do it in 0.11.X :) |
I was thinking about the API for this issue and I reckon that a
If we want to disable Perhaps it makes sense to let those corner cases aside? |
The same questions apply to the I think maybe allow |
@dariocravero status? |
Goes into 0.11.x. It needs further discussion.
|
…t-options Implemented disabled attribute for select_tag form helper
@dariocravero merged, take care of this since is quite old 👍 |
This implements the requested functionality in #872.
You can now tell an option is disabled by setting its third value in the array that describes it as follows:
options = [['Green', 'green1', true], ['Blue', 'blue1'], ['Black', "black1"]]
In the example,
Green
will be disabled.I also implemented this for optgroups since they're subject to being disabled too.
If you're using optgroups as arrays, then again, set set the third item on the array:
The group
Enemies
will be disabled.For the hash, this was a bit trickier since there wasn't an easy way to tell if the last option was meant to be a boolean value or a directive to tell if you were trying to disable or not the option. Therefore, I decided to force you to use a hash
{:disabled => true}
:Once again,
Enemies
will be disabled on the example.Thoughts? If you decide to merge this in, let me know and I'll update the docs accordingly. :)